[Audiosharing] Fix hysteresis mode
1. Move start broadcast logic from onPlaybackStarted to onBroadcastMetadataChanged 2. Move add source logic from onReceiveStateChanged(BIS>0) to onSourceAdded Test: atest Bug: 355222285 Bug: 377658982 Flag: com.android.settingslib.flags.audio_sharing_hysteresis_mode_fix Change-Id: Ie0a2345e16caa2804fede930d174a67f2ec60259
This commit is contained in:
@@ -116,7 +116,18 @@ public class AudioSharingDevicePreferenceController extends BasePreferenceContro
|
||||
|
||||
@Override
|
||||
public void onSourceAdded(
|
||||
@NonNull BluetoothDevice sink, int sourceId, int reason) {}
|
||||
@NonNull BluetoothDevice sink, int sourceId, int reason) {
|
||||
Log.d(TAG, "onSourceAdded: update sharing device list.");
|
||||
if (mBluetoothDeviceUpdater != null) {
|
||||
mBluetoothDeviceUpdater.forceUpdate();
|
||||
}
|
||||
if (mDeviceManager != null && mDialogHandler != null) {
|
||||
CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(sink);
|
||||
if (cachedDevice != null) {
|
||||
mDialogHandler.closeOpeningDialogsForLeaDevice(cachedDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSourceAddFailed(
|
||||
@@ -173,20 +184,7 @@ public class AudioSharingDevicePreferenceController extends BasePreferenceContro
|
||||
public void onReceiveStateChanged(
|
||||
@NonNull BluetoothDevice sink,
|
||||
int sourceId,
|
||||
@NonNull BluetoothLeBroadcastReceiveState state) {
|
||||
if (BluetoothUtils.isConnected(state)) {
|
||||
Log.d(TAG, "onSourceAdded: update sharing device list.");
|
||||
if (mBluetoothDeviceUpdater != null) {
|
||||
mBluetoothDeviceUpdater.forceUpdate();
|
||||
}
|
||||
if (mDeviceManager != null && mDialogHandler != null) {
|
||||
CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(sink);
|
||||
if (cachedDevice != null) {
|
||||
mDialogHandler.closeOpeningDialogsForLeaDevice(cachedDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@NonNull BluetoothLeBroadcastReceiveState state) {}
|
||||
};
|
||||
|
||||
public AudioSharingDevicePreferenceController(Context context) {
|
||||
|
||||
Reference in New Issue
Block a user