Get adapter name and address on boot

Bug: 25836009
Change-Id: I6fe68b116fcd736cd5736be68c97af3052351b33
This commit is contained in:
Ajay Panicker
2016-03-11 13:47:20 -08:00
committed by Andre Eisenbach
parent 1c0c14febf
commit bf796d8777

View File

@@ -761,6 +761,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
if (mEnableExternal && isBluetoothPersistedStateOnBluetooth()) {
if (DBG) Slog.d(TAG, "Auto-enabling Bluetooth.");
sendEnableMsg(mQuietEnableExternal);
} else if (!isNameAndAddressSet()) {
if (DBG) Slog.d(TAG, "Getting adapter name and address");
enable();
waitForOnOff(true, false);
disable(true);
}
}
@@ -1001,6 +1006,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
}
}
}
// mAddress is accessed from outside.
// It is alright without a lock. Here, bluetooth is off, no other thread is
// changing mAddress
@@ -1181,6 +1187,15 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
Slog.e(TAG,"Unable to call configHciSnoopLog", e);
}
if (!isNameAndAddressSet()) {
try {
storeNameAndAddress(mBluetooth.getName(),
mBluetooth.getAddress());
} catch (RemoteException re) {
Slog.e(TAG, "Unable to grab names", re);
}
}
//Register callback object
try {
mBluetooth.registerCallback(mBluetoothCallback);