From d26e1d68fd7bf04a1116767a854eeff9f27e4b28 Mon Sep 17 00:00:00 2001 From: tmfang Date: Sat, 9 Mar 2019 17:54:01 +0800 Subject: [PATCH 01/20] Use short format to avoid truncated problem Test: visual Fixes: 126871866 Change-Id: I19db315d163a870c92215fba78f1551f025dc5d3 --- .../settings/applications/RecentAppsPreferenceController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/applications/RecentAppsPreferenceController.java b/src/com/android/settings/applications/RecentAppsPreferenceController.java index c0d18c6eb81..be86dd5b63f 100644 --- a/src/com/android/settings/applications/RecentAppsPreferenceController.java +++ b/src/com/android/settings/applications/RecentAppsPreferenceController.java @@ -25,6 +25,7 @@ import android.app.usage.UsageStatsManager; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; +import android.icu.text.RelativeDateTimeFormatter; import android.os.PowerManager; import android.os.UserHandle; import android.util.ArrayMap; @@ -224,7 +225,8 @@ public class RecentAppsPreferenceController extends BasePreferenceController .setIcon(mIconDrawableFactory.getBadgedIcon(appEntry.info)) .setTitle(appEntry.label) .setSummary(StringUtil.formatRelativeTime(mContext, - System.currentTimeMillis() - stat.getLastTimeUsed(), false)) + System.currentTimeMillis() - stat.getLastTimeUsed(), false, + RelativeDateTimeFormatter.Style.SHORT)) .setOnClickListener(v -> AppInfoBase.startAppInfoFragment(AppInfoDashboardFragment.class, R.string.application_info_label, pkgName, appEntry.info.uid, From 236660590004487d65849ed44e4431cb038c42a0 Mon Sep 17 00:00:00 2001 From: Hai Shalom Date: Thu, 7 Mar 2019 15:54:25 -0800 Subject: [PATCH 02/20] [Wi-Fi] Do not delete certs when forgetting network Deleting EAP Wi-Fi configuration deletes shared credentials used by other configs. To resolve this issue the following changes were implemented: 1. When manually adding Wi-Fi certs from storage, Wi-Fi will not attempt to delete them when network is removed. 2. When apps use WifiEnterpriseConfig#setClientKeyEntry to add certs, they will be deleted if the network is removed. 3. Allow the user to delete Wi-Fi certs the same way that allows the user to add them. Make the "Remove" option available, and implement key store removal in settings. Bug: 30248175 Test: atest WifiEnterpriseConfigTest Test: Load certs, remove certs from credentials menu Test: Load cert, create 2 EAP networks that use it, forget one network Change-Id: I2015207d51188821da3397e1947e5eb6aefbf6e1 --- .../settings/UserCredentialsSettings.java | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/src/com/android/settings/UserCredentialsSettings.java b/src/com/android/settings/UserCredentialsSettings.java index c30e51df668..d322819ba98 100644 --- a/src/com/android/settings/UserCredentialsSettings.java +++ b/src/com/android/settings/UserCredentialsSettings.java @@ -154,11 +154,15 @@ public class UserCredentialsSettings extends SettingsPreferenceFragment dialog.dismiss(); } }; - if (item.isSystem()) { - // TODO: a safe means of clearing wifi certificates. Configs refer to aliases - // directly so deleting certs will break dependent access points. - builder.setNegativeButton(R.string.trusted_credentials_remove_label, listener); - } + // TODO: b/127865361 + // a safe means of clearing wifi certificates. Configs refer to aliases + // directly so deleting certs will break dependent access points. + // However, Wi-Fi used to remove this certificate from storage if the network + // was removed, regardless if it is used in more than one network. + // It has been decided to allow removing certificates from this menu, as we + // assume that the user who manually adds certificates must have a way to + // manually remove them. + builder.setNegativeButton(R.string.trusted_credentials_remove_label, listener); } return builder.create(); } @@ -172,7 +176,8 @@ public class UserCredentialsSettings extends SettingsPreferenceFragment * Deletes all certificates and keys under a given alias. * * If the {@link Credential} is for a system alias, all active grants to the alias will be - * removed using {@link KeyChain}. + * removed using {@link KeyChain}. If the {@link Credential} is for Wi-Fi alias, all + * credentials and keys will be removed using {@link KeyStore}. */ private class RemoveCredentialsTask extends AsyncTask { private Context context; @@ -188,14 +193,32 @@ public class UserCredentialsSettings extends SettingsPreferenceFragment for (final Credential credential : credentials) { if (credential.isSystem()) { removeGrantsAndDelete(credential); - continue; + } else { + deleteWifiCredential(credential); } - throw new UnsupportedOperationException( - "Not implemented for wifi certificates. This should not be reachable."); } return credentials; } + private void deleteWifiCredential(final Credential credential) { + final KeyStore keyStore = KeyStore.getInstance(); + final EnumSet storedTypes = credential.getStoredTypes(); + + // Remove all Wi-Fi credentials + if (storedTypes.contains(Credential.Type.USER_KEY)) { + keyStore.delete(Credentials.USER_PRIVATE_KEY + credential.getAlias(), + Process.WIFI_UID); + } + if (storedTypes.contains(Credential.Type.USER_CERTIFICATE)) { + keyStore.delete(Credentials.USER_CERTIFICATE + credential.getAlias(), + Process.WIFI_UID); + } + if (storedTypes.contains(Credential.Type.CA_CERTIFICATE)) { + keyStore.delete(Credentials.CA_CERTIFICATE + credential.getAlias(), + Process.WIFI_UID); + } + } + private void removeGrantsAndDelete(final Credential credential) { final KeyChainConnection conn; try { @@ -488,5 +511,11 @@ public class UserCredentialsSettings extends SettingsPreferenceFragment public boolean isSystem() { return UserHandle.getAppId(uid) == Process.SYSTEM_UID; } + + public String getAlias() { return alias; } + + public EnumSet getStoredTypes() { + return storedTypes; + } } } From 8bff9c3501c108be74783939a8fbf601428ca333 Mon Sep 17 00:00:00 2001 From: Brad Ebinger Date: Mon, 11 Mar 2019 17:33:53 -0700 Subject: [PATCH 03/20] Do not show Provisioning items for IMS if it is not enabled. Do not show IMS related items if FEATURE_TELEPHONY_IMS is not defined for this device. Bug: 118823723 Test: manual Merged-In: I9624535fe766cd79eadb30502c1a0574650a02ef Change-Id: I9624535fe766cd79eadb30502c1a0574650a02ef --- src/com/android/settings/RadioInfo.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java index 6276b19db46..8da507bdba4 100644 --- a/src/com/android/settings/RadioInfo.java +++ b/src/com/android/settings/RadioInfo.java @@ -455,6 +455,13 @@ public class RadioInfo extends Activity { imsWfcProvisionedSwitch = (Switch) findViewById(R.id.wfc_provisioned_switch); eabProvisionedSwitch = (Switch) findViewById(R.id.eab_provisioned_switch); + if (!ImsManager.isImsSupportedOnDevice(phone.getContext())) { + imsVolteProvisionedSwitch.setVisibility(View.GONE); + imsVtProvisionedSwitch.setVisibility(View.GONE); + imsWfcProvisionedSwitch.setVisibility(View.GONE); + eabProvisionedSwitch.setVisibility(View.GONE); + } + radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power); mDownlinkKbps = (TextView) findViewById(R.id.dl_kbps); @@ -604,8 +611,10 @@ public class RadioInfo extends Activity { R.string.radioInfo_menu_viewFDN).setOnMenuItemClickListener(mViewFDNCallback); menu.add(1, MENU_ITEM_VIEW_SDN, 0, R.string.radioInfo_menu_viewSDN).setOnMenuItemClickListener(mViewSDNCallback); - menu.add(1, MENU_ITEM_GET_IMS_STATUS, - 0, R.string.radioInfo_menu_getIMS).setOnMenuItemClickListener(mGetImsStatus); + if (ImsManager.isImsSupportedOnDevice(phone.getContext())) { + menu.add(1, MENU_ITEM_GET_IMS_STATUS, + 0, R.string.radioInfo_menu_getIMS).setOnMenuItemClickListener(mGetImsStatus); + } menu.add(1, MENU_ITEM_TOGGLE_DATA, 0, R.string.radio_info_data_connection_disable).setOnMenuItemClickListener(mToggleData); return true; @@ -1357,6 +1366,9 @@ public class RadioInfo extends Activity { } private void updateImsProvisionedState() { + if (!ImsManager.isImsSupportedOnDevice(phone.getContext())) { + return; + } log("updateImsProvisionedState isImsVolteProvisioned()=" + isImsVolteProvisioned()); //delightful hack to prevent on-checked-changed calls from //actually forcing the ims provisioning to its transient/current value. From e8e86e631a2554d7b019b8fae83cc9847d317ad7 Mon Sep 17 00:00:00 2001 From: Hunter Knepshield Date: Thu, 14 Mar 2019 15:04:36 -0700 Subject: [PATCH 04/20] [Strings + layout] Minor changes for eSIM erase. 1. String changes (uniform on both screens now) 2. Minor non-functional layout changes (margin is uniform now) Reset everything: https://screenshot.googleplex.com/OZsvOt36CZf Reset networks: https://screenshot.googleplex.com/in0vdOAeF7u Change-Id: I92d068c3731f6915c8d393d94ac8c25a3c8ed773 Fix: 119120504 Test: on device --- res/layout/master_clear.xml | 9 +++------ res/layout/reset_esim_checkbox.xml | 6 ++++-- res/layout/reset_network.xml | 5 +---- res/values/strings.xml | 12 +++--------- src/com/android/settings/MasterClear.java | 2 -- src/com/android/settings/ResetNetwork.java | 2 -- 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/res/layout/master_clear.xml b/res/layout/master_clear.xml index 9c1dd80ed05..63685881af0 100644 --- a/res/layout/master_clear.xml +++ b/res/layout/master_clear.xml @@ -127,12 +127,9 @@ android:text="@string/erase_external_storage_description"/> - + + + diff --git a/res/layout/reset_esim_checkbox.xml b/res/layout/reset_esim_checkbox.xml index 21954359959..77b90a182c2 100644 --- a/res/layout/reset_esim_checkbox.xml +++ b/res/layout/reset_esim_checkbox.xml @@ -15,7 +15,9 @@ --> + android:layout_height="wrap_content" + android:text="@string/reset_esim_title"/> - + diff --git a/res/values/strings.xml b/res/values/strings.xml index 2f338788153..f795d14cfa6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3581,10 +3581,10 @@ Reset Wi-Fi, mobile & Bluetooth This will reset all network settings, including:\n\n
  • Wi\u2011Fi
  • \n
  • Mobile data
  • \n
  • Bluetooth
  • "
    - - Also reset eSIM + + Erase eSIMs - Erase all eSIMs on the phone. You\u2019ll have to contact your carrier to redownload your eSIMs. This will not cancel your mobile service plan. + You\u2019ll have to contact your carrier to download replacement eSIMs. This won\u2019t cancel any mobile service plans. Reset settings @@ -3633,12 +3633,6 @@ Erase all the data on the internal USB storage, such as music or photos Erase all the data on the SD card, such as music or photos - - Erase eSIM - - Erase all eSIMs on the phone. This will not cancel your mobile service plan. - - Erase all eSIMs on the tablet. This will not cancel your mobile service plan. Erase all data diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java index 58bc58c475b..c78115d13c5 100644 --- a/src/com/android/settings/MasterClear.java +++ b/src/com/android/settings/MasterClear.java @@ -326,8 +326,6 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL if (showWipeEuicc()) { if (showWipeEuiccCheckbox()) { - TextView title = mContentView.findViewById(R.id.erase_esim_title); - title.setText(R.string.erase_esim_storage); mEsimStorageContainer.setVisibility(View.VISIBLE); mEsimStorageContainer.setOnClickListener(new View.OnClickListener() { @Override diff --git a/src/com/android/settings/ResetNetwork.java b/src/com/android/settings/ResetNetwork.java index bd45f9bd3c3..5d7dd9994c6 100644 --- a/src/com/android/settings/ResetNetwork.java +++ b/src/com/android/settings/ResetNetwork.java @@ -213,8 +213,6 @@ public class ResetNetwork extends InstrumentedFragment { mInitiateButton.setOnClickListener(mInitiateListener); if (showEuiccSettings(getContext())) { mEsimContainer.setVisibility(View.VISIBLE); - TextView title = mContentView.findViewById(R.id.erase_esim_title); - title.setText(R.string.reset_esim_title); mEsimContainer.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { From da73f26923c3e454c10b174567105ee1c8673ed4 Mon Sep 17 00:00:00 2001 From: Hyundo Moon Date: Fri, 15 Mar 2019 14:03:31 +0900 Subject: [PATCH 05/20] Remove ControllerLink Bug: 128591619 Test: atest com.android.settings.notification.RemoteVolumePreferenceControllerTest atest CtsMediaTestCases:android.media.cts.MediaSessionTest; atest CtsMediaTestCases:android.media.cts.MediaControllerTest; atest CtsMediaTestCases:android.media.cts.MediaBrowserTest; atest CtsMediaTestCases:android.media.cts.MediaSessionManagerTest; Change-Id: I4a975f8a24aaa4e5beb54515f3319f9597b76eb5 --- .../RemoteVolumePreferenceControllerTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java index 1bf2fd81bb6..1e68de59684 100644 --- a/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/RemoteVolumePreferenceControllerTest.java @@ -23,7 +23,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.Context; -import android.media.session.ControllerLink; +import android.media.session.ISessionController; import android.media.session.MediaController; import android.media.session.MediaSession; import android.media.session.MediaSessionManager; @@ -51,9 +51,9 @@ public class RemoteVolumePreferenceControllerTest { @Mock private MediaController mMediaController; @Mock - private ControllerLink.ControllerStub mStub; + private ISessionController mStub; @Mock - private ControllerLink.ControllerStub mStub2; + private ISessionController mStub2; private MediaSession.Token mToken; private MediaSession.Token mToken2; private RemoteVolumePreferenceController mController; @@ -71,8 +71,8 @@ public class RemoteVolumePreferenceControllerTest { mActiveSessions.add(mMediaController); when(mMediaSessionManager.getActiveSessions(null)).thenReturn( mActiveSessions); - mToken = new MediaSession.Token(new ControllerLink(mStub)); - mToken2 = new MediaSession.Token(new ControllerLink(mStub2)); + mToken = new MediaSession.Token(mStub); + mToken2 = new MediaSession.Token(mStub2); mController = new RemoteVolumePreferenceController(mContext); mPlaybackInfo = new MediaController.PlaybackInfo( From 575a856709a44eabc7b16d901a2e0d6a2220c89f Mon Sep 17 00:00:00 2001 From: Beverly Date: Tue, 12 Mar 2019 13:09:33 -0400 Subject: [PATCH 06/20] Move WakeGestureScreenGestureSettings Test: robosettings tests Bug: 127955764 Change-Id: I058a960d6e51afd6e92b9a035993f6bfd91025b8 --- res/values/strings.xml | 2 - res/xml/security_lockscreen_settings.xml | 6 -- res/xml/wake_screen_gesture_settings.xml | 37 ----------- .../gestures/WakeScreenGestureSettings.java | 65 ------------------- .../WakeScreenGestureSettingsTest.java | 50 -------------- 5 files changed, 160 deletions(-) delete mode 100644 res/xml/wake_screen_gesture_settings.xml delete mode 100644 src/com/android/settings/gestures/WakeScreenGestureSettings.java delete mode 100644 tests/robotests/src/com/android/settings/gestures/WakeScreenGestureSettingsTest.java diff --git a/res/values/strings.xml b/res/values/strings.xml index 2f338788153..13c3695b97d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -9867,8 +9867,6 @@ Wake up display - - To check time, notifications, and other info, pick up your phone. diff --git a/res/xml/security_lockscreen_settings.xml b/res/xml/security_lockscreen_settings.xml index 6833922e964..611d33fee57 100644 --- a/res/xml/security_lockscreen_settings.xml +++ b/res/xml/security_lockscreen_settings.xml @@ -59,12 +59,6 @@ android:summary="@string/doze_always_on_summary" settings:controller="com.android.settings.display.AmbientDisplayAlwaysOnPreferenceController" /> - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/android/settings/gestures/WakeScreenGestureSettings.java b/src/com/android/settings/gestures/WakeScreenGestureSettings.java deleted file mode 100644 index b8a782ac95a..00000000000 --- a/src/com/android/settings/gestures/WakeScreenGestureSettings.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -package com.android.settings.gestures; - -import android.app.settings.SettingsEnums; -import android.content.Context; -import android.provider.SearchIndexableResource; - -import com.android.settings.R; -import com.android.settings.dashboard.DashboardFragment; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settingslib.search.SearchIndexable; - -import java.util.Arrays; -import java.util.List; - -@SearchIndexable -public class WakeScreenGestureSettings extends DashboardFragment { - - private static final String TAG = "WakeScreenGestureSettings"; - - public static final String PREF_KEY_SUGGESTION_COMPLETE = - "pref_wake_screen_gesture_suggestion_complete"; - - @Override - public int getMetricsCategory() { - return SettingsEnums.SETTINGS_GESTURE_WAKE_SCREEN; - } - - @Override - protected String getLogTag() { - return TAG; - } - - @Override - protected int getPreferenceScreenResId() { - return R.xml.wake_screen_gesture_settings; - } - - public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider() { - @Override - public List getXmlResourcesToIndex( - Context context, boolean enabled) { - final SearchIndexableResource sir = new SearchIndexableResource(context); - sir.xmlResId = R.xml.wake_screen_gesture_settings; - return Arrays.asList(sir); - } - }; - -} diff --git a/tests/robotests/src/com/android/settings/gestures/WakeScreenGestureSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/WakeScreenGestureSettingsTest.java deleted file mode 100644 index f1d2fcc12d0..00000000000 --- a/tests/robotests/src/com/android/settings/gestures/WakeScreenGestureSettingsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ - -package com.android.settings.gestures; - -import static com.google.common.truth.Truth.assertThat; - -import android.provider.SearchIndexableResource; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.RuntimeEnvironment; - -import java.util.List; - -@RunWith(RobolectricTestRunner.class) -public class WakeScreenGestureSettingsTest { - - private WakeScreenGestureSettings mSettings; - - @Before - public void setUp() { - mSettings = new WakeScreenGestureSettings(); - } - - @Test - public void testSearchIndexProvider_shouldIndexResource() { - final List indexRes = - WakeScreenGestureSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex( - RuntimeEnvironment.application, true /* enabled */); - - assertThat(indexRes).isNotNull(); - assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId()); - } -} From 8533937220ab53d0db4231e610f10fc90e4d5db8 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Fri, 15 Mar 2019 15:03:27 -0700 Subject: [PATCH 07/20] Renamed NetworkRegistrationState to NetworkRegistrationInfo API review changes. The class covers more information other than registration state. Test: Build Bug: 127657991 Change-Id: I362bcd3e4bec91817081ddea2f822062b12c4207 --- .../settings/network/telephony/NetworkSelectSettings.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/network/telephony/NetworkSelectSettings.java b/src/com/android/settings/network/telephony/NetworkSelectSettings.java index d70bd62b4c3..47db8756998 100644 --- a/src/com/android/settings/network/telephony/NetworkSelectSettings.java +++ b/src/com/android/settings/network/telephony/NetworkSelectSettings.java @@ -27,7 +27,7 @@ import android.telephony.AccessNetworkConstants; import android.telephony.CarrierConfigManager; import android.telephony.CellIdentity; import android.telephony.CellInfo; -import android.telephony.NetworkRegistrationState; +import android.telephony.NetworkRegistrationInfo; import android.telephony.ServiceState; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; @@ -304,7 +304,7 @@ public class NetworkSelectSettings extends DashboardFragment { * Config the connected network operator preference when the page was created. When user get * into this page, the device might or might not have data connection. * - If the device has data: - * 1. use {@code ServiceState#getNetworkRegistrationStates()} to get the currently + * 1. use {@code ServiceState#getNetworkRegistrationInfoList()} to get the currently * registered cellIdentity, wrap it into a CellInfo; * 2. set the signal strength level as strong; * 3. use {@link TelephonyManager#getNetworkOperatorName()} to get the title of the @@ -317,8 +317,8 @@ public class NetworkSelectSettings extends DashboardFragment { if (mTelephonyManager.getDataState() == mTelephonyManager.DATA_CONNECTED) { // Try to get the network registration states ServiceState ss = mTelephonyManager.getServiceState(); - List networkList = - ss.getNetworkRegistrationStatesForTransportType( + List networkList = + ss.getNetworkRegistrationInfoListForTransportType( AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (networkList == null || networkList.size() == 0) { // Remove the connected network operators category From 5db43105e8f489482e60b3b12ebedf09ee732eaa Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Fri, 15 Mar 2019 15:10:16 -0700 Subject: [PATCH 08/20] Move a few classes around for easier ownership control Bug: 128547723 Test: rebuild Change-Id: I8f0dcf30fee44eaae60e10510620fb518cded68f --- res/xml/special_access.xml | 2 +- .../settings/applications/specialaccess/zenaccess/OWNERS | 2 ++ .../specialaccess/{ => zenaccess}/ZenAccessController.java | 2 +- .../specialaccess/{ => zenaccess}/ZenAccessControllerTest.java | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 src/com/android/settings/applications/specialaccess/zenaccess/OWNERS rename src/com/android/settings/applications/specialaccess/{ => zenaccess}/ZenAccessController.java (95%) rename tests/robotests/src/com/android/settings/applications/specialaccess/{ => zenaccess}/ZenAccessControllerTest.java (96%) diff --git a/res/xml/special_access.xml b/res/xml/special_access.xml index 05f4a81ef2a..9be01f9fd1c 100644 --- a/res/xml/special_access.xml +++ b/res/xml/special_access.xml @@ -53,7 +53,7 @@ android:key="zen_access" android:title="@string/manage_zen_access_title" android:fragment="com.android.settings.notification.ZenAccessSettings" - settings:controller="com.android.settings.applications.specialaccess.ZenAccessController" /> + settings:controller="com.android.settings.applications.specialaccess.zenaccess.ZenAccessController" /> Date: Mon, 18 Mar 2019 11:43:28 +0800 Subject: [PATCH 09/20] Fix color lint check error Test: We can upload CL. Change-Id: Iabe1d918a98167048b86dae1b61d450fb2e8bd97 --- color-check-baseline.xml | 632 ++++++++++++++++++++------------------- 1 file changed, 324 insertions(+), 308 deletions(-) diff --git a/color-check-baseline.xml b/color-check-baseline.xml index e9f8d58aec7..70744814dc2 100644 --- a/color-check-baseline.xml +++ b/color-check-baseline.xml @@ -29,54 +29,6 @@ column="9"/> - - - - - - - - - - - - - - - - + errorLine1=" <color name="crypt_keeper_clock_background">#ff9a9a9a</color>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + errorLine1=" <color name="crypt_keeper_clock_foreground">#ff666666</color>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + + + + + errorLine1=" <color name="crypt_keeper_password_background">#70606060</color>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + errorLine1=" <color name="divider_color">#20ffffff</color>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> - - - - - - - - - - - - - - - - @@ -345,7 +233,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -361,7 +249,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -377,7 +265,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -393,7 +281,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -409,7 +297,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -425,7 +313,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -441,7 +329,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -457,7 +345,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -473,7 +361,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -489,7 +377,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -505,7 +393,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -521,7 +409,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -537,7 +425,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -553,7 +441,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -569,7 +457,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -585,7 +473,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -597,11 +485,11 @@ priority="4" summary="Using hardcoded color" explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes. This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app." - errorLine1=" <color name="switch_bar_background">#ff80868B</color>" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + errorLine1=" <color name="switch_bar_background">#757575</color>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -617,7 +505,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -633,7 +521,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -649,7 +537,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -665,7 +553,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -681,7 +569,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -697,7 +585,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -713,7 +601,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -729,7 +617,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -745,7 +633,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -761,7 +649,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -777,7 +665,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -793,7 +681,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -809,7 +697,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -825,7 +713,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -841,7 +729,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -857,7 +745,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -873,7 +761,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -889,7 +777,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -905,7 +793,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -921,7 +809,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -937,7 +825,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -953,7 +841,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -969,7 +857,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -985,7 +873,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1001,7 +889,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1017,7 +905,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1033,7 +921,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1049,7 +937,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1065,7 +953,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1081,7 +969,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1097,7 +985,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1113,7 +1001,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1129,7 +1017,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1145,7 +1033,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1161,7 +1049,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1177,7 +1065,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1193,7 +1081,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1209,7 +1097,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1225,7 +1113,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1241,7 +1129,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1257,7 +1145,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1273,7 +1161,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1289,7 +1177,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1305,7 +1193,55 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + + + + + + + + + + + + @@ -1321,7 +1257,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1337,7 +1273,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1353,7 +1289,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1369,7 +1305,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -1653,12 +1589,12 @@ priority="4" summary="Using hardcoded color" explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes. This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app." - errorLine1=" android:color="@color/homepage_about_background" />" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + errorLine1=" android:color="@color/homepage_about_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_accessibility_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_accessibility_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_accounts_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_app_and_notification_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_battery_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_connected_device_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_display_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> - - - - + errorLine1=" android:color="@color/homepage_location_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_network_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_privacy_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_security_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_sound_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_storage_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_support_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_support_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + line="24" + column="13"/> + errorLine1=" android:color="@color/homepage_system_background" />" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + + + + + + + + + + + + + + + + + + + + + + + + @@ -2437,12 +2453,12 @@ priority="4" summary="Using hardcoded color" explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes. This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app." - errorLine1=" <string name="sync_plug" msgid="3905078969081888738">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‎‏‏‎‎‎‏‏‎‎‎‏‏‎‏‎‎‎‎‎‏‎‏‎‎‎‎‏‏‏‏‎‎‎‏‏‏‏‏‏‏‎‎‏‎‏‏‏‏‏‏‏‏‏‏‎‎‎‏‎‎‎‏‎‎‏‏‎"<font fgcolor="#ffffffff">"‎‏‎‎‏‏‏‎Welcome to Google sync!‎‏‎‎‏‏‎"</font>"‎‏‎‎‏‏‏‎ ‎‏‎‎‏‏‎\n‎‏‎‎‏‏‏‎A Google approach to syncing data to allow access to your contacts, appointments, and more from wherever you are.‎‏‎‎‏‎"</string>" - errorLine2=" ~~~~~~~~~~~~~~~~~~~"> + errorLine1=" <string name="sync_plug" msgid="3905078969081888738">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‎‏‏‎‎‎‏‏‎‎‎‏‏‎‏‎‎‎‎‎‏‎‏‎‎‎‎‏‏‏‏‎‎‎‏‏‏‏‏‏‏‎‎‏‎‏‏‏‏‏‏‏‏‏‏‎‎‎‏‎‎‎‏‎‎‏‏‎"<font fgcolor="#ffffffff">"‎‏‎‎‏‏‏‎Welcome to Google sync!‎‏‎‎‏‏‎"</font>"‎‏‎‎‏‏‏‎ ‎‏‎‎‏‏‎\n‎‏‎‎‏‏‏‎A Google approach to syncing data to allow access to your contacts, appointments, and more from wherever you are.‎‏‎‎‏‎"</string>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~"> + line="2580" + column="169"/> @@ -2473,7 +2489,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~"> @@ -2489,7 +2505,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~"> @@ -2505,7 +2521,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~"> @@ -2521,7 +2537,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~"> @@ -2537,7 +2553,7 @@ errorLine2=" ^"> @@ -2553,7 +2569,7 @@ errorLine2=" ^"> @@ -2569,7 +2585,7 @@ errorLine2=" ^"> @@ -2585,7 +2601,7 @@ errorLine2=" ^"> @@ -2601,7 +2617,7 @@ errorLine2=" ^"> @@ -2729,7 +2745,7 @@ errorLine2=" ^"> @@ -2745,7 +2761,7 @@ errorLine2=" ^"> @@ -2761,7 +2777,7 @@ errorLine2=" ^"> @@ -2777,7 +2793,7 @@ errorLine2=" ^"> @@ -2793,7 +2809,7 @@ errorLine2=" ^"> @@ -2809,7 +2825,7 @@ errorLine2=" ^"> @@ -2825,7 +2841,7 @@ errorLine2=" ^"> From a4fa5bc212390e6c4aadd42321c4b5e692d09294 Mon Sep 17 00:00:00 2001 From: Raff Tsai Date: Mon, 18 Mar 2019 12:29:39 +0800 Subject: [PATCH 10/20] Log contextual card event to CURRENT user Fixes: 128804262 Test: Robolectric. Manual Change-Id: I6e7cffe0773572025beb3ab7964cc18da49681c2 --- .../contextualcards/ContextualCardFeatureProviderImpl.java | 2 +- .../ContextualCardFeatureProviderImplTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java b/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java index 43e90e8cf28..ce7777a5e5b 100644 --- a/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java +++ b/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java @@ -139,7 +139,7 @@ public class ContextualCardFeatureProviderImpl implements ContextualCardFeatureP final String action = mContext.getString(R.string.config_settingsintelligence_log_action); if (!TextUtils.isEmpty(action)) { intent.setAction(action); - mContext.sendBroadcastAsUser(intent, UserHandle.ALL); + mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT); } } diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImplTest.java index 2db7f3fcb21..0683bd88bef 100644 --- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImplTest.java +++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImplTest.java @@ -57,7 +57,7 @@ public class ContextualCardFeatureProviderImplTest { final Intent intent = new Intent(); mImpl.sendBroadcast(intent); - verify(mContext, never()).sendBroadcastAsUser(intent, UserHandle.ALL); + verify(mContext, never()).sendBroadcastAsUser(intent, UserHandle.CURRENT); } @Test @@ -66,7 +66,7 @@ public class ContextualCardFeatureProviderImplTest { final Intent intent = new Intent(); mImpl.sendBroadcast(intent); - verify(mContext).sendBroadcastAsUser(intent, UserHandle.ALL); + verify(mContext).sendBroadcastAsUser(intent, UserHandle.CURRENT); } @Test From 3ef480e8957487ba547db5c1f480bfac1a9d356c Mon Sep 17 00:00:00 2001 From: Sunny Shao Date: Mon, 18 Mar 2019 11:52:35 +0800 Subject: [PATCH 11/20] Update the expand more icon in the condition - Rollback the color from accent to gray. - Use the "ic_expand_more_inverse.xml" to replace the "expand more" icon. Fixes: 126926489 Test: manual Change-Id: I438a03f42987001de7dce5040dd01347c2c6a9b0 --- res/layout/homepage_condition_footer.xml | 3 +-- res/layout/homepage_condition_header.xml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/res/layout/homepage_condition_footer.xml b/res/layout/homepage_condition_footer.xml index cc84f524a26..56687fe4b04 100644 --- a/res/layout/homepage_condition_footer.xml +++ b/res/layout/homepage_condition_footer.xml @@ -29,7 +29,6 @@ android:id="@+id/collapse_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:src="@drawable/ic_expand_less" - android:tint="?android:attr/colorAccent"/> + android:src="@drawable/ic_expand_less"/> \ No newline at end of file diff --git a/res/layout/homepage_condition_header.xml b/res/layout/homepage_condition_header.xml index 5c1b1812c4a..5460be95adc 100644 --- a/res/layout/homepage_condition_header.xml +++ b/res/layout/homepage_condition_header.xml @@ -45,8 +45,8 @@ android:paddingTop="@dimen/homepage_condition_header_indicator_padding_top" android:paddingStart="@dimen/homepage_condition_header_indicator_padding_start" android:paddingEnd="@dimen/homepage_condition_header_indicator_padding_end" - android:src="@*android:drawable/ic_expand_more" - android:tint="?android:attr/colorAccent"/> + android:src="@drawable/ic_expand_more_inverse" + android:tint="?android:attr/colorControlNormal"/> From 062d4acf457129e3c00cf65fa17a6281f2c471b4 Mon Sep 17 00:00:00 2001 From: tmfang Date: Sat, 9 Mar 2019 13:53:02 +0800 Subject: [PATCH 12/20] Fix crash on AppInfo screen We start a search page with a request code which is same as "uninstall" request code. The root cause is we handle same reuqest code for different event. We redefine an unique request code for "search" feature. Fixes: 124775813 Test: Click search and back to App info screen. Change-Id: I8ab21c30b605bcb65b6d4bd9fceb749a65a49f80 --- src/com/android/settings/search/SearchFeatureProvider.java | 2 +- .../settings/search/actionbar/SearchMenuController.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/search/SearchFeatureProvider.java b/src/com/android/settings/search/SearchFeatureProvider.java index dcb4acc5d92..896f6e5c78c 100644 --- a/src/com/android/settings/search/SearchFeatureProvider.java +++ b/src/com/android/settings/search/SearchFeatureProvider.java @@ -39,7 +39,7 @@ import com.android.settingslib.search.SearchIndexableResources; */ public interface SearchFeatureProvider { - int REQUEST_CODE = 0; + int REQUEST_CODE = 501; /** * Ensures the caller has necessary privilege to launch search result page. diff --git a/src/com/android/settings/search/actionbar/SearchMenuController.java b/src/com/android/settings/search/actionbar/SearchMenuController.java index af7141e54f1..25d0d3027d5 100644 --- a/src/com/android/settings/search/actionbar/SearchMenuController.java +++ b/src/com/android/settings/search/actionbar/SearchMenuController.java @@ -33,6 +33,7 @@ import com.android.settings.Utils; import com.android.settings.core.InstrumentedFragment; import com.android.settings.core.InstrumentedPreferenceFragment; import com.android.settings.overlay.FeatureFactory; +import com.android.settings.search.SearchFeatureProvider; import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.events.OnCreateOptionsMenu; @@ -93,7 +94,7 @@ public class SearchMenuController implements LifecycleObserver, OnCreateOptionsM FeatureFactory.getFactory(context).getMetricsFeatureProvider() .action(context, SettingsEnums.ACTION_SEARCH_RESULTS); - mHost.startActivityForResult(intent, 0 /* requestCode */); + mHost.startActivityForResult(intent, SearchFeatureProvider.REQUEST_CODE); return true; }); } From 4e42f53896a7e3d5da29b09bec844ec69e260479 Mon Sep 17 00:00:00 2001 From: Jason Chiu Date: Thu, 7 Mar 2019 17:42:39 +0800 Subject: [PATCH 13/20] Fix the bug of "Connecting" is rarely appearing on Wi-Fi slice - AccessPoint treats connected and connecting as equal so slice doesn't refresh in this case - Add a new method to determine if two lists are the same in SliceBackgroundWorker - WifiScanWorker overrides this method to check the access point states Fixes: 123941320 Test: robotest Change-Id: I78d610da4b6b1d40f5785ba6701fb71b987fe31c --- .../slices/SliceBackgroundWorker.java | 6 ++- .../settings/wifi/slice/WifiSlice.java | 37 +++++++++++++++- .../settings/wifi/slice/WifiSliceTest.java | 42 +++++++++++++++++-- 3 files changed, 78 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/slices/SliceBackgroundWorker.java b/src/com/android/settings/slices/SliceBackgroundWorker.java index 559aa711e2a..f19b1df79d3 100644 --- a/src/com/android/settings/slices/SliceBackgroundWorker.java +++ b/src/com/android/settings/slices/SliceBackgroundWorker.java @@ -146,7 +146,7 @@ public abstract class SliceBackgroundWorker implements Closeable { needNotify = true; } } else { - needNotify = !results.equals(mCachedResults); + needNotify = !areListsTheSame(results, mCachedResults); } if (needNotify) { @@ -155,6 +155,10 @@ public abstract class SliceBackgroundWorker implements Closeable { } } + protected boolean areListsTheSame(List a, List b) { + return a.equals(b); + } + /** * Notify that data was updated and attempt to sync changes to the Slice. */ diff --git a/src/com/android/settings/wifi/slice/WifiSlice.java b/src/com/android/settings/wifi/slice/WifiSlice.java index 8d20f7f847b..5b2fed4091c 100644 --- a/src/com/android/settings/wifi/slice/WifiSlice.java +++ b/src/com/android/settings/wifi/slice/WifiSlice.java @@ -32,6 +32,7 @@ import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.net.NetworkInfo; +import android.net.NetworkInfo.State; import android.net.Uri; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; @@ -355,7 +356,6 @@ public class WifiSlice implements CustomSliceable { @Override public void onConnectedChanged() { - notifySliceChange(); } @Override @@ -370,10 +370,43 @@ public class WifiSlice implements CustomSliceable { final List resultList = new ArrayList<>(); for (AccessPoint ap : accessPoints) { if (ap.isReachable()) { - resultList.add(ap); + resultList.add(clone(ap)); + if (resultList.size() >= DEFAULT_EXPANDED_ROW_COUNT) { + break; + } } } updateResults(resultList); } + + private AccessPoint clone(AccessPoint accessPoint) { + final Bundle savedState = new Bundle(); + accessPoint.saveWifiState(savedState); + return new AccessPoint(mContext, savedState); + } + + @Override + protected boolean areListsTheSame(List a, List b) { + if (!a.equals(b)) { + return false; + } + + // compare access point states one by one + final int listSize = a.size(); + for (int i = 0; i < listSize; i++) { + if (getState(a.get(i)) != getState(b.get(i))) { + return false; + } + } + return true; + } + + private State getState(AccessPoint accessPoint) { + final NetworkInfo networkInfo = accessPoint.getNetworkInfo(); + if (networkInfo != null) { + return networkInfo.getState(); + } + return null; + } } } diff --git a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java index 01feb8ecaed..75a9e117739 100644 --- a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java +++ b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java @@ -34,8 +34,10 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.net.NetworkInfo; +import android.net.NetworkInfo.State; import android.net.Uri; import android.net.wifi.WifiManager; +import android.os.Bundle; import androidx.core.graphics.drawable.IconCompat; import androidx.slice.Slice; @@ -61,6 +63,7 @@ import org.robolectric.annotation.Implementation; import org.robolectric.annotation.Implements; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; @RunWith(RobolectricTestRunner.class) @@ -253,11 +256,42 @@ public class WifiSliceTest { verify(mResolver).notifyChange(WIFI_SLICE_URI, null); } - @Test - public void onConnectedChanged_shouldNotifyChange() { - mWifiScanWorker.onConnectedChanged(); + private AccessPoint createAccessPoint(String name, State state) { + final NetworkInfo info = mock(NetworkInfo.class); + doReturn(state).when(info).getState(); - verify(mResolver).notifyChange(WIFI_SLICE_URI, null); + final Bundle savedState = new Bundle(); + savedState.putString("key_ssid", name); + savedState.putParcelable("key_networkinfo", info); + return new AccessPoint(mContext, savedState); + } + + @Test + public void SliceAccessPoint_sameState_shouldBeTheSame() { + final AccessPoint ap1 = createAccessPoint(AP1_NAME, State.CONNECTED); + final AccessPoint ap2 = createAccessPoint(AP1_NAME, State.CONNECTED); + + assertThat(mWifiScanWorker.areListsTheSame(Arrays.asList(ap1), Arrays.asList(ap2))) + .isTrue(); + } + + @Test + public void SliceAccessPoint_differentState_shouldBeDifferent() { + final AccessPoint ap1 = createAccessPoint(AP1_NAME, State.CONNECTING); + final AccessPoint ap2 = createAccessPoint(AP1_NAME, State.CONNECTED); + + assertThat(mWifiScanWorker.areListsTheSame(Arrays.asList(ap1), Arrays.asList(ap2))) + .isFalse(); + } + @Test + public void SliceAccessPoint_differentLength_shouldBeDifferent() { + final AccessPoint ap1 = createAccessPoint(AP1_NAME, State.CONNECTED); + final AccessPoint ap2 = createAccessPoint(AP1_NAME, State.CONNECTED); + final List list = new ArrayList<>(); + list.add(ap1); + list.add(ap2); + + assertThat(mWifiScanWorker.areListsTheSame(list, Arrays.asList(ap1))).isFalse(); } @Implements(SliceBackgroundWorker.class) From 8f76b44410d27e96f4c1a3a780212e49b2d5df48 Mon Sep 17 00:00:00 2001 From: hughchen Date: Thu, 14 Mar 2019 11:29:32 +0800 Subject: [PATCH 14/20] Add null check for worker Add null check to avoid crash when worker cannot get through uri. Bug: 128492874 Test: make -j42 RunSettingsRoboTests Change-Id: I789ce0bfa98c0b0b145a8605c58c88a77eeb76a9 --- src/com/android/settings/media/MediaOutputSlice.java | 11 +++++++++-- .../android/settings/media/MediaOutputSliceTest.java | 7 +++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/media/MediaOutputSlice.java b/src/com/android/settings/media/MediaOutputSlice.java index 232986c45e0..e76bc88ae39 100644 --- a/src/com/android/settings/media/MediaOutputSlice.java +++ b/src/com/android/settings/media/MediaOutputSlice.java @@ -76,6 +76,11 @@ public class MediaOutputSlice implements CustomSliceable { return null; } + if (getWorker() == null) { + Log.d(TAG, "getSlice() Can not get worker through uri!"); + return null; + } + final List devices = getMediaDevices(); @ColorInt final int color = Utils.getColorAccentDefaultColor(mContext); @@ -115,13 +120,15 @@ public class MediaOutputSlice implements CustomSliceable { private MediaDeviceUpdateWorker getWorker() { if (mWorker == null) { mWorker = (MediaDeviceUpdateWorker) SliceBackgroundWorker.getInstance(getUri()); - mWorker.setPackageName(mPackageName); + if (mWorker != null) { + mWorker.setPackageName(mPackageName); + } } return mWorker; } private List getMediaDevices() { - List devices = getWorker().getMediaDevices(); + final List devices = getWorker().getMediaDevices(); return devices; } diff --git a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java index da0d85b5472..d26a458011a 100644 --- a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java +++ b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java @@ -93,6 +93,13 @@ public class MediaOutputSliceTest { mMediaOutputSlice.init(TEST_PACKAGE_NAME, mMediaDeviceUpdateWorker); } + @Test + public void getSlice_workerIsNull_shouldNotCrash() { + mMediaOutputSlice.init(TEST_PACKAGE_NAME, null); + + mMediaOutputSlice.getSlice(); + } + @Test public void getSlice_shouldHaveActiveDeviceName() { mDevices.clear(); From c7e094001dadc82e772c524c5704bb4923811f14 Mon Sep 17 00:00:00 2001 From: Sunny Shao Date: Mon, 18 Mar 2019 19:42:09 +0800 Subject: [PATCH 15/20] Handle the SQLiteDatabase already-closed problem Remove the database.close in code for handling the re-open an already-closed object:SQLiteDatabase problem. Bug: 124451874 Test: robotest Change-Id: Iff8c0bc5ea092d42cff0a40dfa4324a4de7c90bc --- src/com/android/settings/slices/SlicesIndexer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/com/android/settings/slices/SlicesIndexer.java b/src/com/android/settings/slices/SlicesIndexer.java index 1b3a25ef876..5f800471ba3 100644 --- a/src/com/android/settings/slices/SlicesIndexer.java +++ b/src/com/android/settings/slices/SlicesIndexer.java @@ -84,7 +84,6 @@ class SlicesIndexer implements Runnable { } finally { database.endTransaction(); } - database.close(); } @VisibleForTesting From 0f3049d4b74bdfe0a0d0894c4575360371b8cec5 Mon Sep 17 00:00:00 2001 From: Yanting Yang Date: Mon, 18 Mar 2019 20:58:53 +0800 Subject: [PATCH 16/20] Fix voice access issue on home page Bug: 128825246 Test: manual Change-Id: Icd9b31c195f44b11b97a30292de586483ea2e651 --- res/layout/homepage_slice_tile.xml | 1 + res/layout/settings_homepage_container.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/res/layout/homepage_slice_tile.xml b/res/layout/homepage_slice_tile.xml index e95129e6041..b2badf5ba51 100644 --- a/res/layout/homepage_slice_tile.xml +++ b/res/layout/homepage_slice_tile.xml @@ -32,6 +32,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:animateLayoutChanges="true" + android:importantForAccessibility="no" style="@style/SliceViewStyle"/> diff --git a/res/layout/settings_homepage_container.xml b/res/layout/settings_homepage_container.xml index 78a0278462c..9332463ea79 100644 --- a/res/layout/settings_homepage_container.xml +++ b/res/layout/settings_homepage_container.xml @@ -25,6 +25,7 @@ android:id="@+id/main_content_scrollable_container" android:layout_width="match_parent" android:layout_height="match_parent" + android:importantForAccessibility="no" app:layout_behavior="com.android.settings.widget.FloatingAppBarScrollingViewBehavior"> Date: Mon, 18 Mar 2019 14:58:53 +0000 Subject: [PATCH 17/20] Force LSKF in ConfirmCredential UI when pending escrow token exists Escrow tokens can only be activated by user confirming their LSKF, while ConfirmCredential allows both LSKF and biometrics by default. By requiring LSKF, it simplifies the DPC's flow of requesting the user to activate a pending escrow token. This change tweaks the ConfirmCredential UI to skip biometrics if pending token exists. Bug: 127377026 Bug: 76084679 Bug: 79547502 Test: manual Change-Id: Iee9b2d57d7f4de98e225b3aeff7cc35cc8e3d36a --- .../ConfirmDeviceCredentialActivity.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java index ec1e835755c..d3d5c499fe7 100644 --- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java +++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java @@ -198,7 +198,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { } else if (isManagedProfile && isInternalActivity() && !lockPatternUtils.isSeparateProfileChallengeEnabled(mUserId)) { mCredentialMode = CREDENTIAL_MANAGED; - if (isBiometricAllowed(effectiveUserId)) { + if (isBiometricAllowed(effectiveUserId, mUserId)) { showBiometricPrompt(bpBundle); launchedBiometric = true; } else { @@ -207,7 +207,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { } } else { mCredentialMode = CREDENTIAL_NORMAL; - if (isBiometricAllowed(effectiveUserId)) { + if (isBiometricAllowed(effectiveUserId, mUserId)) { // Don't need to check if biometrics / pin/pattern/pass are enrolled. It will go to // onAuthenticationError and do the right thing automatically. showBiometricPrompt(bpBundle); @@ -273,9 +273,10 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { return (disabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_BIOMETRICS) != 0; } - private boolean isBiometricAllowed(int effectiveUserId) { + private boolean isBiometricAllowed(int effectiveUserId, int realUserId) { return !isStrongAuthRequired(effectiveUserId) - && !isBiometricDisabledByAdmin(effectiveUserId); + && !isBiometricDisabledByAdmin(effectiveUserId) + && !mLockPatternUtils.hasPendingEscrowToken(realUserId); } private void showBiometricPrompt(Bundle bundle) { @@ -304,9 +305,18 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { private void showConfirmCredentials() { mCCLaunched = true; boolean launched = false; + // The only difference between CREDENTIAL_MANAGED and CREDENTIAL_NORMAL is that for + // CREDENTIAL_MANAGED, we launch the real confirm credential activity with an explicit + // but dummy challenge value (0L). This will result in ConfirmLockPassword calling + // verifyTiedProfileChallenge() (if it's a profile with unified challenge), due to the + // difference between ConfirmLockPassword.startVerifyPassword() and + // ConfirmLockPassword.startCheckPassword(). Calling verifyTiedProfileChallenge() here is + // necessary when this is part of the turning on work profile flow, because it forces + // unlocking the work profile even before the profile is running. + // TODO: Remove the duplication of checkPassword and verifyPassword in ConfirmLockPassword, + // LockPatternChecker and LockPatternUtils. verifyPassword should be the only API to use, + // which optionally accepts a challenge. if (mCredentialMode == CREDENTIAL_MANAGED) { - // We set the challenge as 0L, so it will force to unlock managed profile when it - // unlocks primary profile screen lock, by calling verifyTiedProfileChallenge() launched = mChooseLockSettingsHelper .launchConfirmationActivityWithExternalAndChallenge( 0 /* request code */, null /* title */, mTitle, mDetails, From 9d98344122d42cdcd71a097470e70c028674258e Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Thu, 14 Mar 2019 15:45:22 -0700 Subject: [PATCH 18/20] Disable draw overlay for most of Settings. Fixes: 120484087 Test: robotests Change-Id: I1f7c8e83bd5054525bde5ca35fac55b7c9586c7c --- .../appinfo/DrawOverlayDetails.java | 43 ++-------- .../core/HideNonSystemOverlayMixin.java | 64 +++++++++++++++ .../settings/core/SettingsBaseActivity.java | 3 +- .../notification/AppNotificationSettings.java | 15 ---- .../core/HideNonSystemOverlayMixinTest.java | 78 +++++++++++++++++++ 5 files changed, 148 insertions(+), 55 deletions(-) create mode 100644 src/com/android/settings/core/HideNonSystemOverlayMixin.java create mode 100644 tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java diff --git a/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java b/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java index d0b26a53328..0f90c69c9ae 100644 --- a/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java +++ b/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java @@ -15,22 +15,13 @@ */ package com.android.settings.applications.appinfo; -import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; - -import android.app.ActivityManager; import android.app.AppOpsManager; import android.app.settings.SettingsEnums; import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; import android.os.Bundle; -import android.provider.Settings; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.Window; -import android.view.WindowManager; import androidx.annotation.VisibleForTesting; import androidx.appcompat.app.AlertDialog; @@ -55,16 +46,11 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch"; private static final String LOG_TAG = "DrawOverlayDetails"; - private static final int[] APP_OPS_OP_CODE = { - AppOpsManager.OP_SYSTEM_ALERT_WINDOW - }; - // Use a bridge to get the overlay details but don't initialize it to connect with all state. // TODO: Break out this functionality into its own class. private AppStateOverlayBridge mOverlayBridge; private AppOpsManager mAppOpsManager; private SwitchPreference mSwitchPref; - private Intent mSettingsIntent; private OverlayState mOverlayState; @Override @@ -82,18 +68,15 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc // find preferences addPreferencesFromResource(R.xml.draw_overlay_permissions_details); - mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH); + mSwitchPref = findPreference(KEY_APP_OPS_SETTINGS_SWITCH); // install event listeners mSwitchPref.setOnPreferenceChangeListener(this); - - mSettingsIntent = new Intent(Intent.ACTION_MAIN) - .setAction(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); } // Override here so we don't have an empty screen @Override - public View onCreateView (LayoutInflater inflater, + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // if we don't have a package info, show a page saying this is unsupported @@ -103,21 +86,6 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc return super.onCreateView(inflater, container, savedInstanceState); } - @Override - public void onResume() { - super.onResume(); - getActivity().getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); - } - - @Override - public void onPause() { - super.onPause(); - Window window = getActivity().getWindow(); - WindowManager.LayoutParams attrs = window.getAttributes(); - attrs.privateFlags &= ~SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; - window.setAttributes(attrs); - } - @Override public void onDestroy() { super.onDestroy(); @@ -164,7 +132,9 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc @Override protected boolean refreshUi() { - if (mPackageInfo == null) return true; + if (mPackageInfo == null) { + return true; + } mOverlayState = mOverlayBridge.getOverlayInfo(mPackageName, mPackageInfo.applicationInfo.uid); @@ -174,9 +144,6 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc // you cannot ask a user to grant you a permission you did not have! mSwitchPref.setEnabled(mOverlayState.permissionDeclared && mOverlayState.controlEnabled); - ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent, - PackageManager.GET_META_DATA, mUserId); - return true; } diff --git a/src/com/android/settings/core/HideNonSystemOverlayMixin.java b/src/com/android/settings/core/HideNonSystemOverlayMixin.java new file mode 100644 index 00000000000..59cef3bea17 --- /dev/null +++ b/src/com/android/settings/core/HideNonSystemOverlayMixin.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2019 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.core; + +import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; + +import static androidx.lifecycle.Lifecycle.Event.ON_START; +import static androidx.lifecycle.Lifecycle.Event.ON_STOP; + +import android.app.Activity; +import android.view.Window; +import android.view.WindowManager; + +import androidx.lifecycle.LifecycleObserver; +import androidx.lifecycle.OnLifecycleEvent; + + +/** + * A mixin that adds window flag to prevent non-system overlays showing on top of Settings + * activities. + */ +public class HideNonSystemOverlayMixin implements LifecycleObserver { + + private final Activity mActivity; + + public HideNonSystemOverlayMixin(Activity activity) { + mActivity = activity; + } + + @OnLifecycleEvent(ON_START) + public void onStart() { + if (mActivity == null) { + return; + } + mActivity.getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); + android.util.EventLog.writeEvent(0x534e4554, "120484087", -1, ""); + } + + + @OnLifecycleEvent(ON_STOP) + public void onStop() { + if (mActivity == null) { + return; + } + final Window window = mActivity.getWindow(); + final WindowManager.LayoutParams attrs = window.getAttributes(); + attrs.privateFlags &= ~SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; + window.setAttributes(attrs); + } +} diff --git a/src/com/android/settings/core/SettingsBaseActivity.java b/src/com/android/settings/core/SettingsBaseActivity.java index 294e7542d90..cd1365404c8 100644 --- a/src/com/android/settings/core/SettingsBaseActivity.java +++ b/src/com/android/settings/core/SettingsBaseActivity.java @@ -32,7 +32,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; -import android.view.WindowManager.LayoutParams; import android.widget.Toolbar; import androidx.fragment.app.FragmentActivity; @@ -59,8 +58,8 @@ public class SettingsBaseActivity extends FragmentActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - final long startTime = System.currentTimeMillis(); + getLifecycle().addObserver(new HideNonSystemOverlayMixin(this)); final TypedArray theme = getTheme().obtainStyledAttributes(android.R.styleable.Theme); if (!theme.getBoolean(android.R.styleable.Theme_windowNoTitle, false)) { diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java index 5fd26a64c95..3ccca000406 100644 --- a/src/com/android/settings/notification/AppNotificationSettings.java +++ b/src/com/android/settings/notification/AppNotificationSettings.java @@ -16,8 +16,6 @@ package com.android.settings.notification; -import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; - import android.app.NotificationChannel; import android.app.NotificationChannelGroup; import android.app.settings.SettingsEnums; @@ -26,8 +24,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; -import android.view.Window; -import android.view.WindowManager; import androidx.preference.Preference; import androidx.preference.PreferenceCategory; @@ -88,8 +84,6 @@ public class AppNotificationSettings extends NotificationSettingsBase { public void onResume() { super.onResume(); - getActivity().getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); - if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null) { Log.w(TAG, "Missing package or uid or packageinfo"); finish(); @@ -123,15 +117,6 @@ public class AppNotificationSettings extends NotificationSettingsBase { updatePreferenceStates(); } - @Override - public void onPause() { - super.onPause(); - final Window window = getActivity().getWindow(); - final WindowManager.LayoutParams attrs = window.getAttributes(); - attrs.privateFlags &= ~SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; - window.setAttributes(attrs); - } - @Override protected String getLogTag() { return TAG; diff --git a/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java b/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java new file mode 100644 index 00000000000..579cba09c14 --- /dev/null +++ b/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2019 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.core; + +import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; + +import static com.google.common.truth.Truth.assertThat; + +import android.os.Bundle; +import android.view.WindowManager; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import com.android.settings.R; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.Robolectric; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.android.controller.ActivityController; + +@RunWith(RobolectricTestRunner.class) +public class HideNonSystemOverlayMixinTest { + + private ActivityController mActivityController; + + @Before + public void setUp() { + RuntimeEnvironment.application.setTheme(R.style.Theme_AppCompat); + mActivityController = Robolectric.buildActivity(TestActivity.class); + } + + @Test + public void startActivity_shouldHideNonSystemOverlay() { + mActivityController.setup(); + TestActivity activity = mActivityController.get(); + + // Activity start: HIDE_NON_SYSTEM_OVERLAY should be set. + final WindowManager.LayoutParams attrs = activity.getWindow().getAttributes(); + assertThat(attrs.privateFlags & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS) + .isNotEqualTo(0); + } + + @Test + public void stopActivity_shouldUnhideNonSystemOverlay() { + mActivityController.setup().stop(); + TestActivity activity = mActivityController.get(); + + final WindowManager.LayoutParams attrs = activity.getWindow().getAttributes(); + assertThat(attrs.privateFlags & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS) + .isEqualTo(0); + } + + public static class TestActivity extends AppCompatActivity { + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + getLifecycle().addObserver(new HideNonSystemOverlayMixin(this)); + } + } +} From ecb94f54663cd6b3b777744579e33c5c4e40031b Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 18 Mar 2019 15:07:09 -0700 Subject: [PATCH 19/20] Enable nav bar overlay when gestural nav is enabled and tune edge swipe width. Fixes: 128680874, 128711028 Test: Manual Change-Id: I371819c6f6206f2bbc8599c0b14b4da9b67a2e14 --- .../gestures/SystemNavigationPreferenceController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java index a11754efe18..e1be9d43f89 100644 --- a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java +++ b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java @@ -51,13 +51,15 @@ public abstract class SystemNavigationPreferenceController extends GesturePrefer private static final String ENABLE_ASSISTANT_GESTURE = "ENABLE_ASSISTANT_GESTURE"; private static final String PROTOTYPE_ENABLED = "prototype_enabled"; - private static final int EDGE_SENSITIVITY_WIDTH = 32; + private static final int EDGE_SENSITIVITY_WIDTH = 48; private static final String EDGE_SENSITIVITY_KEY = "quickstepcontroller_edge_width_sensitivity"; private static final String GESTURES_MATCH_MAP_OFF = "000000"; private static final String GESTURES_MATCH_MAP_ON = "071133"; private static final String GESTURES_MATCH_MAP_KEY = "quickstepcontroller_gesture_match_map"; + private static final String OVERLAY_NAVBAR_KEY = + "com.android.internal.experiment.navbar.default"; private static final String OVERLAY_NAVBAR_TYPE_INSET = "com.android.internal.experiment.navbar.type.inset"; private static final String OVERLAY_NAVBAR_TYPE_FLOATING = @@ -174,6 +176,7 @@ public abstract class SystemNavigationPreferenceController extends GesturePrefer .asInterface(ServiceManager.getService(Context.OVERLAY_SERVICE)); if (overlayManager != null) { try { + overlayManager.setEnabled(OVERLAY_NAVBAR_KEY, true, USER_SYSTEM); overlayManager.setEnabled(OVERLAY_NAVBAR_TYPE_FLOATING, false, USER_SYSTEM); overlayManager.setEnabled(OVERLAY_NAVBAR_TYPE_INSET, enable, USER_SYSTEM); } catch (RemoteException e) { From 7ba77ceadff702b2150185064014cebb86416406 Mon Sep 17 00:00:00 2001 From: Raff Tsai Date: Tue, 19 Mar 2019 07:19:20 +0800 Subject: [PATCH 20/20] Import statsdprotolite library to use atoms.proto Bug: 124701288 Test: rebuild Change-Id: I38ba80707f8b6cbf7d590d72f4f7fb937dc82a89 --- Android.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/Android.mk b/Android.mk index e385b340514..283575dfc01 100644 --- a/Android.mk +++ b/Android.mk @@ -49,6 +49,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ settings-contextual-card-protos-lite \ contextualcards \ settings-logtags \ + statsdprotolite \ zxing-core-1.7 LOCAL_PROGUARD_FLAG_FILES := proguard.flags