summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Aaron Liu <aaronjli@google.com> 2023-05-12 13:55:16 -0700
committer Aaron Liu <aaronjli@google.com> 2023-05-12 14:00:06 -0700
commit0e6ba4ffe790a1145fa230c4b795196efcbcff0a (patch)
tree56d3d3990fb3980957e93e8b7f661113c045e3bf
parentef9b2174dc833516ac4764e4d0e145fa1eeefda9 (diff)
Do not set alpha to 1f when bouncer shows
Alpha here was set to 1f everytime the bouncer shows to ensure that the bouncer shows every time. This has caused issues with the introduction of a material U background color for the bouncer. We had bugs where the bouncer alpha was 0, which is why alpha is set to 1f here. Looking at it further, setExpansion is not called in the cases that expansion is already 0f. This is because we were not setting the panel expansion to HIDDEN (1f) anytime we hide the bouncer. Fixes: 281024571 Test: Simpin/Simpuk Test: password, pattern, pin scrimmed and track Test: Testing auth and then power off and on and going back to scrimmed bouncer and tracked bouncer. Change-Id: I572280daef98da64045e12508a6efd60141a42b6
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java1
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt2
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java9
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt1
5 files changed, 13 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
index 5cc0547b5bde..4b021716f506 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -599,7 +599,6 @@ public class KeyguardSecurityContainer extends ConstraintLayout {
*/
public void startAppearAnimation(SecurityMode securityMode) {
setTranslationY(0f);
- setAlpha(1f);
updateChildren(0 /* translationY */, 1f /* alpha */);
mViewMode.startAppearAnimation(securityMode);
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
index 1cbcb9d56566..d35fe262f4df 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
@@ -674,7 +674,6 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
public void startAppearAnimation() {
if (mCurrentSecurityMode != SecurityMode.None) {
- setAlpha(1f);
mView.startAppearAnimation(mCurrentSecurityMode);
getCurrentSecurityController(controller -> controller.startAppearAnimation());
}
@@ -1112,7 +1111,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
*/
public void setExpansion(float fraction) {
float scaledFraction = BouncerPanelExpansionCalculator.showBouncerProgress(fraction);
- mView.setAlpha(MathUtils.constrain(1 - scaledFraction, 0f, 1f));
+ setAlpha(MathUtils.constrain(1 - scaledFraction, 0f, 1f));
mView.setTranslationY(scaledFraction * mTranslationY);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt
index 110bcd715be2..d46d6aab26c2 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt
@@ -39,6 +39,7 @@ import com.android.systemui.keyguard.data.BouncerView
import com.android.systemui.keyguard.data.repository.KeyguardBouncerRepository
import com.android.systemui.keyguard.data.repository.TrustRepository
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants
+import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.shared.system.SysUiStatsLog
@@ -183,6 +184,7 @@ constructor(
cancelShowRunnable()
repository.setPrimaryShowingSoon(false)
repository.setPrimaryShow(false)
+ repository.setPanelExpansion(EXPANSION_HIDDEN)
primaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.INVISIBLE)
Trace.endSection()
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java
index 65ddb53f748b..29c38169cd3e 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java
@@ -18,6 +18,7 @@ package com.android.keyguard;
import static com.android.keyguard.KeyguardSecurityContainer.MODE_DEFAULT;
import static com.android.keyguard.KeyguardSecurityContainer.MODE_ONE_HANDED;
+import static com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_VISIBLE;
import static com.google.common.truth.Truth.assertThat;
@@ -685,6 +686,14 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
verify(mSideFpsController).hide(SideFpsUiRequestSource.PRIMARY_BOUNCER);
}
+ @Test
+ public void setExpansion_setsAlpha() {
+ mKeyguardSecurityContainerController.setExpansion(EXPANSION_VISIBLE);
+
+ verify(mView).setAlpha(1f);
+ verify(mView).setTranslationY(0f);
+ }
+
private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() {
mKeyguardSecurityContainerController.onViewAttached();
verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt
index eed1e739b909..9153d6ef138f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt
@@ -154,6 +154,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
verify(repository).setPrimaryShow(false)
verify(mPrimaryBouncerCallbackInteractor).dispatchVisibilityChanged(View.INVISIBLE)
verify(repository).setPrimaryStartDisappearAnimation(null)
+ verify(repository).setPanelExpansion(EXPANSION_HIDDEN)
}
@Test