Removed mocked BluetoothAdapter

Bluetooth adapter can not be mocked anymore, using config
resource instead.

Tag: #feature
Bug: 216422716
Test: robotest
Change-Id: I92e503cbceb8412031c7f3b08a3e1016d38da18c
This commit is contained in:
Etienne Ruffieux
2022-01-26 12:08:24 +00:00
parent 49a9361062
commit 865cad2665
2 changed files with 25 additions and 18 deletions

View File

@@ -16,8 +16,9 @@
package com.android.settings.development;
import android.bluetooth.BluetoothManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.SystemProperties;
import androidx.annotation.VisibleForTesting;
@@ -39,13 +40,20 @@ public class BluetoothMaxConnectedAudioDevicesPreferenceController extends
static final String MAX_CONNECTED_AUDIO_DEVICES_PROPERTY =
"persist.bluetooth.maxconnectedaudiodevices";
private final int mDefaultMaxConnectedAudioDevices;
private int mDefaultMaxConnectedAudioDevices = 0;
public BluetoothMaxConnectedAudioDevicesPreferenceController(Context context) {
super(context);
BluetoothManager mBluetoothManager = context.getSystemService(BluetoothManager.class);
mDefaultMaxConnectedAudioDevices = mBluetoothManager.getAdapter()
.getMaxConnectedAudioDevices();
try {
Resources res = context.getPackageManager().getResourcesForApplication(
"com.android.bluetooth");
mDefaultMaxConnectedAudioDevices = res.getInteger(res.getIdentifier(
"config_bluetooth_max_connected_audio_devices",
"integer", "com.android.bluetooth"));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
@Override