Loading packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +5 −4 Original line number Diff line number Diff line Loading @@ -2317,7 +2317,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return mKeyguardInteractor.getWakefulnessModel().getValue(); } private void maybeAnimateBottomAreaAlpha() { @VisibleForTesting void maybeAnimateBottomAreaAlpha() { mBottomAreaShadeAlphaAnimator.cancel(); if (mBarState == StatusBarState.SHADE_LOCKED) { mBottomAreaShadeAlphaAnimator.setFloatValues(mBottomAreaShadeAlpha, 0.0f); Loading Loading @@ -2679,10 +2680,10 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump // • User tapping on lock screen: bouncer won't be visible but panel expansion will // change due to "unlock hint animation." In this case, fading out the bottom area // would also hide the message that says "swipe to unlock," we don't want to do that. float expansionAlpha = MathUtils.map( isUnlockHintRunning() ? 0 : KeyguardBouncerConstants.ALPHA_EXPANSION_THRESHOLD, 1f, 0f, 1f, float expansionAlpha = MathUtils.constrainedMap(0f, 1f, isUnlockHintRunning() ? 0f : KeyguardBouncerConstants.ALPHA_EXPANSION_THRESHOLD, 1f, getExpandedFraction()); float alpha = Math.min(expansionAlpha, 1 - mQsController.computeExpansionFraction()); alpha *= mBottomAreaShadeAlpha; if (mFeatureFlags.isEnabled(Flags.MIGRATE_SPLIT_KEYGUARD_BOTTOM_AREA)) { Loading packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt +28 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import androidx.test.filters.SmallTest import com.android.internal.util.CollectionUtils import com.android.keyguard.KeyguardClockSwitch.LARGE import com.android.systemui.R import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION import com.android.systemui.statusbar.StatusBarState.KEYGUARD import com.android.systemui.statusbar.StatusBarState.SHADE Loading Loading @@ -261,4 +262,31 @@ class NotificationPanelViewControllerWithCoroutinesTest : } advanceUntilIdle() } @Test fun onLayoutChange_shadeCollapsed_bottomAreaAlphaIsZero() = runTest { // GIVEN bottomAreaShadeAlpha was updated before mNotificationPanelViewController.maybeAnimateBottomAreaAlpha() // WHEN a layout change is triggered with the shade being closed triggerLayoutChange() // THEN the bottomAreaAlpha is zero val bottomAreaAlpha by collectLastValue(mFakeKeyguardRepository.bottomAreaAlpha) assertThat(bottomAreaAlpha).isEqualTo(0f) } @Test fun onShadeExpanded_bottomAreaAlphaIsFullyOpaque() = runTest { // GIVEN bottomAreaShadeAlpha was updated before mNotificationPanelViewController.maybeAnimateBottomAreaAlpha() // WHEN the shade expanded val transitionDistance = mNotificationPanelViewController.maxPanelTransitionDistance mNotificationPanelViewController.expandedHeight = transitionDistance.toFloat() // THEN the bottomAreaAlpha is fully opaque val bottomAreaAlpha by collectLastValue(mFakeKeyguardRepository.bottomAreaAlpha) assertThat(bottomAreaAlpha).isEqualTo(1f) } } Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +5 −4 Original line number Diff line number Diff line Loading @@ -2317,7 +2317,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return mKeyguardInteractor.getWakefulnessModel().getValue(); } private void maybeAnimateBottomAreaAlpha() { @VisibleForTesting void maybeAnimateBottomAreaAlpha() { mBottomAreaShadeAlphaAnimator.cancel(); if (mBarState == StatusBarState.SHADE_LOCKED) { mBottomAreaShadeAlphaAnimator.setFloatValues(mBottomAreaShadeAlpha, 0.0f); Loading Loading @@ -2679,10 +2680,10 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump // • User tapping on lock screen: bouncer won't be visible but panel expansion will // change due to "unlock hint animation." In this case, fading out the bottom area // would also hide the message that says "swipe to unlock," we don't want to do that. float expansionAlpha = MathUtils.map( isUnlockHintRunning() ? 0 : KeyguardBouncerConstants.ALPHA_EXPANSION_THRESHOLD, 1f, 0f, 1f, float expansionAlpha = MathUtils.constrainedMap(0f, 1f, isUnlockHintRunning() ? 0f : KeyguardBouncerConstants.ALPHA_EXPANSION_THRESHOLD, 1f, getExpandedFraction()); float alpha = Math.min(expansionAlpha, 1 - mQsController.computeExpansionFraction()); alpha *= mBottomAreaShadeAlpha; if (mFeatureFlags.isEnabled(Flags.MIGRATE_SPLIT_KEYGUARD_BOTTOM_AREA)) { Loading
packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt +28 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import androidx.test.filters.SmallTest import com.android.internal.util.CollectionUtils import com.android.keyguard.KeyguardClockSwitch.LARGE import com.android.systemui.R import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION import com.android.systemui.statusbar.StatusBarState.KEYGUARD import com.android.systemui.statusbar.StatusBarState.SHADE Loading Loading @@ -261,4 +262,31 @@ class NotificationPanelViewControllerWithCoroutinesTest : } advanceUntilIdle() } @Test fun onLayoutChange_shadeCollapsed_bottomAreaAlphaIsZero() = runTest { // GIVEN bottomAreaShadeAlpha was updated before mNotificationPanelViewController.maybeAnimateBottomAreaAlpha() // WHEN a layout change is triggered with the shade being closed triggerLayoutChange() // THEN the bottomAreaAlpha is zero val bottomAreaAlpha by collectLastValue(mFakeKeyguardRepository.bottomAreaAlpha) assertThat(bottomAreaAlpha).isEqualTo(0f) } @Test fun onShadeExpanded_bottomAreaAlphaIsFullyOpaque() = runTest { // GIVEN bottomAreaShadeAlpha was updated before mNotificationPanelViewController.maybeAnimateBottomAreaAlpha() // WHEN the shade expanded val transitionDistance = mNotificationPanelViewController.maxPanelTransitionDistance mNotificationPanelViewController.expandedHeight = transitionDistance.toFloat() // THEN the bottomAreaAlpha is fully opaque val bottomAreaAlpha by collectLastValue(mFakeKeyguardRepository.bottomAreaAlpha) assertThat(bottomAreaAlpha).isEqualTo(1f) } }