Finish bluetooth detail fragment if device is BOND_NONE
This CL is used to check the bluetooth bond state when fragment is onResume. The bluetooth detail fragment will finish if the bluetooth bond state is BOND_NONE when fragment is onResume. Bug: 146621601 Test: make -j42 RunSettingsRoboTests Change-Id: I157e1da925dcf527ce2b49ad431079d90b7c4fc3
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import static android.bluetooth.BluetoothDevice.BOND_NONE;
|
||||
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
@@ -127,6 +128,20 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment
|
||||
: null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
finishFragmentIfNecessary();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void finishFragmentIfNecessary() {
|
||||
if (mCachedDevice.getBondState() == BOND_NONE) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.BLUETOOTH_DEVICE_DETAILS;
|
||||
|
Reference in New Issue
Block a user