Fetch currently loaded bluetooth name

Test: m
ROBOTEST_FILTER="BluetoothMaxConnectedAudioDevicesPreferenceControllerTest"
RunSettingsRoboTests -j40

Test: m ROBOTEST_FILTER="com.android.settings.bluetooth" RunSettingsRoboTests
Test: Open developer settings
Bug: 257158801
Change-Id: Ib40a6264d8d6908103d76b6401ddcfd3ffa7dd88
This commit is contained in:
William Escande
2022-11-03 12:09:55 -07:00
parent 2552ae08ae
commit 723df89aaa
4 changed files with 78 additions and 22 deletions

View File

@@ -16,9 +16,8 @@
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;
@@ -42,18 +41,15 @@ public class BluetoothMaxConnectedAudioDevicesPreferenceController extends
private int mDefaultMaxConnectedAudioDevices = 0;
private final BluetoothManager mBluetoothManager;
public BluetoothMaxConnectedAudioDevicesPreferenceController(Context context) {
super(context);
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();
}
mBluetoothManager = context.getSystemService(BluetoothManager.class);
mDefaultMaxConnectedAudioDevices =
mBluetoothManager.getAdapter().getMaxConnectedAudioDevices();
}
@Override