Fix pair another dialog doesn't show up after pairing in all bluetooth device page.

Solution: Finish the page immediately to back to previous page when already BONDED the device in
all bluetooth device page.

Bug: 270096758
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ViewAllBluetoothDevicesPreferenceControllerTest
Change-Id: I13a88c3fbe0c6851f9446a9f574a1c18f934cd2e
This commit is contained in:
jasonwshsu
2023-04-05 23:58:33 +08:00
parent d3b3ed5e6d
commit c8a53a9391
5 changed files with 183 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
package com.android.settings.bluetooth;
import static android.app.Activity.RESULT_OK;
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
import android.bluetooth.BluetoothAdapter;
@@ -93,6 +94,7 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) {
if (bondState == BluetoothDevice.BOND_BONDED) {
// If one device is connected(bonded), then close this fragment.
setResult(RESULT_OK);
finish();
return;
} else if (bondState == BluetoothDevice.BOND_BONDING) {
@@ -124,6 +126,7 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
if (cachedDevice != null && cachedDevice.isConnected()) {
final BluetoothDevice device = cachedDevice.getDevice();
if (device != null && mSelectedList.contains(device)) {
setResult(RESULT_OK);
finish();
} else if (mDevicePreferenceMap.containsKey(cachedDevice)) {
onDeviceDeleted(cachedDevice);