Merge "[Provider Model] Use new entry xml of Network & Internet"
This commit is contained in:
@@ -12346,6 +12346,16 @@
|
||||
<!-- Switch text for bluetooth feature being off [CHAR LIMIT=NONE] -->
|
||||
<string name="bluetooth_setting_off">Off</string>
|
||||
|
||||
<!-- Provider Model: Internet controls settings screen, item title to go into the networks settings -->
|
||||
<string name="provider_internet_settings">Internet</string>
|
||||
<!-- Provider Model: SIMs controls settings screen, item title to go into the SIMs settings -->
|
||||
<string name="provider_network_settings_title">SIMs</string>
|
||||
<!-- Provider Model: Airplane-safe networks controls settings screen -->
|
||||
<string name="airplane_safe_networks">Airplane-safe networks</string>
|
||||
<!-- Provider Model: Summary for airplane-safe networks -->
|
||||
<string name="airplane_safe_networks_summary">Find and connect to airplane\u2011safe networks</string>
|
||||
<!-- Provider Model: List of synonyms for the airplane-safe networks, used to match in settings search [CHAR LIMIT=NONE] -->
|
||||
<string name="keywords_airplane_safe_networks">airplane, airplane-safe</string>
|
||||
<!-- Provider Model: Calls and SMS controllers settings screen, item title to go into the Calls and SMS settings -->
|
||||
<string name="calls_and_sms">Calls & SMS</string>
|
||||
<!-- Provider Model: Name for call settings category [CHAR LIMIT=NONE] -->
|
||||
|
140
res/xml/network_provider_internet.xml
Normal file
140
res/xml/network_provider_internet.xml
Normal file
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="network_provider_and_internet_screen"
|
||||
android:title="@string/network_dashboard_title"
|
||||
settings:initialExpandedChildrenCount="5">
|
||||
|
||||
<com.android.settings.widget.PrimarySwitchPreference
|
||||
android:fragment="com.android.settings.wifi.WifiSettings"
|
||||
android:key="main_toggle_wifi"
|
||||
android:title="@string/provider_internet_settings"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:icon="@drawable/ic_settings_wireless"
|
||||
android:order="-30"
|
||||
settings:allowDividerAbove="true">
|
||||
<intent
|
||||
android:action="android.settings.WIFI_SETTINGS"
|
||||
android:targetClass="Settings$WifiSettingsActivity" />
|
||||
</com.android.settings.widget.PrimarySwitchPreference>
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="calls_and_sms"
|
||||
android:title="@string/calls_and_sms"
|
||||
android:icon="@drawable/ic_network_cell"
|
||||
android:order="-20"
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:keywords="@string/calls_and_sms"
|
||||
settings:useAdminDisabledSummary="true" />
|
||||
|
||||
<com.android.settings.widget.AddPreference
|
||||
android:key="mobile_network_list"
|
||||
android:title="@string/provider_network_settings_title"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:icon="@drawable/ic_network_cell"
|
||||
android:order="-15"
|
||||
settings:keywords="@string/keywords_more_mobile_networks"
|
||||
settings:userRestriction="no_config_mobile_networks"
|
||||
settings:allowDividerAbove="true"
|
||||
settings:useAdminDisabledSummary="true" />
|
||||
|
||||
<com.android.settingslib.RestrictedSwitchPreference
|
||||
android:key="airplane_mode"
|
||||
android:title="@string/airplane_mode"
|
||||
android:icon="@drawable/ic_airplanemode_active"
|
||||
android:disableDependentsState="true"
|
||||
android:order="-5"
|
||||
settings:controller="com.android.settings.network.AirplaneModePreferenceController"
|
||||
settings:userRestriction="no_airplane_mode"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="airplane_safe_networks"
|
||||
android:title="@string/airplane_safe_networks"
|
||||
android:icon="@drawable/ic_airplanemode_active"
|
||||
android:order="-4"
|
||||
android:summary="@string/airplane_safe_networks_summary"
|
||||
settings:controller="com.android.settings.network.AirplaneSafeNetworkModePreferenceController"
|
||||
settings:keywords="@string/keywords_airplane_safe_networks" />
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="manage_mobile_plan"
|
||||
android:title="@string/manage_mobile_plan_title"
|
||||
android:persistent="false"
|
||||
android:order="0"
|
||||
settings:userRestriction="no_config_mobile_networks"
|
||||
settings:useAdminDisabledSummary="true" />
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:fragment="com.android.settings.TetherSettings"
|
||||
android:key="tether_settings"
|
||||
android:title="@string/tether_settings_title_all"
|
||||
android:icon="@drawable/ic_wifi_tethering"
|
||||
android:order="5"
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:keywords="@string/keywords_hotspot_tethering"
|
||||
settings:userRestriction="no_config_tethering"
|
||||
settings:useAdminDisabledSummary="true" />
|
||||
|
||||
<com.android.settings.widget.PrimarySwitchPreference
|
||||
android:fragment="com.android.settings.AllInOneTetherSettings"
|
||||
android:key="all_tether_settings"
|
||||
android:title="@string/tether_settings_title_all"
|
||||
android:icon="@drawable/ic_wifi_tethering"
|
||||
android:order="6"
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:controller="com.android.settings.network.AllInOneTetherPreferenceController"
|
||||
settings:keywords="@string/keywords_hotspot_tethering"
|
||||
settings:userRestriction="no_config_tethering"
|
||||
settings:useAdminDisabledSummary="true" />
|
||||
|
||||
<com.android.settings.datausage.DataSaverPreference
|
||||
android:key="restrict_background_parent_entry"
|
||||
android:title="@string/data_saver_title"
|
||||
android:icon="@drawable/ic_settings_data_usage"
|
||||
android:order="10"
|
||||
android:fragment="com.android.settings.datausage.DataSaverSummary"/>
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:fragment="com.android.settings.vpn2.VpnSettings"
|
||||
android:key="vpn_settings"
|
||||
android:title="@string/vpn_settings_title"
|
||||
android:icon="@drawable/ic_vpn_key"
|
||||
android:order="15"
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:userRestriction="no_config_vpn"
|
||||
settings:useAdminDisabledSummary="true" />
|
||||
|
||||
<com.android.settings.network.PrivateDnsModeDialogPreference
|
||||
android:key="private_dns_settings"
|
||||
android:title="@string/select_private_dns_configuration_title"
|
||||
android:order="20"
|
||||
android:dialogTitle="@string/select_private_dns_configuration_dialog_title"
|
||||
android:dialogLayout="@layout/private_dns_mode_dialog"
|
||||
android:positiveButtonText="@string/save"
|
||||
android:negativeButtonText="@android:string/cancel" />
|
||||
|
||||
<Preference
|
||||
android:fragment="com.android.settings.network.AdaptiveConnectivitySettings"
|
||||
android:key="adaptive_connectivity"
|
||||
android:title="@string/adaptive_connectivity_title"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:order="25"
|
||||
settings:controller="com.android.settings.network.AdaptiveConnectivityPreferenceController"/>
|
||||
</PreferenceScreen>
|
@@ -21,6 +21,7 @@ import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
@@ -57,14 +58,20 @@ public class NetworkDashboardFragment extends DashboardFragment implements
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.network_and_internet;
|
||||
if (isProviderModelEnabled(getContext())) {
|
||||
return R.xml.network_provider_internet;
|
||||
} else {
|
||||
return R.xml.network_and_internet;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
use(MultiNetworkHeaderController.class).init(getSettingsLifecycle());
|
||||
if (!isProviderModelEnabled(context)) {
|
||||
use(MultiNetworkHeaderController.class).init(getSettingsLifecycle());
|
||||
}
|
||||
use(AirplaneModePreferenceController.class).setFragment(this);
|
||||
getSettingsLifecycle().addObserver(use(AllInOneTetherPreferenceController.class));
|
||||
}
|
||||
@@ -164,4 +171,8 @@ public class NetworkDashboardFragment extends DashboardFragment implements
|
||||
null /* mobilePlanHost */);
|
||||
}
|
||||
};
|
||||
|
||||
private static boolean isProviderModelEnabled(Context context) {
|
||||
return FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user