From 1ee9c3e8667539e357801424aa08806cd9cb9b0c Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Tue, 21 Mar 2023 11:25:03 -0700 Subject: [PATCH 1/4] Launch feature to teamfood. Launch prevent bypass keyguard to teamfood. Bug: 273341787 Test: Been testing locally Change-Id: I0396ae62d6764e80aececf48b22d35fa9dc490ae --- packages/SystemUI/src/com/android/systemui/flags/Flags.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index d4ed5469e9392..f305002d60b72 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -231,7 +231,7 @@ object Flags { /** Whether to inflate the bouncer view on a background thread. */ // TODO(b/273341787): Tracking Bug @JvmField - val PREVENT_BYPASS_KEYGUARD = unreleasedFlag(230, "prevent_bypass_keyguard") + val PREVENT_BYPASS_KEYGUARD = unreleasedFlag(230, "prevent_bypass_keyguard", teamfood = true) // 300 - power menu // TODO(b/254512600): Tracking Bug From e6a7308fca175399497b8cf3cfbe79f178450136 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Fri, 24 Mar 2023 11:23:48 -0700 Subject: [PATCH 2/4] Set needs input after inflating. Make sure that we setNeedsInput after inflating the view. Bug: 274550142 Test: open bouncer with pin/password/pattern/simpin/simpuk Change-Id: I43f93cbf829caa87cde0dc1db34f4da7fe4e094d --- ...KeyguardSecurityViewFlipperController.java | 7 ++++++- ...uardSecurityViewFlipperControllerTest.java | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java index 68e1dd7d8eab1..ddf11997d3a72 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java @@ -54,19 +54,23 @@ public class KeyguardSecurityViewFlipperController private final Factory mKeyguardSecurityViewControllerFactory; private final FeatureFlags mFeatureFlags; + private final ViewMediatorCallback mViewMediatorCallback; + @Inject protected KeyguardSecurityViewFlipperController(KeyguardSecurityViewFlipper view, LayoutInflater layoutInflater, AsyncLayoutInflater asyncLayoutInflater, KeyguardInputViewController.Factory keyguardSecurityViewControllerFactory, EmergencyButtonController.Factory emergencyButtonControllerFactory, - FeatureFlags featureFlags) { + FeatureFlags featureFlags, + ViewMediatorCallback viewMediatorCallback) { super(view); mKeyguardSecurityViewControllerFactory = keyguardSecurityViewControllerFactory; mLayoutInflater = layoutInflater; mEmergencyButtonControllerFactory = emergencyButtonControllerFactory; mAsyncLayoutInflater = asyncLayoutInflater; mFeatureFlags = featureFlags; + mViewMediatorCallback = viewMediatorCallback; } @Override @@ -152,6 +156,7 @@ public class KeyguardSecurityViewFlipperController keyguardSecurityCallback); childController.init(); mChildren.add(childController); + mViewMediatorCallback.setNeedsInput(childController.needsInput()); if (onViewInflatedListener != null) { onViewInflatedListener.onViewInflated(); } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityViewFlipperControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityViewFlipperControllerTest.java index afb54d2df49f9..eaf7b1ec21005 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityViewFlipperControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityViewFlipperControllerTest.java @@ -35,6 +35,7 @@ import androidx.asynclayoutinflater.view.AsyncLayoutInflater; import androidx.test.filters.SmallTest; import com.android.keyguard.KeyguardSecurityModel.SecurityMode; +import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.flags.FeatureFlags; @@ -42,6 +43,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; @@ -76,6 +78,8 @@ public class KeyguardSecurityViewFlipperControllerTest extends SysuiTestCase { private KeyguardSecurityCallback mKeyguardSecurityCallback; @Mock private FeatureFlags mFeatureFlags; + @Mock + private ViewMediatorCallback mViewMediatorCallback; private KeyguardSecurityViewFlipperController mKeyguardSecurityViewFlipperController; @@ -92,7 +96,7 @@ public class KeyguardSecurityViewFlipperControllerTest extends SysuiTestCase { mKeyguardSecurityViewFlipperController = new KeyguardSecurityViewFlipperController(mView, mLayoutInflater, mAsyncLayoutInflater, mKeyguardSecurityViewControllerFactory, - mEmergencyButtonControllerFactory, mFeatureFlags); + mEmergencyButtonControllerFactory, mFeatureFlags, mViewMediatorCallback); } @Test @@ -122,6 +126,19 @@ public class KeyguardSecurityViewFlipperControllerTest extends SysuiTestCase { AsyncLayoutInflater.OnInflateFinishedListener.class)); } + @Test + public void asynchronouslyInflateView_setNeedsInput() { + ArgumentCaptor argumentCaptor = + ArgumentCaptor.forClass(AsyncLayoutInflater.OnInflateFinishedListener.class); + mKeyguardSecurityViewFlipperController.asynchronouslyInflateView(SecurityMode.PIN, + mKeyguardSecurityCallback, null); + verify(mAsyncLayoutInflater).inflate(anyInt(), eq(mView), argumentCaptor.capture()); + argumentCaptor.getValue().onInflateFinished( + LayoutInflater.from(getContext()).inflate(R.layout.keyguard_password_view, null), + R.layout.keyguard_password_view, mView); + verify(mViewMediatorCallback).setNeedsInput(anyBoolean()); + } + @Test public void onDensityOrFontScaleChanged() { mKeyguardSecurityViewFlipperController.clearViews(); From 50c1aaa24592060a0eded849c62104123c974a01 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Wed, 22 Mar 2023 14:51:19 -0700 Subject: [PATCH 3/4] Move async_bouncer to teamfood. Turning teamfood on in udc-dev after a fix has been made. Bug: 272091103 Test: turn on bouncer with flag on/off Change-Id: I082c94f751e85034c703b795af6ff15ef4915ad3 --- packages/SystemUI/src/com/android/systemui/flags/Flags.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index f305002d60b72..19e2b7709951b 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -226,7 +226,7 @@ object Flags { /** Whether to inflate the bouncer view on a background thread. */ // TODO(b/272091103): Tracking Bug @JvmField - val ASYNC_INFLATE_BOUNCER = unreleasedFlag(229, "async_inflate_bouncer", teamfood = false) + val ASYNC_INFLATE_BOUNCER = unreleasedFlag(229, "async_inflate_bouncer", teamfood = true) /** Whether to inflate the bouncer view on a background thread. */ // TODO(b/273341787): Tracking Bug From 4dc61959b8138da436ab96e1b2aa744ea4101bd1 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Mon, 27 Mar 2023 08:49:31 -0700 Subject: [PATCH 4/4] Set lockout in onResume. If bouncer is locked out, make sure that we check in onresume for all security types. Fixes: 275079518 Test: lock out in pin and pattern Change-Id: Ic81ad683e3e2e220f792a828c43f019928db4268 --- .../KeyguardAbsKeyInputViewController.java | 1 + .../KeyguardPatternViewController.java | 6 ++++++ ...KeyguardAbsKeyInputViewControllerTest.java | 12 ++++++++++- .../KeyguardPatternViewControllerTest.kt | 21 +++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java index f8cb38d7488b9..9f2333d8f4355 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java @@ -277,6 +277,7 @@ public abstract class KeyguardAbsKeyInputViewController