[Audiosharing] Set earlist connected device active in sharing.

Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: I8e0132f3d982fe2723581cd2aafd3cb9a9ed409c
This commit is contained in:
Yiyi Shen
2023-11-23 15:40:50 +08:00
parent 2dfae393c4
commit b82f290fce
3 changed files with 36 additions and 3 deletions

View File

@@ -160,6 +160,7 @@ public class AudioSharingDevicePreferenceController extends BasePreferenceContro
+ ", reason = "
+ reason);
mBluetoothDeviceUpdater.forceUpdate();
AudioSharingUtils.updateActiveDeviceIfNeeded(mLocalBtManager);
}
@Override
@@ -204,6 +205,7 @@ public class AudioSharingDevicePreferenceController extends BasePreferenceContro
+ ", reason = "
+ reason);
mBluetoothDeviceUpdater.forceUpdate();
AudioSharingUtils.updateActiveDeviceIfNeeded(mLocalBtManager);
}
@Override
@@ -299,7 +301,7 @@ public class AudioSharingDevicePreferenceController extends BasePreferenceContro
mPreferenceGroup.setVisible(false);
mAudioSharingSettingsPreference.setVisible(false);
if (isAvailable() && mBluetoothDeviceUpdater != null) {
if (isAvailable()) {
mBluetoothDeviceUpdater.setPrefContext(screen.getContext());
mBluetoothDeviceUpdater.forceUpdate();
}
@@ -309,6 +311,7 @@ public class AudioSharingDevicePreferenceController extends BasePreferenceContro
public int getAvailabilityStatus() {
return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)
&& Flags.enableLeAudioSharing()
&& mBluetoothDeviceUpdater != null
? AVAILABLE_UNSEARCHABLE
: UNSUPPORTED_ON_DEVICE;
}