Fix settings crash
- This CL before, "Previously connected device" didn't handle dock device. If user have disconnected dock device will cause Settings crash. This CL add condition to handle dock device to avoid crash. - Update test case. Bug: 167054620 Test: make -j42 RunSettingsRoboTests Change-Id: I769cee3f589e14a993b00a0ae6ec3ddfba8ef281
This commit is contained in:
@@ -96,7 +96,6 @@ public final class BluetoothDevicePreference extends GearPreference implements
|
||||
}
|
||||
|
||||
mCachedDevice = cachedDevice;
|
||||
mCachedDevice.registerCallback(this);
|
||||
mCurrentTime = System.currentTimeMillis();
|
||||
mType = type;
|
||||
|
||||
@@ -127,13 +126,24 @@ public final class BluetoothDevicePreference extends GearPreference implements
|
||||
@Override
|
||||
protected void onPrepareForRemoval() {
|
||||
super.onPrepareForRemoval();
|
||||
mCachedDevice.unregisterCallback(this);
|
||||
if (mDisconnectDialog != null) {
|
||||
mDisconnectDialog.dismiss();
|
||||
mDisconnectDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttached() {
|
||||
super.onAttached();
|
||||
mCachedDevice.registerCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetached() {
|
||||
super.onDetached();
|
||||
mCachedDevice.unregisterCallback(this);
|
||||
}
|
||||
|
||||
public CachedBluetoothDevice getBluetoothDevice() {
|
||||
return mCachedDevice;
|
||||
}
|
||||
|
Reference in New Issue
Block a user