Show just disconnected device on previously connected

- This CL before, previously connected devices will show most
  recently connected devices and the maximum is 3.
  In this time, if next most recently connected device is disconnected.
  It's will not show on "previously connected devices", user needs go to
  "see all" page to found that device.
  This CL add rule to compare the priority of most recently connected
  device. If priority of next disconnected device is higher than
  currnect devices that on "previously connected devices".
  Let next disconnected device show on "previously connected devices".
- Update test case.

Bug: 157653997
Test: make -j42 RunSettingsRoboTests
Change-Id: I684501a20a67755b2196ba9d4b5565add01a5d01
This commit is contained in:
Hugh Chen
2020-08-14 17:56:20 +08:00
parent 59d8ab1094
commit 386df49bbc
3 changed files with 134 additions and 15 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.testutils.shadow;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
@@ -29,6 +30,7 @@ public class ShadowBluetoothAdapter extends org.robolectric.shadows.ShadowBlueto
private int mState;
private List<Integer> mSupportedProfiles = new ArrayList<>();
private List<BluetoothDevice> mMostRecentlyConnectedDevices = new ArrayList<>();
@Implementation
protected List<Integer> getSupportedProfiles() {
@@ -56,4 +58,13 @@ public class ShadowBluetoothAdapter extends org.robolectric.shadows.ShadowBlueto
protected boolean factoryReset() {
return true;
}
@Implementation
protected List<BluetoothDevice> getMostRecentlyConnectedDevices() {
return mMostRecentlyConnectedDevices;
}
public void setMostRecentlyConnectedDevices(List<BluetoothDevice> list) {
mMostRecentlyConnectedDevices = list;
}
}