summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author chelseahao <chelseahao@google.com> 2024-12-17 12:34:34 +0800
committer chelseahao <chelseahao@google.com> 2024-12-17 12:34:34 +0800
commit91a51c62dccc5393badfed7a86c7de4c524a36bb (patch)
tree7ac15de0199d92816f1ee06a8de9ac2d72679a63
parent6ee3b28ed550d2c94015c377c29c4b57ed4db5cb (diff)
Allow `notifyBroadcastStateChange` from sysui, also moved the triggering to `onBroadcastStarted`.
Test: atest Bug: 384405138 Flag: com.android.settingslib.flags.enable_le_audio_sharing Change-Id: Icce525325a08739f7dad841040524bbfe3428417
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcast.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcast.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcast.java
index b52ed42d567f..2c99a2d4818c 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcast.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothLeBroadcast.java
@@ -101,6 +101,7 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
public @interface BroadcastState {}
private static final String SETTINGS_PKG = "com.android.settings";
+ private static final String SYSUI_PKG = "com.android.systemui";
private static final String TAG = "LocalBluetoothLeBroadcast";
private static final boolean DEBUG = BluetoothUtils.D;
@@ -216,6 +217,7 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
}
setLatestBroadcastId(broadcastId);
setAppSourceName(mNewAppSourceName, /* updateContentResolver= */ true);
+ notifyBroadcastStateChange(BROADCAST_STATE_ON);
}
@Override
@@ -232,7 +234,6 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
Log.d(TAG, "onBroadcastMetadataChanged(), broadcastId = " + broadcastId);
}
setLatestBluetoothLeBroadcastMetadata(metadata);
- notifyBroadcastStateChange(BROADCAST_STATE_ON);
}
@Override
@@ -1247,8 +1248,9 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
}
private void notifyBroadcastStateChange(@BroadcastState int state) {
- if (!mContext.getPackageName().equals(SETTINGS_PKG)) {
- Log.d(TAG, "Skip notifyBroadcastStateChange, not triggered by Settings.");
+ String packageName = mContext.getPackageName();
+ if (!packageName.equals(SETTINGS_PKG) && !packageName.equals(SYSUI_PKG)) {
+ Log.d(TAG, "Skip notifyBroadcastStateChange, not triggered by Settings or SystemUI.");
return;
}
if (isWorkProfile(mContext)) {
@@ -1257,8 +1259,8 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
}
Intent intent = new Intent(ACTION_LE_AUDIO_SHARING_STATE_CHANGE);
intent.putExtra(EXTRA_LE_AUDIO_SHARING_STATE, state);
- intent.setPackage(mContext.getPackageName());
- Log.d(TAG, "notifyBroadcastStateChange for state = " + state);
+ intent.setPackage(SETTINGS_PKG);
+ Log.d(TAG, "notifyBroadcastStateChange for state = " + state + " by pkg = " + packageName);
mContext.sendBroadcast(intent);
}