Grey the previously connected device preference

* Add PreviouslyConnectedDevicePreferenceController to handle the preference should be
  enable or disable.
  Example: If there are no previously connected devices disable the preference otherwise
  enable it.
* Add PreviouslyConnectedDevicePreferenceControllerTest
  1. Verify the callback can be registered and unregistered
  2. Verify the preference is enable when there
     have more than 1 previously connected device
  3. Verify the preference is disable when there
     have no previously connected device

Bug: 78250052
Test: make -j50 RunSettingsRoboTests
Change-Id: I31b5d416aaf907c3bbf1cb61de6e7401463e3df7
Merged-In: I31b5d416aaf907c3bbf1cb61de6e7401463e3df7
This commit is contained in:
hughchen
2018-04-23 15:55:51 +08:00
committed by Hugh Chen
parent 37a6a91444
commit 980b718989
4 changed files with 223 additions and 1 deletions

View File

@@ -46,7 +46,8 @@
android:title="@string/connected_device_previously_connected_title"
android:icon="@drawable/ic_devices_other_black"
android:fragment="com.android.settings.connecteddevice.PreviouslyConnectedDeviceDashboardFragment"
settings:allowDividerAbove="true"/>
settings:allowDividerAbove="true"
settings:controller="com.android.settings.connecteddevice.PreviouslyConnectedDevicePreferenceController"/>
<Preference
android:fragment="com.android.settings.connecteddevice.BluetoothDashboardFragment"