Loading res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -12458,6 +12458,8 @@ <string name="network_and_internet_preferences_title">Preferences</string> <!-- Network & internet preferences summary [CHAR LIMIT=NONE] --> <string name="network_and_internet_preferences_summary">Connect to public networks</string> <!-- Search keywords for "Internet" settings [CHAR_LIMIT=NONE] --> <string name="keywords_internet">network connection, internet, wireless, data, wifi, wi-fi, wi fi, cellular, mobile, cell carrier, 4g, 3g, 2g, lte</string> <!-- Summary for preference when Bedtime mode is on [CHAR LIMIT=NONE] --> <string name="aware_summary_when_bedtime_on">Unavailable because bedtime mode is on</string> res/xml/network_provider_internet.xml +6 −8 Original line number Diff line number Diff line Loading @@ -21,18 +21,16 @@ 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" <com.android.settingslib.RestrictedPreference android:fragment="com.android.settings.network.NetworkProviderSettings" android:key="internet_settings" 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> settings:allowDividerAbove="true" settings:keywords="@string/keywords_internet" settings:useAdminDisabledSummary="true" /> <com.android.settingslib.RestrictedPreference android:key="calls_and_sms" Loading res/xml/network_provider_settings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:title="@string/network_dashboard_title" android:title="@string/provider_internet_settings" settings:keywords="@string/keywords_wifi"> <com.android.settings.wifi.LinkablePreference Loading src/com/android/settings/network/InternetPreferenceController.java 0 → 100644 +82 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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. */ package com.android.settings.network; import android.content.Context; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.widget.SummaryUpdater; import com.android.settings.wifi.WifiSummaryUpdater; import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.events.OnPause; import com.android.settingslib.core.lifecycle.events.OnResume; /** * PreferenceController to update the internet state. */ public class InternetPreferenceController extends AbstractPreferenceController implements PreferenceControllerMixin, SummaryUpdater.OnSummaryChangeListener, LifecycleObserver, OnResume, OnPause { public static final String KEY_INTERNET_SETTINGS = "internet_settings"; private Preference mPreference; private final WifiSummaryUpdater mSummaryHelper; public InternetPreferenceController(Context context) { super(context); mSummaryHelper = new WifiSummaryUpdater(mContext, this); } @Override public void displayPreference(PreferenceScreen screen) { super.displayPreference(screen); mPreference = screen.findPreference(KEY_INTERNET_SETTINGS); } @Override public boolean isAvailable() { return true; } @Override public String getPreferenceKey() { return KEY_INTERNET_SETTINGS; } @Override public void onResume() { mSummaryHelper.register(true); } @Override public void onPause() { mSummaryHelper.register(false); } @Override public void onSummaryChanged(String summary) { if (mPreference != null) { mPreference.setSummary(summary); } } } src/com/android/settings/network/NetworkDashboardFragment.java +19 −3 Original line number Diff line number Diff line Loading @@ -104,7 +104,13 @@ public class NetworkDashboardFragment extends DashboardFragment implements final MobilePlanPreferenceController mobilePlanPreferenceController = new MobilePlanPreferenceController(context, mobilePlanHost); final WifiPrimarySwitchPreferenceController wifiPreferenceController = new WifiPrimarySwitchPreferenceController(context, metricsFeatureProvider); isProviderModelEnabled(context) ? null : new WifiPrimarySwitchPreferenceController( context, metricsFeatureProvider); final InternetPreferenceController internetPreferenceController = isProviderModelEnabled(context) ? new InternetPreferenceController(context) : null; final VpnPreferenceController vpnPreferenceController = new VpnPreferenceController(context); Loading @@ -113,7 +119,12 @@ public class NetworkDashboardFragment extends DashboardFragment implements if (lifecycle != null) { lifecycle.addObserver(mobilePlanPreferenceController); if (wifiPreferenceController != null) { lifecycle.addObserver(wifiPreferenceController); } if (internetPreferenceController != null) { lifecycle.addObserver(internetPreferenceController); } lifecycle.addObserver(vpnPreferenceController); lifecycle.addObserver(privateDnsPreferenceController); } Loading @@ -125,7 +136,12 @@ public class NetworkDashboardFragment extends DashboardFragment implements controllers.add(vpnPreferenceController); controllers.add(new ProxyPreferenceController(context)); controllers.add(mobilePlanPreferenceController); if (wifiPreferenceController != null) { controllers.add(wifiPreferenceController); } if (internetPreferenceController != null) { controllers.add(internetPreferenceController); } controllers.add(privateDnsPreferenceController); return controllers; } Loading Loading
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -12458,6 +12458,8 @@ <string name="network_and_internet_preferences_title">Preferences</string> <!-- Network & internet preferences summary [CHAR LIMIT=NONE] --> <string name="network_and_internet_preferences_summary">Connect to public networks</string> <!-- Search keywords for "Internet" settings [CHAR_LIMIT=NONE] --> <string name="keywords_internet">network connection, internet, wireless, data, wifi, wi-fi, wi fi, cellular, mobile, cell carrier, 4g, 3g, 2g, lte</string> <!-- Summary for preference when Bedtime mode is on [CHAR LIMIT=NONE] --> <string name="aware_summary_when_bedtime_on">Unavailable because bedtime mode is on</string>
res/xml/network_provider_internet.xml +6 −8 Original line number Diff line number Diff line Loading @@ -21,18 +21,16 @@ 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" <com.android.settingslib.RestrictedPreference android:fragment="com.android.settings.network.NetworkProviderSettings" android:key="internet_settings" 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> settings:allowDividerAbove="true" settings:keywords="@string/keywords_internet" settings:useAdminDisabledSummary="true" /> <com.android.settingslib.RestrictedPreference android:key="calls_and_sms" Loading
res/xml/network_provider_settings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:title="@string/network_dashboard_title" android:title="@string/provider_internet_settings" settings:keywords="@string/keywords_wifi"> <com.android.settings.wifi.LinkablePreference Loading
src/com/android/settings/network/InternetPreferenceController.java 0 → 100644 +82 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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. */ package com.android.settings.network; import android.content.Context; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.widget.SummaryUpdater; import com.android.settings.wifi.WifiSummaryUpdater; import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.events.OnPause; import com.android.settingslib.core.lifecycle.events.OnResume; /** * PreferenceController to update the internet state. */ public class InternetPreferenceController extends AbstractPreferenceController implements PreferenceControllerMixin, SummaryUpdater.OnSummaryChangeListener, LifecycleObserver, OnResume, OnPause { public static final String KEY_INTERNET_SETTINGS = "internet_settings"; private Preference mPreference; private final WifiSummaryUpdater mSummaryHelper; public InternetPreferenceController(Context context) { super(context); mSummaryHelper = new WifiSummaryUpdater(mContext, this); } @Override public void displayPreference(PreferenceScreen screen) { super.displayPreference(screen); mPreference = screen.findPreference(KEY_INTERNET_SETTINGS); } @Override public boolean isAvailable() { return true; } @Override public String getPreferenceKey() { return KEY_INTERNET_SETTINGS; } @Override public void onResume() { mSummaryHelper.register(true); } @Override public void onPause() { mSummaryHelper.register(false); } @Override public void onSummaryChanged(String summary) { if (mPreference != null) { mPreference.setSummary(summary); } } }
src/com/android/settings/network/NetworkDashboardFragment.java +19 −3 Original line number Diff line number Diff line Loading @@ -104,7 +104,13 @@ public class NetworkDashboardFragment extends DashboardFragment implements final MobilePlanPreferenceController mobilePlanPreferenceController = new MobilePlanPreferenceController(context, mobilePlanHost); final WifiPrimarySwitchPreferenceController wifiPreferenceController = new WifiPrimarySwitchPreferenceController(context, metricsFeatureProvider); isProviderModelEnabled(context) ? null : new WifiPrimarySwitchPreferenceController( context, metricsFeatureProvider); final InternetPreferenceController internetPreferenceController = isProviderModelEnabled(context) ? new InternetPreferenceController(context) : null; final VpnPreferenceController vpnPreferenceController = new VpnPreferenceController(context); Loading @@ -113,7 +119,12 @@ public class NetworkDashboardFragment extends DashboardFragment implements if (lifecycle != null) { lifecycle.addObserver(mobilePlanPreferenceController); if (wifiPreferenceController != null) { lifecycle.addObserver(wifiPreferenceController); } if (internetPreferenceController != null) { lifecycle.addObserver(internetPreferenceController); } lifecycle.addObserver(vpnPreferenceController); lifecycle.addObserver(privateDnsPreferenceController); } Loading @@ -125,7 +136,12 @@ public class NetworkDashboardFragment extends DashboardFragment implements controllers.add(vpnPreferenceController); controllers.add(new ProxyPreferenceController(context)); controllers.add(mobilePlanPreferenceController); if (wifiPreferenceController != null) { controllers.add(wifiPreferenceController); } if (internetPreferenceController != null) { controllers.add(internetPreferenceController); } controllers.add(privateDnsPreferenceController); return controllers; } Loading