Revert "call getName() from CachedBluetoothDevice, not CachedBluetoothDeviceManager"
This reverts commit 3029efc5f7047596315119bdb1e7056ba26cd071.
Reason for revert:
To fix null pointer crash in Pairing dialog. Dialog maybe triggered by intent, in which LocalBluetoothManager couldn't have instance for BluetoothDevice and will return null. As a result, we need to depend on method in CachedBluetoothManager to handle it.
Bug: 115754654
Bug: 112735753
Change-Id: I1ebf1f1c2829cfb75e6c382df5acf785fe54a185
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingController.java b/src/com/android/settings/bluetooth/BluetoothPairingController.java
index 95c97e2..c39f1d9 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingController.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingController.java
@@ -85,7 +85,7 @@
mType = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.ERROR);
mPasskey = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_KEY, BluetoothDevice.ERROR);
- mDeviceName = mBluetoothManager.getCachedDeviceManager().findDevice(mDevice).getName();
+ mDeviceName = mBluetoothManager.getCachedDeviceManager().getName(mDevice);
mPbapClientProfile = mBluetoothManager.getProfileManager().getPbapClientProfile();
mPasskeyFormatted = formatKey(mPasskey);
}