summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
author William Escande <wescande@google.com> 2024-10-07 13:22:45 -0700
committer William Escande <wescande@google.com> 2024-10-07 15:16:06 -0700
commit585fecf2aebf1d583f1f8d785bb486b702491e78 (patch)
tree1c95b291a646690b62bd00229052336f9443620c /service
parent063310508fbefaea6de35dfadca6f464bcd0765a (diff)
GetName/SetName: Broadcast intent from server
Since the server is responsible for having an up to date name, it make sense for it to be the source of the associated intent. Bug: 371656429 Bug: 368114370 Flag: com.android.bluetooth.flags.get_name_and_address_as_callback Test: atest CtsBluetoothTestCases:BluetoothAdapterTest#setName_getName Change-Id: I8cfe2d73d160db86c20bbb4296e004e555671cb1
Diffstat (limited to 'service')
-rw-r--r--service/src/com/android/server/bluetooth/BluetoothManagerService.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/service/src/com/android/server/bluetooth/BluetoothManagerService.java b/service/src/com/android/server/bluetooth/BluetoothManagerService.java
index 6c0f74c635..b59ab9de45 100644
--- a/service/src/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/src/com/android/server/bluetooth/BluetoothManagerService.java
@@ -16,6 +16,7 @@
package com.android.server.bluetooth;
+import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.bluetooth.BluetoothAdapter.STATE_BLE_ON;
import static android.bluetooth.BluetoothAdapter.STATE_BLE_TURNING_OFF;
import static android.bluetooth.BluetoothAdapter.STATE_BLE_TURNING_ON;
@@ -254,6 +255,13 @@ class BluetoothManagerService {
}
mName = name;
Log.v(TAG, "storeName(" + mName + "): Success");
+ mContext.sendBroadcastAsUser(
+ new Intent(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED)
+ .putExtra(BluetoothAdapter.EXTRA_LOCAL_NAME, name)
+ .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT),
+ UserHandle.ALL,
+ BLUETOOTH_CONNECT,
+ getTempAllowlistBroadcastOptions());
}
private void storeAddress(String address) {