Add config value to switch between Tether Settings UIs.
Adding this config value to make it easy to switch to developing Tethering settings UI. Also, using this config value to make sure that preferences from new AllInOneTetherSettings screen won't show up in the search results. Bug: 147915366 Test: make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=TetherSettingsTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=TetehrPreferenceControllerTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest Change-Id: I8c88816a8f2b40fc219cae8d0d442454c5270b2b
This commit is contained in:
@@ -434,4 +434,7 @@
|
||||
|
||||
<!-- Package name of dialer supports RTT setting-->
|
||||
<string name="config_rtt_setting_package_name" translatable="false"></string>
|
||||
|
||||
<!--Whether tether settings should be shown in one screen or not-->
|
||||
<bool name="config_show_all_in_one_tether_settings">false</bool>
|
||||
</resources>
|
||||
|
@@ -201,7 +201,7 @@ public final class AllInOneTetherSettings extends RestrictedDashboardFragment
|
||||
// Assume we are in a SettingsActivity. This is only safe because we currently use
|
||||
// SettingsActivity as base for all preference fragments.
|
||||
final SettingsActivity activity = (SettingsActivity) getActivity();
|
||||
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (adapter != null) {
|
||||
adapter.getProfileProxy(activity.getApplicationContext(), mProfileServiceListener,
|
||||
BluetoothProfile.PAN);
|
||||
@@ -404,6 +404,12 @@ public final class AllInOneTetherSettings extends RestrictedDashboardFragment
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return context.getResources().getBoolean(
|
||||
R.bool.config_show_all_in_one_tether_settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
||||
Context context) {
|
||||
|
@@ -450,6 +450,12 @@ public class TetherSettings extends RestrictedSettingsFragment
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return !context.getResources().getBoolean(
|
||||
R.bool.config_show_all_in_one_tether_settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
|
@@ -109,6 +109,10 @@ public class TetherPreferenceController extends AbstractPreferenceController imp
|
||||
|
||||
// Grey out if provisioning is not available.
|
||||
mPreference.setEnabled(!TetherSettings.isProvisioningNeededButUnavailable(mContext));
|
||||
|
||||
if (mContext.getResources().getBoolean(R.bool.config_show_all_in_one_tether_settings)) {
|
||||
mPreference.setFragment("com.android.settings.AllInOneTetherSettings");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -257,6 +257,12 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return !context.getResources().getBoolean(
|
||||
R.bool.config_show_all_in_one_tether_settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
||||
Context context) {
|
||||
|
@@ -69,18 +69,21 @@ public class AllInOneTetherSettingsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getNonIndexableKeys_tetherAvailable_keysNotReturned() {
|
||||
public void getNonIndexableKeys_tetherAvailable_keysReturned() {
|
||||
// To let TetherUtil.isTetherAvailable return true, select one of the combinations
|
||||
setupIsTetherAvailable(true);
|
||||
|
||||
final List<String> niks =
|
||||
AllInOneTetherSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
|
||||
|
||||
assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_NAME);
|
||||
assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_PASSWORD);
|
||||
assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_WIFI_TETHER_AUTO_OFF);
|
||||
assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_AP_BAND);
|
||||
assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_TETHER_PREFS_SCREEN);
|
||||
// TODO(b/147675042) Should revert these assertions, after switching to new UI.
|
||||
// Because of the config check, we are not indexing these keys. Once we enable the config
|
||||
// these assert would also need to change.
|
||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_NAME);
|
||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_PASSWORD);
|
||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_AUTO_OFF);
|
||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_AP_BAND);
|
||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_TETHER_PREFS_SCREEN);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user