From e761b75cd0726f65ff065fb20202bec52d40a138 Mon Sep 17 00:00:00 2001 From: Joshua Mccloskey Date: Thu, 3 Mar 2022 07:53:16 +0000 Subject: [PATCH 1/9] Updated icon for reverse-landscape udpfs Test: Manual Fixes: 193709296 Change-Id: Ic2a7ee16032b5233832f601f18fac2304f2b0f70 --- res/layout-land/udfps_enroll_enrolling_land.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/layout-land/udfps_enroll_enrolling_land.xml b/res/layout-land/udfps_enroll_enrolling_land.xml index 7ccd396936b..776f8a9118c 100644 --- a/res/layout-land/udfps_enroll_enrolling_land.xml +++ b/res/layout-land/udfps_enroll_enrolling_land.xml @@ -61,10 +61,10 @@ style="@style/SudGlifIcon" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="?attr/sudGlifHeaderGravity" + android:scaleType="fitStart" android:layout_marginStart="0dp" android:layout_marginEnd="0dp" - android:src="@drawable/ic_fingerprint_header" /> + android:src="@drawable/ic_lock" /> Date: Thu, 3 Mar 2022 14:30:44 +0000 Subject: [PATCH 2/9] Change default USB configuration to a RestrictedPreference Test: manual with TestDPC and Settings DefaultUsbConfigurationPreferenceControllerTest Bug: 201519976 205996517 Change-Id: I1def7b37184d6d81f29a5e6e4793b92012dacd9b --- res/xml/development_settings.xml | 2 +- .../DefaultUsbConfigurationPreferenceController.java | 4 ++-- .../DefaultUsbConfigurationPreferenceControllerTest.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml index f29930c8bd4..46168e1e52c 100644 --- a/res/xml/development_settings.xml +++ b/res/xml/development_settings.xml @@ -297,7 +297,7 @@ android:title="@string/tethering_hardware_offload" android:summary="@string/tethering_hardware_offload_summary" /> - diff --git a/src/com/android/settings/development/DefaultUsbConfigurationPreferenceController.java b/src/com/android/settings/development/DefaultUsbConfigurationPreferenceController.java index 87ca40fbbe2..bbe46b37569 100644 --- a/src/com/android/settings/development/DefaultUsbConfigurationPreferenceController.java +++ b/src/com/android/settings/development/DefaultUsbConfigurationPreferenceController.java @@ -25,7 +25,7 @@ import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.settings.core.PreferenceControllerMixin; -import com.android.settingslib.RestrictedSwitchPreference; +import com.android.settingslib.RestrictedPreference; import com.android.settingslib.development.DeveloperOptionsPreferenceController; public class DefaultUsbConfigurationPreferenceController extends @@ -33,7 +33,7 @@ public class DefaultUsbConfigurationPreferenceController extends private static final String PREFERENCE_KEY = "default_usb_configuration"; - private RestrictedSwitchPreference mPreference; + private RestrictedPreference mPreference; public DefaultUsbConfigurationPreferenceController(Context context) { super(context); diff --git a/tests/robotests/src/com/android/settings/development/DefaultUsbConfigurationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/DefaultUsbConfigurationPreferenceControllerTest.java index c9b13e27a0c..a386473020a 100644 --- a/tests/robotests/src/com/android/settings/development/DefaultUsbConfigurationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/development/DefaultUsbConfigurationPreferenceControllerTest.java @@ -32,7 +32,7 @@ import android.os.UserHandle; import androidx.preference.PreferenceScreen; import com.android.settingslib.RestrictedLockUtils; -import com.android.settingslib.RestrictedSwitchPreference; +import com.android.settingslib.RestrictedPreference; import org.junit.Before; import org.junit.Test; @@ -48,7 +48,7 @@ public class DefaultUsbConfigurationPreferenceControllerTest { private static final ComponentName TEST_COMPONENT_NAME = new ComponentName("test", "test"); @Mock - private RestrictedSwitchPreference mPreference; + private RestrictedPreference mPreference; @Mock private PreferenceScreen mPreferenceScreen; @Mock From f15bebe6c32fc0c737454038b354349dd2e14559 Mon Sep 17 00:00:00 2001 From: Yuri Ufimtsev Date: Mon, 7 Mar 2022 09:20:57 +0000 Subject: [PATCH 3/9] Inject different User IDs into biometric utils Test: atest SettingsUnitTests Bug: 222217132 Change-Id: I7939d78817f53814d0f8fb4636231a4833fbe26a --- .../biometrics/BiometricNavigationUtils.java | 6 +++++- .../BiometricStatusPreferenceController.java | 2 +- .../CombinedBiometricStatusPreferenceController.java | 2 +- .../combination/CombinedBiometricStatusUtils.java | 6 +++--- .../face/FaceStatusPreferenceController.java | 2 +- .../settings/biometrics/face/FaceStatusUtils.java | 6 +++--- .../FingerprintStatusPreferenceController.java | 2 +- .../fingerprint/FingerprintStatusUtils.java | 7 ++++--- .../safetycenter/BiometricsSafetySource.java | 12 ++++++++---- .../biometrics/BiometricNavigationUtilsTest.java | 2 +- .../CombinedBiometricStatusUtilsTest.java | 6 ++++-- .../biometrics/face/FaceStatusUtilsTest.java | 5 +++-- .../fingerprint/FingerprintStatusUtilsTest.java | 5 +++-- 13 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/com/android/settings/biometrics/BiometricNavigationUtils.java b/src/com/android/settings/biometrics/BiometricNavigationUtils.java index b747fafa1da..32d3a328d95 100644 --- a/src/com/android/settings/biometrics/BiometricNavigationUtils.java +++ b/src/com/android/settings/biometrics/BiometricNavigationUtils.java @@ -37,7 +37,11 @@ import com.android.settingslib.transition.SettingsTransitionHelper; */ public class BiometricNavigationUtils { - private final int mUserId = UserHandle.myUserId(); + private final int mUserId; + + public BiometricNavigationUtils(int userId) { + mUserId = userId; + } /** * Tries to launch the Settings screen if Quiet Mode is not enabled diff --git a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java index 617529ffac4..f61f99c93f0 100644 --- a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java +++ b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java @@ -60,7 +60,7 @@ public abstract class BiometricStatusPreferenceController extends BasePreference .getSecurityFeatureProvider() .getLockPatternUtils(context); mProfileChallengeUserId = Utils.getManagedProfileId(mUm, mUserId); - mBiometricNavigationUtils = new BiometricNavigationUtils(); + mBiometricNavigationUtils = new BiometricNavigationUtils(getUserId()); } @Override diff --git a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java index 27e3ae7694b..ba09e5fbe6a 100644 --- a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java +++ b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java @@ -56,7 +56,7 @@ public class CombinedBiometricStatusPreferenceController extends public CombinedBiometricStatusPreferenceController( Context context, String key, Lifecycle lifecycle) { super(context, key); - mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(context); + mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(context, getUserId()); if (lifecycle != null) { lifecycle.addObserver(this); diff --git a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtils.java b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtils.java index a7554c8f378..f1e312a419c 100644 --- a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtils.java +++ b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtils.java @@ -20,7 +20,6 @@ import android.content.Context; import android.hardware.biometrics.BiometricAuthenticator; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; -import android.os.UserHandle; import androidx.annotation.Nullable; @@ -35,17 +34,18 @@ import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; */ public class CombinedBiometricStatusUtils { - private final int mUserId = UserHandle.myUserId(); + private final int mUserId; private final Context mContext; @Nullable FingerprintManager mFingerprintManager; @Nullable FaceManager mFaceManager; - public CombinedBiometricStatusUtils(Context context) { + public CombinedBiometricStatusUtils(Context context, int userId) { mContext = context; mFingerprintManager = Utils.getFingerprintManagerOrNull(context); mFaceManager = Utils.getFaceManagerOrNull(context); + mUserId = userId; } /** diff --git a/src/com/android/settings/biometrics/face/FaceStatusPreferenceController.java b/src/com/android/settings/biometrics/face/FaceStatusPreferenceController.java index cd0bc154a81..9b4b433237b 100644 --- a/src/com/android/settings/biometrics/face/FaceStatusPreferenceController.java +++ b/src/com/android/settings/biometrics/face/FaceStatusPreferenceController.java @@ -57,7 +57,7 @@ public class FaceStatusPreferenceController extends BiometricStatusPreferenceCon public FaceStatusPreferenceController(Context context, String key, Lifecycle lifecycle) { super(context, key); mFaceManager = Utils.getFaceManagerOrNull(context); - mFaceStatusUtils = new FaceStatusUtils(context, mFaceManager); + mFaceStatusUtils = new FaceStatusUtils(context, mFaceManager, getUserId()); if (lifecycle != null) { lifecycle.addObserver(this); diff --git a/src/com/android/settings/biometrics/face/FaceStatusUtils.java b/src/com/android/settings/biometrics/face/FaceStatusUtils.java index dd32708b3d7..4e255439a42 100644 --- a/src/com/android/settings/biometrics/face/FaceStatusUtils.java +++ b/src/com/android/settings/biometrics/face/FaceStatusUtils.java @@ -19,7 +19,6 @@ package com.android.settings.biometrics.face; import android.content.Context; import android.hardware.biometrics.BiometricAuthenticator; import android.hardware.face.FaceManager; -import android.os.UserHandle; import com.android.settings.R; import com.android.settings.Settings; @@ -32,13 +31,14 @@ import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; */ public class FaceStatusUtils { - private final int mUserId = UserHandle.myUserId(); + private final int mUserId; private final Context mContext; private final FaceManager mFaceManager; - public FaceStatusUtils(Context context, FaceManager faceManager) { + public FaceStatusUtils(Context context, FaceManager faceManager, int userId) { mContext = context; mFaceManager = faceManager; + mUserId = userId; } /** diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusPreferenceController.java b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusPreferenceController.java index 646af4da2a0..62edcf03974 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusPreferenceController.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusPreferenceController.java @@ -58,7 +58,7 @@ public class FingerprintStatusPreferenceController extends BiometricStatusPrefer super(context, key); mFingerprintManager = Utils.getFingerprintManagerOrNull(context); mFingerprintStatusUtils = - new FingerprintStatusUtils(context, mFingerprintManager); + new FingerprintStatusUtils(context, mFingerprintManager, getUserId()); if (lifecycle != null) { lifecycle.addObserver(this); diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java index 36edd2e1fd7..d23195d594c 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java @@ -19,7 +19,6 @@ package com.android.settings.biometrics.fingerprint; import android.content.Context; import android.hardware.biometrics.BiometricAuthenticator; import android.hardware.fingerprint.FingerprintManager; -import android.os.UserHandle; import com.android.settings.R; import com.android.settings.Utils; @@ -31,13 +30,15 @@ import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; */ public class FingerprintStatusUtils { - private final int mUserId = UserHandle.myUserId(); + private final int mUserId; private final Context mContext; private final FingerprintManager mFingerprintManager; - public FingerprintStatusUtils(Context context, FingerprintManager fingerprintManager) { + public FingerprintStatusUtils(Context context, FingerprintManager fingerprintManager, + int userId) { mContext = context; mFingerprintManager = fingerprintManager; + mUserId = userId; } /** diff --git a/src/com/android/settings/safetycenter/BiometricsSafetySource.java b/src/com/android/settings/safetycenter/BiometricsSafetySource.java index 59408c7328b..c302915cb91 100644 --- a/src/com/android/settings/safetycenter/BiometricsSafetySource.java +++ b/src/com/android/settings/safetycenter/BiometricsSafetySource.java @@ -22,6 +22,7 @@ import android.content.Intent; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; import android.os.Bundle; +import android.os.UserHandle; import android.safetycenter.SafetyEvent; import android.safetycenter.SafetySourceData; import android.safetycenter.SafetySourceStatus; @@ -47,9 +48,12 @@ public final class BiometricsSafetySource { return; } - final BiometricNavigationUtils biometricNavigationUtils = new BiometricNavigationUtils(); + final int userId = UserHandle.myUserId(); + + final BiometricNavigationUtils biometricNavigationUtils = new BiometricNavigationUtils( + userId); final CombinedBiometricStatusUtils combinedBiometricStatusUtils = - new CombinedBiometricStatusUtils(context); + new CombinedBiometricStatusUtils(context, userId); if (combinedBiometricStatusUtils.isAvailable()) { final RestrictedLockUtils.EnforcedAdmin disablingAdmin = @@ -66,7 +70,7 @@ public final class BiometricsSafetySource { } final FaceManager faceManager = Utils.getFaceManagerOrNull(context); - final FaceStatusUtils faceStatusUtils = new FaceStatusUtils(context, faceManager); + final FaceStatusUtils faceStatusUtils = new FaceStatusUtils(context, faceManager, userId); if (faceStatusUtils.isAvailable()) { final RestrictedLockUtils.EnforcedAdmin disablingAdmin = @@ -85,7 +89,7 @@ public final class BiometricsSafetySource { final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(context); final FingerprintStatusUtils fingerprintStatusUtils = new FingerprintStatusUtils(context, - fingerprintManager); + fingerprintManager, userId); if (fingerprintStatusUtils.isAvailable()) { final RestrictedLockUtils.EnforcedAdmin disablingAdmin = diff --git a/tests/unit/src/com/android/settings/biometrics/BiometricNavigationUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/BiometricNavigationUtilsTest.java index c767c32dec6..395f88fec2d 100644 --- a/tests/unit/src/com/android/settings/biometrics/BiometricNavigationUtilsTest.java +++ b/tests/unit/src/com/android/settings/biometrics/BiometricNavigationUtilsTest.java @@ -64,7 +64,7 @@ public class BiometricNavigationUtilsTest { mContext = spy(ApplicationProvider.getApplicationContext()); when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager); doNothing().when(mContext).startActivity(any()); - mBiometricNavigationUtils = new BiometricNavigationUtils(); + mBiometricNavigationUtils = new BiometricNavigationUtils(UserHandle.myUserId()); } @Test diff --git a/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java index 55b3fae5203..7d89079a017 100644 --- a/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java +++ b/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java @@ -56,7 +56,8 @@ public class CombinedBiometricStatusUtilsTest { private static final ComponentName COMPONENT_NAME = new ComponentName("package", "class"); - private static final UserHandle USER_HANDLE = new UserHandle(UserHandle.myUserId()); + private static final int USER_ID = UserHandle.myUserId(); + private static final UserHandle USER_HANDLE = new UserHandle(USER_ID);; @Mock @@ -85,7 +86,8 @@ public class CombinedBiometricStatusUtilsTest { when(mApplicationContext.getSystemService(Context.DEVICE_POLICY_SERVICE)) .thenReturn(mDevicePolicyManager); when(mApplicationContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager); - mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(mApplicationContext); + mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils( + mApplicationContext, USER_ID); } @Test diff --git a/tests/unit/src/com/android/settings/biometrics/face/FaceStatusUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/face/FaceStatusUtilsTest.java index f670fad280c..8697da73466 100644 --- a/tests/unit/src/com/android/settings/biometrics/face/FaceStatusUtilsTest.java +++ b/tests/unit/src/com/android/settings/biometrics/face/FaceStatusUtilsTest.java @@ -49,7 +49,8 @@ public class FaceStatusUtilsTest { private static final ComponentName COMPONENT_NAME = new ComponentName("package", "class"); - private static final UserHandle USER_HANDLE = new UserHandle(UserHandle.myUserId()); + private static final int USER_ID = UserHandle.myUserId(); + private static final UserHandle USER_HANDLE = new UserHandle(USER_ID); @Mock @@ -78,7 +79,7 @@ public class FaceStatusUtilsTest { when(mApplicationContext.getSystemService(Context.DEVICE_POLICY_SERVICE)) .thenReturn(mDevicePolicyManager); when(mApplicationContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager); - mFaceStatusUtils = new FaceStatusUtils(mApplicationContext, mFaceManager); + mFaceStatusUtils = new FaceStatusUtils(mApplicationContext, mFaceManager, USER_ID); } @Test diff --git a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java index b4abb5dc812..cbe42982155 100644 --- a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java +++ b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java @@ -52,7 +52,8 @@ public class FingerprintStatusUtilsTest { private static final ComponentName COMPONENT_NAME = new ComponentName("package", "class"); - private static final UserHandle USER_HANDLE = new UserHandle(UserHandle.myUserId()); + private static final int USER_ID = UserHandle.myUserId(); + private static final UserHandle USER_HANDLE = new UserHandle(USER_ID); @Mock @@ -82,7 +83,7 @@ public class FingerprintStatusUtilsTest { .thenReturn(mDevicePolicyManager); when(mApplicationContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager); mFingerprintStatusUtils = - new FingerprintStatusUtils(mApplicationContext, mFingerprintManager); + new FingerprintStatusUtils(mApplicationContext, mFingerprintManager, USER_ID); } @Test From b8c30c7c5d9e8adb0420dff68c8e39e953f92a52 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Fri, 4 Mar 2022 15:10:26 -0500 Subject: [PATCH 4/9] Add user button UX update Visually align all add user/guest icons between settings and systemui. Both areas may tint and size the icons slightly differently. Fixes: 219078700 Test: visual, use the multiple users settings page Change-Id: Ic88d5b2197f402f130d6cfeb94bdb2bb1b6aa58c --- res/values/colors.xml | 3 +++ res/values/dimens.xml | 1 + res/values/strings.xml | 2 +- res/xml/user_settings.xml | 2 -- .../android/settings/users/UserSettings.java | 27 ++++++++++++++++++- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/res/values/colors.xml b/res/values/colors.xml index fef8419300b..f972e2955b6 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -205,4 +205,7 @@ @*android:color/primary_text_default_material_light + + + ?androidprv:attr/colorSurface diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 4f2dd93a0f4..635bd820704 100755 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -134,6 +134,7 @@ 48dp 56dp 24dp + 20dp 8dp diff --git a/res/values/strings.xml b/res/values/strings.xml index d845dfd7f95..ba71503af87 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -13625,7 +13625,7 @@ Use print service - Use multiple users + Enable multiple users Use wireless debugging diff --git a/res/xml/user_settings.xml b/res/xml/user_settings.xml index d5e61d022ee..ab54989128b 100644 --- a/res/xml/user_settings.xml +++ b/res/xml/user_settings.xml @@ -40,13 +40,11 @@ Date: Mon, 7 Mar 2022 17:19:18 +0000 Subject: [PATCH 5/9] Minor bug fixes for Lockscreen Safety Center source - use correct severity enum for issues - update biomterics on lockscreen change - clean up some nearby tests to use eq matcher instead of captor Test: SettingsUnitTests Test: Manually tested Bug: 223170514 Bug: 222338885 Change-Id: I4e28a418473cbe7cd5d75daf0d62776654fa7917 --- .../safetycenter/LockScreenSafetySource.java | 6 ++- .../LockScreenSafetySourceTest.java | 40 +++++++++---------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/com/android/settings/safetycenter/LockScreenSafetySource.java b/src/com/android/settings/safetycenter/LockScreenSafetySource.java index ad0bd3a8de4..6cd7fa53f88 100644 --- a/src/com/android/settings/safetycenter/LockScreenSafetySource.java +++ b/src/com/android/settings/safetycenter/LockScreenSafetySource.java @@ -96,6 +96,10 @@ public final class LockScreenSafetySource { context, new ScreenLockPreferenceDetailsUtils(context, SettingsEnums.SAFETY_CENTER), new SafetyEvent.Builder(SAFETY_EVENT_TYPE_SOURCE_STATE_CHANGED).build()); + + // Also send refreshed safety center data for biometrics, since changing lockscreen settings + // can unset biometrics. + BiometricsSafetySource.onBiometricsChanged(context); } private static IconAction createGearMenuIconAction(Context context, @@ -126,7 +130,7 @@ public final class LockScreenSafetySource { NO_SCREEN_LOCK_ISSUE_ID, context.getString(R.string.no_screen_lock_issue_title), context.getString(R.string.no_screen_lock_issue_summary), - SafetySourceStatus.STATUS_LEVEL_RECOMMENDATION, + SafetySourceIssue.SEVERITY_LEVEL_RECOMMENDATION, NO_SCREEN_LOCK_ISSUE_TYPE_ID) .setIssueCategory(SafetySourceIssue.ISSUE_CATEGORY_DEVICE) .addAction(action).build(); diff --git a/tests/unit/src/com/android/settings/safetycenter/LockScreenSafetySourceTest.java b/tests/unit/src/com/android/settings/safetycenter/LockScreenSafetySourceTest.java index db2702d58b2..ea36b6b7725 100644 --- a/tests/unit/src/com/android/settings/safetycenter/LockScreenSafetySourceTest.java +++ b/tests/unit/src/com/android/settings/safetycenter/LockScreenSafetySourceTest.java @@ -22,6 +22,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -117,12 +118,9 @@ public class LockScreenSafetySourceTest { LockScreenSafetySource.setSafetySourceData(mApplicationContext, mScreenLockPreferenceDetailsUtils, EVENT_SOURCE_STATE_CHANGED); - ArgumentCaptor idCaptor = ArgumentCaptor.forClass(String.class); - verify(mSafetyCenterManagerWrapper).setSafetySourceData( - any(), idCaptor.capture(), any(), any()); - String safetySourceId = idCaptor.getValue(); - assertThat(safetySourceId).isEqualTo(LockScreenSafetySource.SAFETY_SOURCE_ID); + verify(mSafetyCenterManagerWrapper).setSafetySourceData( + any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), any(), any()); } @Test @@ -132,12 +130,9 @@ public class LockScreenSafetySourceTest { LockScreenSafetySource.setSafetySourceData(mApplicationContext, mScreenLockPreferenceDetailsUtils, EVENT_SOURCE_STATE_CHANGED); - ArgumentCaptor eventCaptor = ArgumentCaptor.forClass(SafetyEvent.class); - verify(mSafetyCenterManagerWrapper).setSafetySourceData( - any(), any(), any(), eventCaptor.capture()); - SafetyEvent safetyEvent = eventCaptor.getValue(); - assertThat(safetyEvent).isEqualTo(EVENT_SOURCE_STATE_CHANGED); + verify(mSafetyCenterManagerWrapper).setSafetySourceData( + any(), any(), any(), eq(EVENT_SOURCE_STATE_CHANGED)); } @Test @@ -176,7 +171,7 @@ public class LockScreenSafetySourceTest { ArgumentCaptor captor = ArgumentCaptor.forClass(SafetySourceData.class); verify(mSafetyCenterManagerWrapper).setSafetySourceData( - any(), any(), captor.capture(), any()); + any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any()); SafetySourceData safetySourceData = captor.getValue(); SafetySourceStatus safetySourceStatus = safetySourceData.getStatus(); @@ -195,7 +190,7 @@ public class LockScreenSafetySourceTest { ArgumentCaptor captor = ArgumentCaptor.forClass(SafetySourceData.class); verify(mSafetyCenterManagerWrapper).setSafetySourceData( - any(), any(), captor.capture(), any()); + any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any()); SafetySourceData safetySourceData = captor.getValue(); SafetySourceStatus safetySourceStatus = safetySourceData.getStatus(); @@ -221,7 +216,7 @@ public class LockScreenSafetySourceTest { } @Test - public void setSafetySourceData_whenLockPatternIsNotSecure_setIssue() { + public void setSafetySourceData_whenLockPatternIsNotSecure_setsIssue() { whenScreenLockIsEnabled(); when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(true); when(mScreenLockPreferenceDetailsUtils.isLockPatternSecure()).thenReturn(false); @@ -231,7 +226,7 @@ public class LockScreenSafetySourceTest { ArgumentCaptor captor = ArgumentCaptor.forClass(SafetySourceData.class); verify(mSafetyCenterManagerWrapper).setSafetySourceData( - any(), any(), captor.capture(), any()); + any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any()); SafetySourceData safetySourceData = captor.getValue(); assertThat(safetySourceData.getIssues()).hasSize(1); @@ -244,7 +239,7 @@ public class LockScreenSafetySourceTest { ResourcesUtils.getResourcesString(mApplicationContext, "no_screen_lock_issue_summary")); assertThat(issue.getSeverityLevel()).isEqualTo( - SafetySourceStatus.STATUS_LEVEL_RECOMMENDATION); + SafetySourceIssue.SEVERITY_LEVEL_RECOMMENDATION); assertThat(issue.getIssueTypeId()).isEqualTo( LockScreenSafetySource.NO_SCREEN_LOCK_ISSUE_TYPE_ID); assertThat(issue.getIssueCategory()).isEqualTo(SafetySourceIssue.ISSUE_CATEGORY_DEVICE); @@ -270,7 +265,7 @@ public class LockScreenSafetySourceTest { ArgumentCaptor captor = ArgumentCaptor.forClass(SafetySourceData.class); verify(mSafetyCenterManagerWrapper).setSafetySourceData( - any(), any(), captor.capture(), any()); + any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any()); SafetySourceData safetySourceData = captor.getValue(); SafetySourceStatus safetySourceStatus = safetySourceData.getStatus(); @@ -289,7 +284,7 @@ public class LockScreenSafetySourceTest { ArgumentCaptor captor = ArgumentCaptor.forClass(SafetySourceData.class); verify(mSafetyCenterManagerWrapper).setSafetySourceData( - any(), any(), captor.capture(), any()); + any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any()); SafetySourceData safetySourceData = captor.getValue(); SafetySourceStatus safetySourceStatus = safetySourceData.getStatus(); @@ -311,7 +306,7 @@ public class LockScreenSafetySourceTest { final ArgumentCaptor captor = ArgumentCaptor.forClass( SafetySourceData.class); verify(mSafetyCenterManagerWrapper).setSafetySourceData( - any(), any(), captor.capture(), any()); + any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any()); final IconAction iconAction = captor.getValue().getStatus().getIconAction(); assertThat(iconAction.getIconType()).isEqualTo(IconAction.ICON_TYPE_GEAR); @@ -330,7 +325,7 @@ public class LockScreenSafetySourceTest { ArgumentCaptor captor = ArgumentCaptor.forClass(SafetySourceData.class); verify(mSafetyCenterManagerWrapper).setSafetySourceData( - any(), any(), captor.capture(), any()); + any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any()); SafetySourceData safetySourceData = captor.getValue(); SafetySourceStatus safetySourceStatus = safetySourceData.getStatus(); @@ -338,13 +333,16 @@ public class LockScreenSafetySourceTest { } @Test - public void onLockScreenChange_whenSafetyCenterEnabled_setData() { + public void onLockScreenChange_whenSafetyCenterEnabled_setsLockscreenAndBiometricData() { whenScreenLockIsEnabled(); when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(true); LockScreenSafetySource.onLockScreenChange(mApplicationContext); - verify(mSafetyCenterManagerWrapper).setSafetySourceData(any(), any(), any(), any()); + verify(mSafetyCenterManagerWrapper).setSafetySourceData( + any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), any(), any()); + verify(mSafetyCenterManagerWrapper).setSafetySourceData( + any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), any(), any()); } @Test From b9b750fa60267c2ba69ae048be1ca2eeec709262 Mon Sep 17 00:00:00 2001 From: menghanli Date: Tue, 8 Mar 2022 07:34:50 +0800 Subject: [PATCH 6/9] Enable "Remove animation" assistive technologies in setup In Android T, adding more animations into SUW so want to make sure users can turn off animation if needed. The animation should also follow the flashing/strobing guidelines to ensure they're not seizure-inducing. Bug: 223265388 Test: Manual testing Change-Id: I8f443adddb6941ed6deae2f3b53d35f21ebcfd36 --- res/drawable/ic_accessibility_animation.xml | 36 +++++++++++++++++++ res/xml/accessibility_color_and_motion.xml | 1 + ...ccessibility_settings_for_setup_wizard.xml | 8 +++++ 3 files changed, 45 insertions(+) create mode 100644 res/drawable/ic_accessibility_animation.xml diff --git a/res/drawable/ic_accessibility_animation.xml b/res/drawable/ic_accessibility_animation.xml new file mode 100644 index 00000000000..13bc4a264dc --- /dev/null +++ b/res/drawable/ic_accessibility_animation.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/res/xml/accessibility_color_and_motion.xml b/res/xml/accessibility_color_and_motion.xml index 86b6564ff34..6b2d9a83e96 100644 --- a/res/xml/accessibility_color_and_motion.xml +++ b/res/xml/accessibility_color_and_motion.xml @@ -40,6 +40,7 @@ settings:controller="com.android.settings.accessibility.ColorInversionPreferenceController"/> + + From 652ba71605fb26623913593e1447e9a814c6a40c Mon Sep 17 00:00:00 2001 From: Sunny Shao Date: Tue, 8 Mar 2022 11:18:38 +0800 Subject: [PATCH 7/9] Modify the path message to correct path. Fixes: 222127442 Test: manual test Change-Id: I52c534a6e08d7d63700a09b030965e08f2bfc54e --- res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index d845dfd7f95..66265d69b0d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -10619,7 +10619,7 @@ Allowing %1$s to always run in the background may reduce battery life. - \n\nYou can change this later from Settings > Apps & notifications. + \n\nYou can change this later from Settings > Apps. %1$s use since last full charge From 072dcd9025ae4e898bacba4c6fecbf2bacfb55fc Mon Sep 17 00:00:00 2001 From: menghanli Date: Tue, 8 Mar 2022 13:52:11 +0800 Subject: [PATCH 8/9] Fix One handed mode Settings "Pull screen into reach" function fail Side effect of ag/16932279 that mistypo to change the controller name Bug: 223308917 Test: Manual testing Change-Id: Id625ffb9dfee6a38232a0b0f8387dc5350d5e1d8 --- res/xml/one_handed_settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/xml/one_handed_settings.xml b/res/xml/one_handed_settings.xml index 7406993d7fc..ab4d6f7c8b7 100644 --- a/res/xml/one_handed_settings.xml +++ b/res/xml/one_handed_settings.xml @@ -46,7 +46,7 @@ android:key="gesture_one_handed_action_pull_screen_down" android:title="@string/one_handed_action_pull_down_screen_title" android:summary="@string/one_handed_action_pull_down_screen_summary" - settings:controller="com.android.settings.gesture_one_handed_mode_footer_textgestures.OneHandedActionPullDownPrefController"/> + settings:controller="com.android.settings.gestures.OneHandedActionPullDownPrefController"/> Date: Fri, 25 Feb 2022 19:06:18 +0800 Subject: [PATCH 9/9] Fix the problem that voice search can not find the Use Battery Saver slice. There is no title for preference in xml, so the preference cannot be indexed. Fix: 172276695 Test: manual test and see the UI Change-Id: Ieb7836805e66515629064800e4119ca17b5ac2e0 --- res/xml/battery_saver_settings.xml | 1 + .../batterysaver/BatterySaverButtonPreferenceController.java | 2 -- .../BatterySaverButtonPreferenceControllerTest.java | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/res/xml/battery_saver_settings.xml b/res/xml/battery_saver_settings.xml index e1059206be1..862bcd7fbdb 100644 --- a/res/xml/battery_saver_settings.xml +++ b/res/xml/battery_saver_settings.xml @@ -23,6 +23,7 @@