Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6068d127 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use feature flag to show/hide AllInOneTetherSettings"

parents 36c3446b d2a7f9ae
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -434,7 +434,4 @@

    <!-- 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>
+11 −9
Original line number Diff line number Diff line
@@ -18,48 +18,50 @@
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:key="tether_prefs_screen"
    android:title="@string/tether_settings_title_all">
    android:key="all_tether_prefs_screen"
    android:title="@string/tether_settings_title_all"
    settings:searchable="false">

    <PreferenceCategory
        android:key="wifi_tether_settings_group"
        android:title="@string/wifi_hotspot_checkbox_text"
        settings:searchable="false">
        <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:summary="@string/summary_placeholder"/>

        <com.android.settings.widget.ValidatedEditTextPreference
            android:key="wifi_tether_network_password"
            android:key="wifi_tether_network_password_2"
            android:persistent="false"
            android:title="@string/wifi_hotspot_password_title"/>

        <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:summary="@string/wifi_hotspot_auto_off_summary"/>

        <ListPreference
            android:key="wifi_tether_security"
            android:key="wifi_tether_security_2"
            android:title="@string/wifi_security"
            android:summary="@string/summary_placeholder"
            android:entries="@array/wifi_tether_security"
            android:entryValues="@array/wifi_tether_security_values"/>

        <ListPreference
            android:key="wifi_tether_network_ap_band"
            android:key="wifi_tether_network_ap_band_2"
            android:title="@string/wifi_hotspot_ap_band_title"/>
    </PreferenceCategory>

    <Preference
        android:key="disabled_on_data_saver"
        android:key="disabled_on_data_saver_2"
        android:summary="@string/tether_settings_disabled_on_data_saver"
        android:selectable="false"
        settings:searchable="false"
        settings:allowDividerAbove="true" />

    <com.android.settingslib.widget.FooterPreference
        android:key="tether_prefs_footer"
        android:key="tether_prefs_footer_2"
        android:title="@string/tethering_footer_info"
        android:selectable="false"
        settings:searchable="false"/>
+15 −10
Original line number Diff line number Diff line
@@ -36,12 +36,14 @@ import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.UserManager;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.util.Log;

import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceGroup;

import com.android.settings.core.FeatureFlags;
import com.android.settings.dashboard.RestrictedDashboardFragment;
import com.android.settings.datausage.DataSaverBackend;
import com.android.settings.network.TetherEnabler;
@@ -72,19 +74,24 @@ public final class AllInOneTetherSettings extends RestrictedDashboardFragment
        WifiTetherBasePreferenceController.OnTetherConfigUpdateListener,
        SharedPreferences.OnSharedPreferenceChangeListener {

    // TODO(b/148622133): Should clean up the postfix once this fragment replaced TetherSettings.
    public static final String DEDUP_POSTFIX = "_2";

    @VisibleForTesting
    static final String KEY_TETHER_PREFS_SCREEN = "tether_prefs_screen";
    static final String KEY_WIFI_TETHER_NETWORK_NAME = "wifi_tether_network_name" + DEDUP_POSTFIX;
    @VisibleForTesting
    static final String KEY_WIFI_TETHER_NETWORK_NAME = "wifi_tether_network_name";
    static final String KEY_WIFI_TETHER_NETWORK_PASSWORD =
            "wifi_tether_network_password" + DEDUP_POSTFIX;
    @VisibleForTesting
    static final String KEY_WIFI_TETHER_NETWORK_PASSWORD = "wifi_tether_network_password";
    static final String KEY_WIFI_TETHER_AUTO_OFF = "wifi_tether_auto_turn_off" + DEDUP_POSTFIX;
    @VisibleForTesting
    static final String KEY_WIFI_TETHER_AUTO_OFF = "wifi_tether_auto_turn_off";
    static final String KEY_WIFI_TETHER_NETWORK_AP_BAND =
            "wifi_tether_network_ap_band" + DEDUP_POSTFIX;
    @VisibleForTesting
    static final String KEY_WIFI_TETHER_NETWORK_AP_BAND = "wifi_tether_network_ap_band";
    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_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_DEFAULT = 3;
    private static final String TAG = "AllInOneTetherSettings";
@@ -394,20 +401,18 @@ public final class AllInOneTetherSettings extends RestrictedDashboardFragment
                    final List<String> keys = super.getNonIndexableKeys(context);

                    if (!TetherUtil.isTetherAvailable(context)) {
                        keys.add(KEY_TETHER_PREFS_SCREEN);
                        keys.add(KEY_WIFI_TETHER_NETWORK_NAME);
                        keys.add(KEY_WIFI_TETHER_NETWORK_PASSWORD);
                        keys.add(KEY_WIFI_TETHER_AUTO_OFF);
                        keys.add(KEY_WIFI_TETHER_NETWORK_AP_BAND);
                        keys.add(KEY_WIFI_TETHER_SECURITY);
                    }

                    return keys;
                }

                @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
+3 −2
Original line number Diff line number Diff line
@@ -36,11 +36,13 @@ import android.os.Environment;
import android.os.Handler;
import android.os.UserManager;
import android.provider.SearchIndexableResource;
import android.util.FeatureFlagUtils;

import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.SwitchPreference;

import com.android.settings.core.FeatureFlags;
import com.android.settings.datausage.DataSaverBackend;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.wifi.tether.WifiTetherPreferenceController;
@@ -452,8 +454,7 @@ public class TetherSettings extends RestrictedSettingsFragment

                @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
+5 −2
Original line number Diff line number Diff line
@@ -33,13 +33,16 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.FeatureFlagUtils;

import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

import com.android.settings.AllInOneTetherSettings;
import com.android.settings.R;
import com.android.settings.TetherSettings;
import com.android.settings.core.FeatureFlags;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.TetherUtil;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -110,8 +113,8 @@ 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");
            if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE)) {
                mPreference.setFragment(AllInOneTetherSettings.class.getName());
            }
        }
    }
Loading