OSDN Git Service

need to send BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED intent to all users
authorZhihai Xu <zhihaixu@google.com>
Mon, 12 Nov 2012 23:28:58 +0000 (15:28 -0800)
committerZhihai Xu <zhihaixu@google.com>
Mon, 12 Nov 2012 23:28:58 +0000 (15:28 -0800)
We need to send BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED intent to all users
because bluetooth manager service use this intent to change name.
Bluetooth manager service is always running as User 0. but it is always binding
to bluetooth service running at foreground user, So the bluetooth service
need send BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED broadcast intent
to all users to let bluetooth manager service to receive it at any cases.

bug 7476965

Change-Id: I816786d0828d4a7d414077b1ccbe12d2e273fc75

src/com/android/bluetooth/btservice/AdapterProperties.java

index 73e795e..0c00ffd 100755 (executable)
@@ -445,7 +445,8 @@ class AdapterProperties {
                         intent = new Intent(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED);
                         intent.putExtra(BluetoothAdapter.EXTRA_LOCAL_NAME, mName);
                         intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
-                        mService.sendBroadcast(intent, mService.BLUETOOTH_PERM);
+                        mService.sendBroadcastAsUser(intent, UserHandle.ALL,
+                                 mService.BLUETOOTH_PERM);
                         debugLog("Name is: " + mName);
                         break;
                     case AbstractionLayer.BT_PROPERTY_BDADDR: