Merge "Update string for Adaptive sleep slice title." into rvc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4a9a7c7..555cbd1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3814,6 +3814,12 @@
<!-- Bluetooth Tethering settings. Message for untethering from a bluetooth device [CHAR LIMIT=50]-->
<string name="bluetooth_untether_blank"><xliff:g id="device_name">%1$s</xliff:g> will be untethered.</string>
+ <!-- Ethernet Tethering settings-->
+ <!-- Label for ethernet tether checkbox [CHAR LIMIT=25]-->
+ <string name="ethernet_tether_checkbox_text">Ethernet tethering</string>
+ <!-- Ethernet Tethering subtext [CHAR LIMIT=70]-->
+ <string name="ethernet_tethering_subtext" product="default">Share phone\u2019s internet connection via USB Ethernet</string>
+
<!-- Tethering footer info [CHAR LIMIT=NONE]-->
<string name="tethering_footer_info">Use hotspot and tethering to provide internet to other devices through your mobile data connection. Apps can also create a hotspot to share content with nearby devices.</string>
<!-- Tethering footer info for the device which supports Wi-Fi and Wi-Fi tethering enabled at the same time [CHAR LIMIT=NONE]-->
@@ -7261,7 +7267,7 @@
<string name="contact_discovery_opt_in_dialog_title">Enable contact discovery?</string>
<!-- Text displayed in the dialog shown when the user tries to enable Contact Discovery.
[CHAR LIMIT=NONE]-->
- <string name="contact_discovery_opt_in_dialog_message">Enabling this feature will allow your carrier access to phone numbers in your contacts in order to discover which calling features they support.</string>
+ <string name="contact_discovery_opt_in_dialog_message">All of the phone numbers in your contacts will be periodically sent to your carrier in order to discover which calling features are supported.</string>
<!-- Preferred network type title. [CHAR LIMIT=50] -->
<string name="preferred_network_type_title">Preferred network type</string>
<!-- Preferred network type summary. [CHAR LIMIT=100] -->
@@ -8183,6 +8189,24 @@
<!-- Button to cancel out of the dialog shown when the user has disabled bubbles at the feature level but tries to enable it for an app. [CHAR LIMIT=60] -->
<string name="bubbles_feature_disabled_button_cancel">Cancel</string>
+ <!-- Bubble feature settings: Description for toggle when bubbles are turned on in notification settings [CHAR LIMIT=100] -->
+ <string name="notifications_bubble_setting_on_summary">On / Conversations can appear as floating icons</string>
+ <!-- Bubble feature settings: Title of the toggle to turn bubbles on and off [CHAR LIMIT=100] -->
+ <string name="notifications_bubble_setting_title">Allow apps to show bubbles</string>
+ <!-- Bubble feature settings: Description shown with the toggle to turn bubbles on and off [CHAR LIMIT=NONE]-->
+ <string name="notifications_bubble_setting_description">Some conversations will appear as floating icons on top of other apps</string>
+
+ <!-- Bubble app settings: option allowing all conversations from an app to bubble if the app sends bubbles [CHAR LIMIT=60]-->
+ <string name="bubble_app_setting_all">All conversations can bubble</string>
+ <!-- Bubble app settings: option allowing only user selected conversations from an app to bubble if the app sends bubbles [CHAR LIMIT=60] -->
+ <string name="bubble_app_setting_selected">Selected conversations can bubble</string>
+ <!-- Bubble app settings: option allowing no bubbles from the app [CHAR LIMIT=60] -->
+ <string name="bubble_app_setting_none">Nothing can bubble</string>
+ <!-- Bubble app settings: Title above a list of conversations that have been selected to bubble [CHAR LIMIT=60]-->
+ <string name="bubble_app_setting_selected_conversation_title">Conversations</string>
+ <!-- Bubble app settings: Title above a list of conversations that have been excluded from bubbling [CHAR LIMIT=60] -->
+ <string name="bubble_app_setting_excluded_conversation_title">Excluded</string>
+
<!-- Configure notifications: title for swipe direction [CHAR LIMIT=60] -->
<string name="swipe_direction_title">Swipe actions</string>
@@ -8548,58 +8572,98 @@
<!-- Apps > App Details > Picture-in-picture > Description. [CHAR LIMIT=NONE] -->
<string name="picture_in_picture_app_detail_summary">Allow this app to create a picture-in-picture window while the app is open or after you leave it (for example, to continue watching a video). This window displays on top of other apps you\'re using.</string>
- <!-- Special access > Title for managing the settings where users opt-in to connect a work app
- to its personal equivalent, allowing cross-profile communication. [CHAR LIMIT=50] -->
- <string name="interact_across_profiles_title" translatable="false">Connected personal and work apps</string>
+ <!-- Settings label. This setting shows a user's connected work and personal apps.
+ When a user connects select work and personal apps, they can access work and personal data together. [CHAR LIMIT=50] -->
+ <string name="interact_across_profiles_title">Connected work & personal apps</string>
- <!-- Special access > Connected personal and work apps > Text to display when the list is empty. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_empty_text" translatable="false">No connected apps</string>
+ <!-- Settings subtext. This text is shown when a user doesn't have any connected apps. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_empty_text">No connected apps</string>
- <!-- Special access > Connected personal and work apps > Additional keywords to search for. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_keywords" translatable="false">cross profile connected app apps work and personal</string>
+ <!-- Search keywords. If a user is searching for the "Connected work & personal apps" feature in Settings,
+ these keywords will surface that feature. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_keywords">cross profile connected app apps work and personal</string>
- <!-- Apps > App Details > Advanced section string title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_app_detail_title" translatable="false">Connected personal and work apps</string>
+ <!-- Settings header. This setting shows a user's connected work and personal apps.
+ When a user connects select work and personal apps, they can access work and personal data together. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_app_detail_title">Connected work & personal apps</string>
- <!-- Apps > App Details > Connected personal and work apps > Switch title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_switch_enabled" translatable="false">Connected</string>
+ <!-- Toggle label. This text is shown when a user's work and personal apps are connected. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_switch_enabled">Connected</string>
- <!-- Apps > App Details > Connected personal and work apps > Switch title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_switch_disabled" translatable="false">Connect these apps</string>
+ <!-- Toggle label. This text is shown when a user can connect specific work and personal apps.
+ The apps they can connect are shown above this toggle. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_switch_disabled">Connect these apps</string>
- <!-- Apps > App Details > Connected personal and work apps > Description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_summary_1" translatable="false">Connected apps share permissions and can access each other\u2019s data.</string>
+ <!-- Settings text. This text lets a user know that if they connect work and personal apps,
+ they will share permissions and can access each other's data. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_summary_1">Connected apps share permissions and can access each other\u2019s data.</string>
- <!-- Apps > App Details > Connected personal and work apps > Description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_summary_2" translatable="false">Only connect apps that you trust with your personal data. Work apps may expose your data to your IT admin.</string>
+ <!-- Settings text. This text lets a user know that they should only connect work and personal apps
+ if they trust the work app with their personal data. The work app could potentially show that data
+ to the user's IT admin. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_summary_2">Only connect apps that you trust with your personal data. Work apps may expose your data to your IT admin.</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_title" translatable="false">Trust work %1$s with your personal data?</string>
+ <!-- Dialog title. This dialog is shown when a user tries to connect a work app to a personal
+ app (e.g. their work Calendar to their personal Calendar), and it's confirming that they should
+ connect the apps only if they trust the work app with their personal data. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_title">Trust work <xliff:g id="name" example="Calendar">%1$s</xliff:g> with your personal data?</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_summary" translatable="false">%1$s may expose your personal data to your IT admin.</string>
+ <!-- Dialog text. This dialog is shown when a user tries to connect a work app to a personal
+ app (e.g. their work Calendar to their personal Calendar), and it's confirming that they should
+ connect the apps only if they trust the work app with their personal data.
+ The placeholder is the app name. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_summary"><xliff:g id="name" example="Calendar">%1$s</xliff:g> may expose your personal data to your IT admin.</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog App data title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_app_data_title" translatable="false">App data</string>
+ <!-- Title of a section in a dialog. This section shows the app data that will be
+ accessible when work and personal apps are connected. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_app_data_title">App data</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog App data description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_app_data_summary" translatable="false">It can access data in your personal %1$s app.</string>
+ <!-- Dialog text. This text lets the user know that their work app (e.g. Calendar) will be
+ able to access data in their personal app. The placeholder is the app name. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_app_data_summary">This app can access data in your personal <xliff:g id="name" example="Calendar">%1$s</xliff:g> app.</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog Permissions title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_permissions_title" translatable="false">Permissions</string>
+ <!-- Title of a section in a dialog. This section shows the permissions that will be accessible
+ when work and personal apps are connected. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_permissions_title">Permissions</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog Permissions description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_permissions_summary" translatable="false">It can use your personal %1$s app\u2019s permissions, like access to location, storage, or contacts.</string>
+ <!-- Dialog text. This text lets the user know that their work app (e.g. Calendar) will be able
+ to use permissions in their personal app. The placeholder is the app name. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_permissions_summary">This app can use your personal <xliff:g id="name" example="Calendar">%1$s</xliff:g> app\u2019s permissions, like access to location, storage, or contacts.</string>
- <!-- Summary of preference to manage connected personal and work apps, informing the user that currently no apps are connected -->
- <string name="interact_across_profiles_number_of_connected_apps_none" translatable="false">No apps connected</string>
+ <!-- Summary of preference to manage connected work and personal apps, informing the user that
+ currently no apps are connected [CHAR LIMIT=NONE]-->
+ <string name="interact_across_profiles_number_of_connected_apps_none">No apps connected</string>
- <!-- Summary of preference to manage connected personal and work apps, informing the user how many apps are connected -->
- <plurals name="interact_across_profiles_number_of_connected_apps" translatable="false">
+ <!-- Summary of preference to manage connected work and personal apps, informing the user how many apps are connected -->
+ <plurals name="interact_across_profiles_number_of_connected_apps">
<item quantity="one"><xliff:g id="count">%d</xliff:g> app connected</item>
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps connected</item>
</plurals>
+ <!-- Banner title. This banner lets a user know that they need to install an app in their
+ work profile in order to connect it to the corresponding personal app.
+ The placeholder would be the app name (e.g. Calendar). [CHAR LIMIT=50]-->
+ <string name="interact_across_profiles_install_work_app_title">Install <xliff:g id="name" example="Calendar">%1$s</xliff:g> in your work profile</string>
+
+ <!-- Banner text. This banner lets a user know that they need to install an app in their
+ work profile in order to connect it to the corresponding personal app.
+ The placeholder would be the app name (e.g. Calendar). [CHAR LIMIT=NONE]-->
+ <string name="interact_across_profiles_install_work_app_summary">To connect these apps, install the <xliff:g id="name" example="Calendar">%1$s</xliff:g> app in your work profile</string>
+
+ <!-- Banner title. This banner lets a user know that they need to install an app in their
+ personal profile in order to connect it to the corresponding work app.
+ The placeholder would be the app name (e.g. Calendar). [CHAR LIMIT=50]-->
+ <string name="interact_across_profiles_install_personal_app_title">Install <xliff:g id="name" example="Calendar">%1$s</xliff:g> in your personal profile</string>
+
+ <!-- Banner text. This banner lets a user know that they need to install an app in their
+ personal profile in order to connect it to the corresponding work app.
+ The placeholder would be the app name (e.g. Calendar). [CHAR LIMIT=NONE]-->
+ <string name="interact_across_profiles_install_personal_app_summary">To connect these apps, install the <xliff:g id="name" example="Calendar">%1$s</xliff:g> app in your personal profile</string>
+
+ <!-- Button text. This button takes a user to the app store so they can download and
+ install the app they need. [CHAR LIMIT=50]-->
+ <string name="interact_across_profiles_install_app_action">Get the app</string>
+
<!-- Sound & notification > Advanced section: Title for managing Do Not Disturb access option. [CHAR LIMIT=40] -->
<string name="manage_zen_access_title">Do Not Disturb access</string>
@@ -10487,6 +10551,11 @@
<!-- [CHAR LIMIT=60] Name of dev option to enable extra quick settings tiles -->
<string name="quick_settings_developer_tiles">Quick settings developer tiles</string>
+ <!-- [CHAR LIMIT=50] Setting title to disable the adb authorization timeout feature. -->
+ <string name="adb_authorization_timeout_title">Disable adb authorization timeout</string>
+ <!-- [CHAR LIMIT=NONE] Setting summary explaining the disablement of the automatic adb authorization timeout. -->
+ <string name="adb_authorization_timeout_summary">Disable automatic revocation of adb authorizations for systems that have not reconnected within the default (7 days) or user-configured (minimum 1 day) amount of time.</string>
+
<!-- [CHAR LIMIT=25] Title of developer tile to toggle winscope trace -->
<string name="winscope_trace_quick_settings_title">Winscope Trace</string>
@@ -11808,4 +11877,9 @@
<!-- Button label to stop casting on media device. [CHAR LIMIT=40 -->
<string name="media_output_panel_stop_casting_button">Stop casting</string>
+
+ <!-- Title for the 5G limited VoLTE dialog. [CHAR LIMIT=50] -->
+ <string name="volte_5G_limited_title">Turn off VoLTE?</string>
+ <!-- Content description for the 5G limited VoLTE dialog. [CHAR LIMIT=NONE] -->
+ <string name="volte_5G_limited_text">This also turns off your 5G connection.\nDuring a voice call, you can\u2019t use the internet and some apps may not work.</string>
</resources>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index b4d0bba..48a0850 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -149,6 +149,11 @@
settings:keywords="@string/keywords_adb_wireless" />
<SwitchPreference
+ android:key="adb_authorization_timeout"
+ android:title="@string/adb_authorization_timeout_title"
+ android:summary="@string/adb_authorization_timeout_summary" />
+
+ <SwitchPreference
android:key="enable_terminal"
android:title="@string/enable_terminal_title"
android:summary="@string/enable_terminal_summary" />
diff --git a/res/xml/tether_prefs.xml b/res/xml/tether_prefs.xml
index abc49cc..9367a9b 100644
--- a/res/xml/tether_prefs.xml
+++ b/res/xml/tether_prefs.xml
@@ -38,6 +38,12 @@
android:summary="@string/bluetooth_tethering_subtext"
settings:keywords="@string/keywords_hotspot_tethering" />
+ <SwitchPreference
+ android:key="enable_ethernet_tethering"
+ android:title="@string/ethernet_tether_checkbox_text"
+ android:summary="@string/ethernet_tethering_subtext"
+ settings:keywords="@string/keywords_hotspot_tethering" />
+
<Preference
android:key="disabled_on_data_saver"
android:summary="@string/tether_settings_disabled_on_data_saver"
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index cce2010..c61e573 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -18,6 +18,7 @@
import static android.net.ConnectivityManager.TETHERING_BLUETOOTH;
import static android.net.ConnectivityManager.TETHERING_USB;
+import static android.net.TetheringManager.TETHERING_ETHERNET;
import android.app.Activity;
import android.app.settings.SettingsEnums;
@@ -31,12 +32,16 @@
import android.content.pm.PackageManager;
import android.hardware.usb.UsbManager;
import android.net.ConnectivityManager;
+import android.net.EthernetManager;
+import android.net.TetheringManager;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
+import android.os.HandlerExecutor;
import android.os.UserManager;
import android.provider.SearchIndexableResource;
+import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import androidx.annotation.VisibleForTesting;
@@ -71,6 +76,7 @@
static final String KEY_USB_TETHER_SETTINGS = "usb_tether_settings";
@VisibleForTesting
static final String KEY_ENABLE_BLUETOOTH_TETHERING = "enable_bluetooth_tethering";
+ private static final String KEY_ENABLE_ETHERNET_TETHERING = "enable_ethernet_tethering";
private static final String KEY_DATA_SAVER_FOOTER = "disabled_on_data_saver";
@VisibleForTesting
static final String KEY_TETHER_PREFS_FOOTER = "tether_prefs_footer";
@@ -81,15 +87,22 @@
private SwitchPreference mBluetoothTether;
+ private SwitchPreference mEthernetTether;
+
private BroadcastReceiver mTetherChangeReceiver;
private String[] mUsbRegexs;
private String[] mBluetoothRegexs;
+ private String mEthernetRegex;
private AtomicReference<BluetoothPan> mBluetoothPan = new AtomicReference<>();
private Handler mHandler = new Handler();
private OnStartTetheringCallback mStartTetheringCallback;
private ConnectivityManager mCm;
+ private EthernetManager mEm;
+ private TetheringManager mTm;
+ private TetheringEventCallback mTetheringEventCallback;
+ private EthernetListener mEthernetListener;
private WifiTetherPreferenceController mWifiTetherPreferenceController;
@@ -144,17 +157,23 @@
mUsbTether = (SwitchPreference) findPreference(KEY_USB_TETHER_SETTINGS);
mBluetoothTether = (SwitchPreference) findPreference(KEY_ENABLE_BLUETOOTH_TETHERING);
+ mEthernetTether = (SwitchPreference) findPreference(KEY_ENABLE_ETHERNET_TETHERING);
setFooterPreferenceTitle();
mDataSaverBackend.addListener(this);
mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+ mEm = (EthernetManager) getSystemService(Context.ETHERNET_SERVICE);
+ mTm = (TetheringManager) getSystemService(Context.TETHERING_SERVICE);
mUsbRegexs = mCm.getTetherableUsbRegexs();
mBluetoothRegexs = mCm.getTetherableBluetoothRegexs();
+ mEthernetRegex = getContext().getResources().getString(
+ com.android.internal.R.string.config_ethernet_iface_regex);
final boolean usbAvailable = mUsbRegexs.length != 0;
final boolean bluetoothAvailable = mBluetoothRegexs.length != 0;
+ final boolean ethernetAvailable = !TextUtils.isEmpty(mEthernetRegex);
if (!usbAvailable || Utils.isMonkeyRunning()) {
getPreferenceScreen().removePreference(mUsbTether);
@@ -172,6 +191,7 @@
mBluetoothTether.setChecked(false);
}
}
+ if (!ethernetAvailable) getPreferenceScreen().removePreference(mEthernetTether);
// Set initial state based on Data Saver mode.
onDataSaverChanged(mDataSaverBackend.isDataSaverEnabled());
}
@@ -194,6 +214,7 @@
mDataSaverEnabled = isDataSaving;
mUsbTether.setEnabled(!mDataSaverEnabled);
mBluetoothTether.setEnabled(!mDataSaverEnabled);
+ mEthernetTether.setEnabled(!mDataSaverEnabled);
mDataSaverFooter.setVisible(mDataSaverEnabled);
}
@@ -221,6 +242,7 @@
@Override
public void onReceive(Context content, Intent intent) {
String action = intent.getAction();
+ // TODO: stop using ACTION_TETHER_STATE_CHANGED and use mTetheringEventCallback instead.
if (action.equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) {
// TODO - this should understand the interface types
ArrayList<String> available = intent.getStringArrayListExtra(
@@ -279,6 +301,8 @@
final Activity activity = getActivity();
mStartTetheringCallback = new OnStartTetheringCallback(this);
+ mTetheringEventCallback = new TetheringEventCallback();
+ mTm.registerTetheringEventCallback(new HandlerExecutor(mHandler), mTetheringEventCallback);
mMassStorageActive = Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
mTetherChangeReceiver = new TetherChangeReceiver();
@@ -301,6 +325,9 @@
if (intent != null) mTetherChangeReceiver.onReceive(activity, intent);
+ mEthernetListener = new EthernetListener();
+ mEm.addListener(mEthernetListener);
+
updateState();
}
@@ -312,8 +339,12 @@
return;
}
getActivity().unregisterReceiver(mTetherChangeReceiver);
+ mTm.unregisterTetheringEventCallback(mTetheringEventCallback);
+ mEm.removeListener(mEthernetListener);
mTetherChangeReceiver = null;
mStartTetheringCallback = null;
+ mTetheringEventCallback = null;
+ mEthernetListener = null;
}
private void updateState() {
@@ -327,6 +358,7 @@
String[] errored) {
updateUsbState(available, tethered, errored);
updateBluetoothState();
+ updateEthernetState(available, tethered);
}
private void updateUsbState(String[] available, String[] tethered,
@@ -390,6 +422,31 @@
}
}
+ private void updateEthernetState(String[] available, String[] tethered) {
+
+ boolean isAvailable = false;
+ boolean isTethered = false;
+
+ for (String s : available) {
+ if (s.matches(mEthernetRegex)) isAvailable = true;
+ }
+
+ for (String s : tethered) {
+ if (s.matches(mEthernetRegex)) isTethered = true;
+ }
+
+ if (isTethered) {
+ mEthernetTether.setEnabled(!mDataSaverEnabled);
+ mEthernetTether.setChecked(true);
+ } else if (isAvailable || mEm.isAvailable()) {
+ mEthernetTether.setEnabled(!mDataSaverEnabled);
+ mEthernetTether.setChecked(false);
+ } else {
+ mEthernetTether.setEnabled(false);
+ mEthernetTether.setChecked(false);
+ }
+ }
+
public static boolean isProvisioningNeededButUnavailable(Context context) {
return (TetherUtil.isProvisioningNeeded(context)
&& !isIntentAvailable(context));
@@ -438,6 +495,12 @@
} else {
mCm.stopTethering(TETHERING_BLUETOOTH);
}
+ } else if (preference == mEthernetTether) {
+ if (mEthernetTether.isChecked()) {
+ startTethering(TETHERING_ETHERNET);
+ } else {
+ mCm.stopTethering(TETHERING_ETHERNET);
+ }
}
return super.onPreferenceTreeClick(preference);
@@ -495,6 +558,13 @@
if (!bluetoothAvailable) {
keys.add(KEY_ENABLE_BLUETOOTH_TETHERING);
}
+
+ final boolean ethernetAvailable = !TextUtils.isEmpty(
+ context.getResources().getString(
+ com.android.internal.R.string.config_ethernet_iface_regex));
+ if (!ethernetAvailable) {
+ keys.add(KEY_ENABLE_ETHERNET_TETHERING);
+ }
return keys;
}
};
@@ -524,4 +594,17 @@
}
}
}
+
+ private final class TetheringEventCallback implements TetheringManager.TetheringEventCallback {
+ @Override
+ public void onTetheredInterfacesChanged(List<String> interfaces) {
+ updateState();
+ }
+ }
+
+ private final class EthernetListener implements EthernetManager.Listener {
+ public void onAvailabilityChanged(String iface, boolean isAvailable) {
+ mHandler.post(TetherSettings.this::updateState);
+ }
+ }
}
diff --git a/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceController.java b/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceController.java
new file mode 100644
index 0000000..79aa8e6
--- /dev/null
+++ b/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceController.java
@@ -0,0 +1,79 @@
+/*
+ * 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.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+/**
+ * Preference controller for the developer option to disable the automatic revocation of adb
+ * authorizations.
+ */
+public class AdbAuthorizationTimeoutPreferenceController extends
+ DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener {
+ private static final String ADB_AUTHORIZATION_TIMEOUT_KEY = "adb_authorization_timeout";
+
+ private final Context mContext;
+
+ public AdbAuthorizationTimeoutPreferenceController(Context context) {
+ super(context);
+ mContext = context;
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return ADB_AUTHORIZATION_TIMEOUT_KEY;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ final long authTimeout = Settings.Global.getLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
+ // An authTimeout of 0 indicates this preference is enabled and adb authorizations will not
+ // be automatically revoked.
+ ((SwitchPreference) mPreference).setChecked(authTimeout == 0);
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ writeSetting((boolean) newValue);
+ return true;
+ }
+
+ @Override
+ public void onDeveloperOptionsSwitchDisabled() {
+ super.onDeveloperOptionsSwitchDisabled();
+ writeSetting(false);
+ ((SwitchPreference) mPreference).setChecked(false);
+ }
+
+ private void writeSetting(boolean isEnabled) {
+ long authTimeout = 0;
+ if (!isEnabled) {
+ authTimeout = Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME;
+ }
+ Settings.Global.putLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ authTimeout);
+ }
+}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 8c79f2a..c349de9 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -444,6 +444,7 @@
controllers.add(new AdbPreferenceController(context, fragment));
controllers.add(new ClearAdbKeysPreferenceController(context, fragment));
controllers.add(new WirelessDebuggingPreferenceController(context, lifecycle));
+ controllers.add(new AdbAuthorizationTimeoutPreferenceController(context));
controllers.add(new LocalTerminalPreferenceController(context));
controllers.add(new BugReportInPowerPreferenceController(context));
controllers.add(new AutomaticSystemServerHeapDumpPreferenceController(context));
diff --git a/src/com/android/settings/development/compat/PlatformCompatDashboard.java b/src/com/android/settings/development/compat/PlatformCompatDashboard.java
index 7b79da7..2f2c750 100644
--- a/src/com/android/settings/development/compat/PlatformCompatDashboard.java
+++ b/src/com/android/settings/development/compat/PlatformCompatDashboard.java
@@ -100,7 +100,7 @@
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
try {
- mChanges = getPlatformCompat().listAllChanges();
+ mChanges = getPlatformCompat().listUIChanges();
} catch (RemoteException e) {
throw new RuntimeException("Could not list changes!", e);
}
diff --git a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
index 5ac407d..2716e4c 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
@@ -467,7 +467,7 @@
return true;
}
- return channel.isBlockableSystem()
+ return channel.isBlockable()
|| channel.getImportance() == IMPORTANCE_NONE;
}
diff --git a/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java b/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
index f3fdcc9..21d49d9 100644
--- a/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
+++ b/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
@@ -42,7 +42,7 @@
implements LifecycleObserver {
private static final String TAG = "ContactDiscoveryPref";
private static final Uri UCE_URI = Uri.withAppendedPath(Telephony.SimInfo.CONTENT_URI,
- Telephony.SimInfo.IMS_RCS_UCE_ENABLED);
+ Telephony.SimInfo.COLUMN_IMS_RCS_UCE_ENABLED);
private ImsManager mImsManager;
private CarrierConfigManager mCarrierConfigManager;
diff --git a/src/com/android/settings/notification/app/NotificationPreferenceController.java b/src/com/android/settings/notification/app/NotificationPreferenceController.java
index be1ce1b..ecba95b 100644
--- a/src/com/android/settings/notification/app/NotificationPreferenceController.java
+++ b/src/com/android/settings/notification/app/NotificationPreferenceController.java
@@ -134,7 +134,7 @@
return channel.getImportance() == IMPORTANCE_NONE;
}
- return channel.isBlockableSystem() || !mAppRow.systemApp
+ return channel.isBlockable() || !mAppRow.systemApp
|| channel.getImportance() == IMPORTANCE_NONE;
}
return false;
diff --git a/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java b/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
index 27cf1e2..44114e5 100644
--- a/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
+++ b/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
@@ -100,6 +100,10 @@
@Override
public int getAvailabilityStatus() {
+ // It is possible that mEnableUseWifiComponentName is no longer enabled by
+ // USE_OPEN_WIFI_PACKAGE. So update this component to reflect correct availability.
+ updateEnableUseWifiComponentName();
+ checkForFeatureSupportedScorers();
return mDoFeatureSupportedScorersExist ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}
diff --git a/tests/robotests/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceControllerTest.java
new file mode 100644
index 0000000..bc3544d
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceControllerTest.java
@@ -0,0 +1,134 @@
+/*
+ * 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.development;
+
+import static junit.framework.Assert.assertEquals;
+
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class AdbAuthorizationTimeoutPreferenceControllerTest {
+ @Mock
+ private PreferenceScreen mPreferenceScreen;
+ @Mock
+ private DevelopmentSettingsDashboardFragment mFragment;
+
+ private Context mContext;
+ private ContentResolver mContentResolver;
+ private SwitchPreference mPreference;
+ private AdbAuthorizationTimeoutPreferenceController mPreferenceController;
+ private long mInitialAuthTimeout;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ mContext = RuntimeEnvironment.application;
+ mContentResolver = mContext.getContentResolver();
+
+ mPreferenceController = new AdbAuthorizationTimeoutPreferenceController(mContext);
+ mPreference = spy(new SwitchPreference(mContext));
+ when(mPreferenceScreen.findPreference(mPreferenceController.getPreferenceKey())).thenReturn(
+ mPreference);
+ mPreferenceController.displayPreference(mPreferenceScreen);
+
+ mInitialAuthTimeout = Settings.Global.getLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ Settings.Global.putLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME, mInitialAuthTimeout);
+ }
+
+ @Test
+ public void onPreferenceChange_enableSetting_timeoutSetToZero() throws Exception {
+ // This developer option disables the automatic adb authorization revocation by setting
+ // the timeout value to 0 when enabled.
+ mPreferenceController.onPreferenceChange(mPreference, true);
+ long authTimeout = Settings.Global.getLong(mContentResolver,
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME);
+
+ assertEquals(0, authTimeout);
+ }
+
+ @Test
+ public void onPreferenceChange_enableAndDisableSetting_timeoutSetToDefault()
+ throws Exception {
+ // A non-default setting value is not saved when this developer option is enabled and the
+ // setting value is set to 0. If the user subsequently disables the option the setting
+ // value is restored to the default value.
+ Settings.Global.putLong(mContentResolver, Settings.Global.ADB_ALLOWED_CONNECTION_TIME, 1);
+
+ mPreferenceController.onPreferenceChange(mPreference, true);
+ mPreferenceController.onPreferenceChange(mPreference, false);
+ long authTimeout = Settings.Global.getLong(mContentResolver,
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME);
+
+ assertEquals(Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME, authTimeout);
+ }
+
+ @Test
+ public void updateState_timeoutSetToZero_preferenceDisplayedEnabled() throws Exception {
+ Settings.Global.putLong(mContentResolver, Settings.Global.ADB_ALLOWED_CONNECTION_TIME, 0);
+
+ mPreferenceController.updateState(mPreference);
+
+ verify(mPreference).setChecked(true);
+ }
+
+ @Test
+ public void updateState_timeoutSetToDefault_preferenceDisplayedDisabled() throws Exception {
+ Settings.Global.putLong(mContentResolver, Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
+
+ mPreferenceController.updateState(mPreference);
+
+ verify(mPreference).setChecked(false);
+ }
+
+ @Test
+ public void onDeveloperOptionsSwitchDisabled_preferenceAndTimeoutDisabled() throws Exception {
+ mPreferenceController.onDeveloperOptionsSwitchDisabled();
+
+ long authTimeout = Settings.Global.getLong(mContentResolver,
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME);
+
+ assertEquals(Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME, authTimeout);
+ verify(mPreference).setChecked(false);
+ }
+}
+
diff --git a/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
index 1e59167..e59bd0b 100644
--- a/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
+++ b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
@@ -93,7 +93,7 @@
mChanges[2] = new CompatibilityChangeInfo(3L, "Enabled_After_SDK_1_1", 1, false, false, "");
mChanges[3] = new CompatibilityChangeInfo(4L, "Enabled_After_SDK_1_2", 1, false, false, "");
mChanges[4] = new CompatibilityChangeInfo(5L, "Enabled_After_SDK_2", 2, false, false, "");
- when(mPlatformCompat.listAllChanges()).thenReturn(mChanges);
+ when(mPlatformCompat.listUIChanges()).thenReturn(mChanges);
when(mPlatformCompat.getOverrideValidator()).thenReturn(mOverrideValidator);
// By default, allow any change
when(mOverrideValidator.getOverrideAllowedState(anyLong(),anyString()))
diff --git a/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
index 45a4563..0370bfa 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
@@ -64,7 +64,7 @@
private static final int TEST_SUB_ID = 2;
private static final Uri UCE_URI = Uri.withAppendedPath(Telephony.SimInfo.CONTENT_URI,
- Telephony.SimInfo.IMS_RCS_UCE_ENABLED);
+ Telephony.SimInfo.COLUMN_IMS_RCS_UCE_ENABLED);
@Mock private ImsManager mImsManager;
@Mock private ImsRcsManager mImsRcsManager;
diff --git a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
index b83ab77..d203c47 100644
--- a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
@@ -200,7 +200,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = new NotificationChannel("", "", IMPORTANCE_DEFAULT);
- channel.setBlockableSystem(true);
+ channel.setBlockable(true);
mController.onResume(appRow, channel, null, null, null, null);
mController.updateState(mPreference);
assertTrue(mSwitch.isEnabled());
diff --git a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
index 170a5e0..259f40e 100644
--- a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
@@ -236,7 +236,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = false;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(false);
+ when(channel.isBlockable()).thenReturn(false);
mController.onResume(appRow, channel, null, null, null, null);
assertTrue(mController.isChannelBlockable());
@@ -247,7 +247,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(false);
+ when(channel.isBlockable()).thenReturn(false);
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
mController.onResume(appRow, channel, null, null, null, null);
@@ -259,7 +259,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(true);
+ when(channel.isBlockable()).thenReturn(true);
mController.onResume(appRow, channel, null, null, null, null);
assertTrue(mController.isChannelBlockable());
@@ -270,7 +270,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(false);
+ when(channel.isBlockable()).thenReturn(false);
when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
mController.onResume(appRow, channel, null, null, null, null);
diff --git a/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java
index beaa1a6..ca636a4 100644
--- a/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java
@@ -39,7 +39,6 @@
import android.provider.Settings;
import androidx.fragment.app.Fragment;
-import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
import com.android.settings.R;
@@ -144,6 +143,19 @@
}
@Test
+ public void isAvailable_disableUseOpenWifiComponentBetweenCalls_returnsTrueThenReturnsFalse() {
+ setupScorers(Lists.newArrayList(sAppData));
+ createController();
+
+ assertThat(mController.isAvailable()).isTrue();
+
+ // Update NetworkScorerAppData so that it no longer has openWifiActivity.
+ setupScorers(Lists.newArrayList(sAppDataNoActivity));
+
+ assertThat(mController.isAvailable()).isFalse();
+ }
+
+ @Test
public void setChecked_withTrue_enableShouldStartEnableActivity() {
setupScorers(Lists.newArrayList(sAppData, sAppDataNoActivity));
createController();