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:
Zhen Zhang
2020-01-30 15:12:50 -08:00
parent 0141e6f943
commit d2a7f9ae79
11 changed files with 84 additions and 47 deletions

View File

@@ -16,9 +16,12 @@
package com.android.settings.wifi.tether;
import static com.android.settings.AllInOneTetherSettings.DEDUP_POSTFIX;
import android.content.Context;
import android.content.res.Resources;
import android.net.wifi.SoftApConfiguration;
import android.util.FeatureFlagUtils;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
@@ -26,6 +29,7 @@ import androidx.preference.ListPreference;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.FeatureFlags;
public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferenceController {
@@ -87,7 +91,8 @@ public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferen
@Override
public String getPreferenceKey() {
return PREF_KEY;
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)
? PREF_KEY + DEDUP_POSTFIX : PREF_KEY;
}
@Override

View File

@@ -16,14 +16,18 @@
package com.android.settings.wifi.tether;
import static com.android.settings.AllInOneTetherSettings.DEDUP_POSTFIX;
import android.content.Context;
import android.net.wifi.SoftApConfiguration;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import androidx.preference.EditTextPreference;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.FeatureFlags;
import com.android.settings.widget.ValidatedEditTextPreference;
import com.android.settings.wifi.WifiUtils;
@@ -43,7 +47,8 @@ public class WifiTetherPasswordPreferenceController extends WifiTetherBasePrefer
@Override
public String getPreferenceKey() {
return PREF_KEY;
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)
? PREF_KEY + DEDUP_POSTFIX : PREF_KEY;
}
@Override

View File

@@ -16,16 +16,20 @@
package com.android.settings.wifi.tether;
import static com.android.settings.AllInOneTetherSettings.DEDUP_POSTFIX;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.SoftApConfiguration;
import android.util.FeatureFlagUtils;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.preference.EditTextPreference;
import androidx.preference.Preference;
import com.android.settings.core.FeatureFlags;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.ValidatedEditTextPreference;
import com.android.settings.wifi.dpp.WifiDppUtils;
@@ -54,7 +58,8 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
@Override
public String getPreferenceKey() {
return PREF_KEY;
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)
? PREF_KEY + DEDUP_POSTFIX : PREF_KEY;
}
@Override

View File

@@ -1,12 +1,16 @@
package com.android.settings.wifi.tether;
import static com.android.settings.AllInOneTetherSettings.DEDUP_POSTFIX;
import android.content.Context;
import android.net.wifi.SoftApConfiguration;
import android.util.FeatureFlagUtils;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.FeatureFlags;
public class WifiTetherSecurityPreferenceController extends WifiTetherBasePreferenceController {
@@ -23,7 +27,8 @@ public class WifiTetherSecurityPreferenceController extends WifiTetherBasePrefer
@Override
public String getPreferenceKey() {
return PREF_KEY;
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)
? PREF_KEY + DEDUP_POSTFIX : PREF_KEY;
}
@Override

View File

@@ -28,6 +28,7 @@ import android.net.wifi.SoftApConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.UserManager;
import android.util.FeatureFlagUtils;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
@@ -35,6 +36,7 @@ import androidx.preference.PreferenceGroup;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.core.FeatureFlags;
import com.android.settings.dashboard.RestrictedDashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.widget.SwitchBar;
@@ -259,8 +261,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
@Override
protected boolean isPageSearchEnabled(Context context) {
return !context.getResources().getBoolean(
R.bool.config_show_all_in_one_tether_settings);
return !FeatureFlagUtils.isEnabled(context, FeatureFlags.TETHER_ALL_IN_ONE);
}
@Override