Skip to content

Commit ee4837b

Browse files
author
Jaikumar Ganesh
committed
Add Register before boot flag.
In some instances, the device might connect before we have booted up. Change-Id: I1a50585207a2b0b2339acb048dffaea84e1a91e9
1 parent c924fbd commit ee4837b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/java/android/server/BluetoothEventLoop.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ private void onDevicePropertyChanged(String deviceObjectPath, String[] propValue
401401
Intent intent = new Intent(BluetoothDevice.ACTION_NAME_CHANGED);
402402
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
403403
intent.putExtra(BluetoothDevice.EXTRA_NAME, propValues[1]);
404+
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
404405
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
405406
} else if (name.equals("Alias")) {
406407
mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]);
@@ -410,6 +411,7 @@ private void onDevicePropertyChanged(String deviceObjectPath, String[] propValue
410411
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
411412
intent.putExtra(BluetoothDevice.EXTRA_CLASS,
412413
new BluetoothClass(Integer.valueOf(propValues[1])));
414+
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
413415
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
414416
} else if (name.equals("Connected")) {
415417
mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]);
@@ -425,6 +427,7 @@ private void onDevicePropertyChanged(String deviceObjectPath, String[] propValue
425427
intent = new Intent(BluetoothDevice.ACTION_ACL_DISCONNECTED);
426428
}
427429
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
430+
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
428431
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
429432
} else if (name.equals("UUIDs")) {
430433
String uuid = null;

0 commit comments

Comments
 (0)