Fix NPE in bluetooth Permission Activity
This fixes a NPE by ensuring that cached device list has a cached device associated with a given BDA before accessing the cached device Bug:5964529 Change-Id: Ib2c3596e6e008c78f9f1137134e421ca710e1217
This commit is contained in:
committed by
Matthew Xie
parent
6665ee3210
commit
40b77fe04b
9
src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
Normal file → Executable file
9
src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
Normal file → Executable file
@@ -251,6 +251,13 @@ public class BluetoothPermissionActivity extends AlertActivity implements
|
||||
CachedBluetoothDeviceManager cachedDeviceManager =
|
||||
bluetoothManager.getCachedDeviceManager();
|
||||
CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(mDevice);
|
||||
cachedDevice.setPhonebookPermissionChoice(permissionChoice);
|
||||
if (cachedDevice != null ) {
|
||||
cachedDevice.setPhonebookPermissionChoice(permissionChoice);
|
||||
} else {
|
||||
cachedDevice = cachedDeviceManager.addDevice(bluetoothManager.getBluetoothAdapter(),
|
||||
bluetoothManager.getProfileManager(),
|
||||
mDevice);
|
||||
cachedDevice.setPhonebookPermissionChoice(permissionChoice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user