Use feature flag to show/hide AllInOneTetherSettings
This partially reverts commit 0ccc849de7
which added a config value. Instead, we will use feature flag to switch
between the fragments.
This CL also adds a postfix to keys in all_tether_prefs to
de-duplicate with keys in tether_prefs and wifi_tether_settings.
Bug: 148182953
Change-Id: I92832c786473990065a965409072e4117a7e75a8
Fix: 148618984
Test: make RunSettingsRoboTests
Test: make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest
This commit is contained in:
@@ -434,7 +434,4 @@
|
|||||||
|
|
||||||
<!-- Package name of dialer supports RTT setting-->
|
<!-- Package name of dialer supports RTT setting-->
|
||||||
<string name="config_rtt_setting_package_name" translatable="false"></string>
|
<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>
|
</resources>
|
||||||
|
@@ -18,48 +18,50 @@
|
|||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:key="tether_prefs_screen"
|
android:key="all_tether_prefs_screen"
|
||||||
android:title="@string/tether_settings_title_all">
|
android:title="@string/tether_settings_title_all"
|
||||||
|
settings:searchable="false">
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="wifi_tether_settings_group"
|
android:key="wifi_tether_settings_group"
|
||||||
android:title="@string/wifi_hotspot_checkbox_text"
|
android:title="@string/wifi_hotspot_checkbox_text"
|
||||||
settings:searchable="false">
|
settings:searchable="false">
|
||||||
<com.android.settings.wifi.tether.WifiTetherSsidPreference
|
<com.android.settings.wifi.tether.WifiTetherSsidPreference
|
||||||
android:key="wifi_tether_network_name"
|
android:key="wifi_tether_network_name_2"
|
||||||
android:title="@string/wifi_hotspot_name_title"
|
android:title="@string/wifi_hotspot_name_title"
|
||||||
android:summary="@string/summary_placeholder"/>
|
android:summary="@string/summary_placeholder"/>
|
||||||
|
|
||||||
<com.android.settings.widget.ValidatedEditTextPreference
|
<com.android.settings.widget.ValidatedEditTextPreference
|
||||||
android:key="wifi_tether_network_password"
|
android:key="wifi_tether_network_password_2"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/wifi_hotspot_password_title"/>
|
android:title="@string/wifi_hotspot_password_title"/>
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="wifi_tether_auto_turn_off"
|
android:key="wifi_tether_auto_turn_off_2"
|
||||||
android:title="@string/wifi_hotspot_auto_off_title"
|
android:title="@string/wifi_hotspot_auto_off_title"
|
||||||
android:summary="@string/wifi_hotspot_auto_off_summary"/>
|
android:summary="@string/wifi_hotspot_auto_off_summary"/>
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="wifi_tether_security"
|
android:key="wifi_tether_security_2"
|
||||||
android:title="@string/wifi_security"
|
android:title="@string/wifi_security"
|
||||||
android:summary="@string/summary_placeholder"
|
android:summary="@string/summary_placeholder"
|
||||||
android:entries="@array/wifi_tether_security"
|
android:entries="@array/wifi_tether_security"
|
||||||
android:entryValues="@array/wifi_tether_security_values"/>
|
android:entryValues="@array/wifi_tether_security_values"/>
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="wifi_tether_network_ap_band"
|
android:key="wifi_tether_network_ap_band_2"
|
||||||
android:title="@string/wifi_hotspot_ap_band_title"/>
|
android:title="@string/wifi_hotspot_ap_band_title"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="disabled_on_data_saver"
|
android:key="disabled_on_data_saver_2"
|
||||||
android:summary="@string/tether_settings_disabled_on_data_saver"
|
android:summary="@string/tether_settings_disabled_on_data_saver"
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
|
settings:searchable="false"
|
||||||
settings:allowDividerAbove="true" />
|
settings:allowDividerAbove="true" />
|
||||||
|
|
||||||
<com.android.settingslib.widget.FooterPreference
|
<com.android.settingslib.widget.FooterPreference
|
||||||
android:key="tether_prefs_footer"
|
android:key="tether_prefs_footer_2"
|
||||||
android:title="@string/tethering_footer_info"
|
android:title="@string/tethering_footer_info"
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
settings:searchable="false"/>
|
settings:searchable="false"/>
|
||||||
|
@@ -36,12 +36,14 @@ import android.net.wifi.WifiManager;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceGroup;
|
import androidx.preference.PreferenceGroup;
|
||||||
|
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
||||||
import com.android.settings.datausage.DataSaverBackend;
|
import com.android.settings.datausage.DataSaverBackend;
|
||||||
import com.android.settings.network.TetherEnabler;
|
import com.android.settings.network.TetherEnabler;
|
||||||
@@ -72,19 +74,24 @@ public final class AllInOneTetherSettings extends RestrictedDashboardFragment
|
|||||||
WifiTetherBasePreferenceController.OnTetherConfigUpdateListener,
|
WifiTetherBasePreferenceController.OnTetherConfigUpdateListener,
|
||||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
@VisibleForTesting
|
// TODO(b/148622133): Should clean up the postfix once this fragment replaced TetherSettings.
|
||||||
static final String KEY_TETHER_PREFS_SCREEN = "tether_prefs_screen";
|
public static final String DEDUP_POSTFIX = "_2";
|
||||||
@VisibleForTesting
|
|
||||||
static final String KEY_WIFI_TETHER_NETWORK_NAME = "wifi_tether_network_name";
|
|
||||||
@VisibleForTesting
|
|
||||||
static final String KEY_WIFI_TETHER_NETWORK_PASSWORD = "wifi_tether_network_password";
|
|
||||||
@VisibleForTesting
|
|
||||||
static final String KEY_WIFI_TETHER_AUTO_OFF = "wifi_tether_auto_turn_off";
|
|
||||||
@VisibleForTesting
|
|
||||||
static final String KEY_WIFI_TETHER_NETWORK_AP_BAND = "wifi_tether_network_ap_band";
|
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
static final String KEY_WIFI_TETHER_NETWORK_NAME = "wifi_tether_network_name" + DEDUP_POSTFIX;
|
||||||
|
@VisibleForTesting
|
||||||
|
static final String KEY_WIFI_TETHER_NETWORK_PASSWORD =
|
||||||
|
"wifi_tether_network_password" + DEDUP_POSTFIX;
|
||||||
|
@VisibleForTesting
|
||||||
|
static final String KEY_WIFI_TETHER_AUTO_OFF = "wifi_tether_auto_turn_off" + DEDUP_POSTFIX;
|
||||||
|
@VisibleForTesting
|
||||||
|
static final String KEY_WIFI_TETHER_NETWORK_AP_BAND =
|
||||||
|
"wifi_tether_network_ap_band" + DEDUP_POSTFIX;
|
||||||
|
@VisibleForTesting
|
||||||
|
static final String KEY_WIFI_TETHER_SECURITY = "wifi_tether_security" + DEDUP_POSTFIX;
|
||||||
|
|
||||||
|
private static final String KEY_DATA_SAVER_FOOTER = "disabled_on_data_saver" + DEDUP_POSTFIX;
|
||||||
private static final String KEY_WIFI_TETHER_GROUP = "wifi_tether_settings_group";
|
private static final String KEY_WIFI_TETHER_GROUP = "wifi_tether_settings_group";
|
||||||
private static final String KEY_DATA_SAVER_FOOTER = "disabled_on_data_saver";
|
|
||||||
private static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 2;
|
private static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 2;
|
||||||
private static final int EXPANDED_CHILD_COUNT_DEFAULT = 3;
|
private static final int EXPANDED_CHILD_COUNT_DEFAULT = 3;
|
||||||
private static final String TAG = "AllInOneTetherSettings";
|
private static final String TAG = "AllInOneTetherSettings";
|
||||||
@@ -394,20 +401,18 @@ public final class AllInOneTetherSettings extends RestrictedDashboardFragment
|
|||||||
final List<String> keys = super.getNonIndexableKeys(context);
|
final List<String> keys = super.getNonIndexableKeys(context);
|
||||||
|
|
||||||
if (!TetherUtil.isTetherAvailable(context)) {
|
if (!TetherUtil.isTetherAvailable(context)) {
|
||||||
keys.add(KEY_TETHER_PREFS_SCREEN);
|
|
||||||
keys.add(KEY_WIFI_TETHER_NETWORK_NAME);
|
keys.add(KEY_WIFI_TETHER_NETWORK_NAME);
|
||||||
keys.add(KEY_WIFI_TETHER_NETWORK_PASSWORD);
|
keys.add(KEY_WIFI_TETHER_NETWORK_PASSWORD);
|
||||||
keys.add(KEY_WIFI_TETHER_AUTO_OFF);
|
keys.add(KEY_WIFI_TETHER_AUTO_OFF);
|
||||||
keys.add(KEY_WIFI_TETHER_NETWORK_AP_BAND);
|
keys.add(KEY_WIFI_TETHER_NETWORK_AP_BAND);
|
||||||
|
keys.add(KEY_WIFI_TETHER_SECURITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isPageSearchEnabled(Context context) {
|
protected boolean isPageSearchEnabled(Context context) {
|
||||||
return context.getResources().getBoolean(
|
return FeatureFlagUtils.isEnabled(context, FeatureFlags.TETHER_ALL_IN_ONE);
|
||||||
R.bool.config_show_all_in_one_tether_settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -36,11 +36,13 @@ import android.os.Environment;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.SearchIndexableResource;
|
import android.provider.SearchIndexableResource;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.datausage.DataSaverBackend;
|
import com.android.settings.datausage.DataSaverBackend;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.wifi.tether.WifiTetherPreferenceController;
|
import com.android.settings.wifi.tether.WifiTetherPreferenceController;
|
||||||
@@ -452,8 +454,7 @@ public class TetherSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isPageSearchEnabled(Context context) {
|
protected boolean isPageSearchEnabled(Context context) {
|
||||||
return !context.getResources().getBoolean(
|
return !FeatureFlagUtils.isEnabled(context, FeatureFlags.TETHER_ALL_IN_ONE);
|
||||||
R.bool.config_show_all_in_one_tether_settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -33,13 +33,16 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
|
import com.android.settings.AllInOneTetherSettings;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.TetherSettings;
|
import com.android.settings.TetherSettings;
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.TetherUtil;
|
import com.android.settingslib.TetherUtil;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
@@ -110,8 +113,8 @@ public class TetherPreferenceController extends AbstractPreferenceController imp
|
|||||||
// Grey out if provisioning is not available.
|
// Grey out if provisioning is not available.
|
||||||
mPreference.setEnabled(!TetherSettings.isProvisioningNeededButUnavailable(mContext));
|
mPreference.setEnabled(!TetherSettings.isProvisioningNeededButUnavailable(mContext));
|
||||||
|
|
||||||
if (mContext.getResources().getBoolean(R.bool.config_show_all_in_one_tether_settings)) {
|
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)) {
|
||||||
mPreference.setFragment("com.android.settings.AllInOneTetherSettings");
|
mPreference.setFragment(AllInOneTetherSettings.class.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,12 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.tether;
|
package com.android.settings.wifi.tether;
|
||||||
|
|
||||||
|
import static com.android.settings.AllInOneTetherSettings.DEDUP_POSTFIX;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.wifi.SoftApConfiguration;
|
import android.net.wifi.SoftApConfiguration;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
@@ -26,6 +29,7 @@ import androidx.preference.ListPreference;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
|
|
||||||
public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferenceController {
|
public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferenceController {
|
||||||
|
|
||||||
@@ -87,7 +91,8 @@ public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return PREF_KEY;
|
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)
|
||||||
|
? PREF_KEY + DEDUP_POSTFIX : PREF_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -16,14 +16,18 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.tether;
|
package com.android.settings.wifi.tether;
|
||||||
|
|
||||||
|
import static com.android.settings.AllInOneTetherSettings.DEDUP_POSTFIX;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.wifi.SoftApConfiguration;
|
import android.net.wifi.SoftApConfiguration;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
import androidx.preference.EditTextPreference;
|
import androidx.preference.EditTextPreference;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.widget.ValidatedEditTextPreference;
|
import com.android.settings.widget.ValidatedEditTextPreference;
|
||||||
import com.android.settings.wifi.WifiUtils;
|
import com.android.settings.wifi.WifiUtils;
|
||||||
|
|
||||||
@@ -43,7 +47,8 @@ public class WifiTetherPasswordPreferenceController extends WifiTetherBasePrefer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return PREF_KEY;
|
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)
|
||||||
|
? PREF_KEY + DEDUP_POSTFIX : PREF_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -16,16 +16,20 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.tether;
|
package com.android.settings.wifi.tether;
|
||||||
|
|
||||||
|
import static com.android.settings.AllInOneTetherSettings.DEDUP_POSTFIX;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.wifi.SoftApConfiguration;
|
import android.net.wifi.SoftApConfiguration;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.EditTextPreference;
|
import androidx.preference.EditTextPreference;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.widget.ValidatedEditTextPreference;
|
import com.android.settings.widget.ValidatedEditTextPreference;
|
||||||
import com.android.settings.wifi.dpp.WifiDppUtils;
|
import com.android.settings.wifi.dpp.WifiDppUtils;
|
||||||
@@ -54,7 +58,8 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return PREF_KEY;
|
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)
|
||||||
|
? PREF_KEY + DEDUP_POSTFIX : PREF_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,12 +1,16 @@
|
|||||||
package com.android.settings.wifi.tether;
|
package com.android.settings.wifi.tether;
|
||||||
|
|
||||||
|
import static com.android.settings.AllInOneTetherSettings.DEDUP_POSTFIX;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.wifi.SoftApConfiguration;
|
import android.net.wifi.SoftApConfiguration;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
import androidx.preference.ListPreference;
|
import androidx.preference.ListPreference;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
|
|
||||||
public class WifiTetherSecurityPreferenceController extends WifiTetherBasePreferenceController {
|
public class WifiTetherSecurityPreferenceController extends WifiTetherBasePreferenceController {
|
||||||
|
|
||||||
@@ -23,7 +27,8 @@ public class WifiTetherSecurityPreferenceController extends WifiTetherBasePrefer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return PREF_KEY;
|
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)
|
||||||
|
? PREF_KEY + DEDUP_POSTFIX : PREF_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -28,6 +28,7 @@ import android.net.wifi.SoftApConfiguration;
|
|||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
@@ -35,6 +36,7 @@ import androidx.preference.PreferenceGroup;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.widget.SwitchBar;
|
import com.android.settings.widget.SwitchBar;
|
||||||
@@ -259,8 +261,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isPageSearchEnabled(Context context) {
|
protected boolean isPageSearchEnabled(Context context) {
|
||||||
return !context.getResources().getBoolean(
|
return !FeatureFlagUtils.isEnabled(context, FeatureFlags.TETHER_ALL_IN_ONE);
|
||||||
R.bool.config_show_all_in_one_tether_settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -26,7 +26,9 @@ import android.content.Context;
|
|||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.testutils.shadow.ShadowWifiManager;
|
import com.android.settings.testutils.shadow.ShadowWifiManager;
|
||||||
import com.android.settings.wifi.tether.WifiTetherAutoOffPreferenceController;
|
import com.android.settings.wifi.tether.WifiTetherAutoOffPreferenceController;
|
||||||
|
|
||||||
@@ -69,21 +71,27 @@ public class AllInOneTetherSettingsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getNonIndexableKeys_tetherAvailable_keysReturned() {
|
public void getNonIndexableKeys_tetherAvailable_keysNotReturned() {
|
||||||
// To let TetherUtil.isTetherAvailable return true, select one of the combinations
|
// To let TetherUtil.isTetherAvailable return true, select one of the combinations
|
||||||
setupIsTetherAvailable(true);
|
setupIsTetherAvailable(true);
|
||||||
|
|
||||||
final List<String> niks =
|
final List<String> niks =
|
||||||
AllInOneTetherSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
|
AllInOneTetherSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
|
||||||
|
|
||||||
// TODO(b/147675042) Should revert these assertions, after switching to new UI.
|
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)) {
|
||||||
// Because of the config check, we are not indexing these keys. Once we enable the config
|
assertThat(niks).doesNotContain(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_NAME);
|
||||||
// these assert would also need to change.
|
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_WIFI_TETHER_SECURITY);
|
||||||
|
} else {
|
||||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_NAME);
|
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_NETWORK_PASSWORD);
|
||||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_AUTO_OFF);
|
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_AUTO_OFF);
|
||||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_AP_BAND);
|
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_AP_BAND);
|
||||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_TETHER_PREFS_SCREEN);
|
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_SECURITY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -98,7 +106,7 @@ public class AllInOneTetherSettingsTest {
|
|||||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_PASSWORD);
|
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_AUTO_OFF);
|
||||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_AP_BAND);
|
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_NETWORK_AP_BAND);
|
||||||
assertThat(niks).contains(AllInOneTetherSettings.KEY_TETHER_PREFS_SCREEN);
|
assertThat(niks).contains(AllInOneTetherSettings.KEY_WIFI_TETHER_SECURITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user