Move BT, NFC out of Conntection pref

Move BT, NFC preference out of Connection Preference,
To Connected devices page.
Because NFC and Android Beam are controlled by the same controller,
Create each controller for those preference and leave the sharing part.

Change-Id: I8bc303a5f487de9c667487119b49e1e4130aa80c
Fixes: 72458929
Test: manually test, make RunSettingsRoboTests
This commit is contained in:
HJ ChangLiao
2018-03-21 16:01:31 +08:00
parent 0a5367c0c4
commit b247311b2a
14 changed files with 718 additions and 262 deletions

View File

@@ -16,13 +16,10 @@
package com.android.settings.connecteddevice;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
;
import android.provider.SearchIndexableResource;
import com.android.settings.bluetooth.BluetoothMasterSwitchPreferenceController;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.XmlTestUtils;
import com.android.settings.testutils.shadow.ShadowBluetoothPan;
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
import com.android.settings.testutils.shadow.ShadowUserManager;
@@ -59,8 +56,8 @@ public class AdvancedConnectedDeviceDashboardFragmentTest {
@Test
public void testSearchIndexProvider_shouldIndexResource() {
final List<SearchIndexableResource> indexRes =
AdvancedConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
.getXmlResourcesToIndex(RuntimeEnvironment.application, true /* enabled */);
AdvancedConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
.getXmlResourcesToIndex(RuntimeEnvironment.application, true /* enabled */);
assertThat(indexRes).isNotNull();
assertThat(indexRes.get(0).xmlResId).isEqualTo(mFragment.getPreferenceScreenResId());
@@ -70,14 +67,4 @@ public class AdvancedConnectedDeviceDashboardFragmentTest {
public void testGetCategoryKey_returnCategoryDevice() {
assertThat(mFragment.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_DEVICE);
}
@Test
public void testNonIndexableKeys_existInXmlLayout() {
final Context context = RuntimeEnvironment.application;
final List<String> niks =
AdvancedConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
.getNonIndexableKeys(context);
assertThat(niks).contains(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);
}
}
}

View File

@@ -30,6 +30,7 @@ import android.content.pm.PackageManager;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
import com.android.settings.nfc.NfcPreferenceController;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.ShadowBluetoothPan;
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
@@ -77,6 +78,7 @@ public class ConnectedDeviceDashboardFragmentTest {
final List<String> niks = ConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
.getNonIndexableKeys(mContext);
assertThat(niks).containsExactly(KEY_CONNECTED_DEVICES, KEY_SAVED_DEVICES);
assertThat(niks).containsExactly(KEY_CONNECTED_DEVICES, KEY_SAVED_DEVICES,
NfcPreferenceController.KEY_TOGGLE_NFC);
}
}