Properly fixing expansion state in lockscreen to shade transition
This is follow up to ag/18436783 which was just a quick fix, even though it also introduced important scrim-related fix. This change updates QS expansion along lockscreen to shade transition in split shade. That uncovered some inconsistent behaviour in split shade like calculating top notifications padding or max panel height which are also fixed here. Bug: 228198572 Test: expand shade from split lockscreen and see most bottom tiles functioning properly (requires 9 tiles visible in split shade) Change-Id: Ia68d9ec80eeeff56d2db7538449d0162ce6e690f
This commit is contained in:
committed by
Michał Brzeziński
parent
db27de8894
commit
397a969ce3
@@ -309,9 +309,12 @@ public class KeyguardClockPositionAlgorithm {
|
||||
*/
|
||||
private float getClockAlpha(int y) {
|
||||
float alphaKeyguard = Math.max(0, y / Math.max(1f, getClockY(1f, mDarkAmount)));
|
||||
float qsAlphaFactor = MathUtils.saturate(mQsExpansion / 0.3f);
|
||||
qsAlphaFactor = 1f - qsAlphaFactor;
|
||||
alphaKeyguard *= qsAlphaFactor;
|
||||
if (!mIsSplitShade) {
|
||||
// in split shade QS are always expanded so this factor shouldn't apply
|
||||
float qsAlphaFactor = MathUtils.saturate(mQsExpansion / 0.3f);
|
||||
qsAlphaFactor = 1f - qsAlphaFactor;
|
||||
alphaKeyguard *= qsAlphaFactor;
|
||||
}
|
||||
alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
|
||||
return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_N
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
||||
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
|
||||
import static com.android.systemui.statusbar.StatusBarState.SHADE;
|
||||
import static com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED;
|
||||
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL;
|
||||
import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_FOLD_TO_AOD;
|
||||
import static com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManagerKt.STATE_CLOSED;
|
||||
@@ -2672,8 +2673,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
}
|
||||
|
||||
private float calculateNotificationsTopPadding() {
|
||||
if (mSplitShadeEnabled && !mKeyguardShowing) {
|
||||
return 0;
|
||||
if (mSplitShadeEnabled) {
|
||||
return mKeyguardShowing ? getKeyguardNotificationStaticPadding() : 0;
|
||||
}
|
||||
if (mKeyguardShowing && (mQsExpandImmediate
|
||||
|| mIsExpanding && mQsExpandedWhenExpandingStarted)) {
|
||||
@@ -2747,6 +2748,9 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
mIsQsTranslationResetAnimator = mQsTranslationForFullShadeTransition > 0.0f;
|
||||
}
|
||||
|
||||
if (mSplitShadeEnabled) {
|
||||
updateQsExpansionForLockscreenToShadeTransition(pxAmount);
|
||||
}
|
||||
float endPosition = 0;
|
||||
if (pxAmount > 0.0f) {
|
||||
if (mNotificationStackScrollLayoutController.getVisibleNotificationCount() == 0
|
||||
@@ -2786,6 +2790,18 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
updateQsExpansion();
|
||||
}
|
||||
|
||||
private void updateQsExpansionForLockscreenToShadeTransition(float pxAmount) {
|
||||
float qsExpansion = 0;
|
||||
if (pxAmount > 0.0f) {
|
||||
qsExpansion = MathUtils.lerp(mQsMinExpansionHeight, mQsMaxExpansionHeight,
|
||||
mLockscreenShadeTransitionController.getQSDragProgress());
|
||||
}
|
||||
// SHADE_LOCKED means transition is over and we don't want further updates
|
||||
if (mBarState != SHADE_LOCKED) {
|
||||
setQsExpansion(qsExpansion);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the panel that the pulse expansion has finished and that we're going to the full
|
||||
* shade
|
||||
@@ -2989,7 +3005,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
}
|
||||
int maxHeight;
|
||||
if (mQsExpandImmediate || mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted
|
||||
|| mPulsing) {
|
||||
|| mPulsing || mSplitShadeEnabled) {
|
||||
maxHeight = calculatePanelHeightQsExpanded();
|
||||
} else {
|
||||
maxHeight = calculatePanelHeightShade();
|
||||
@@ -4737,11 +4753,6 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
duration = StackStateAnimator.ANIMATION_DURATION_STANDARD;
|
||||
}
|
||||
mKeyguardStatusBarViewController.animateKeyguardStatusBarOut(startDelay, duration);
|
||||
if (mSplitShadeEnabled) {
|
||||
// temporary workaround for QS height not being updated during lockscreen to
|
||||
// shade transition
|
||||
setQsExpanded(true);
|
||||
}
|
||||
updateQSMinHeight();
|
||||
} else if (oldState == StatusBarState.SHADE_LOCKED
|
||||
&& statusBarState == KEYGUARD) {
|
||||
|
||||
@@ -266,7 +266,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void clockPositionedDependingOnMarginInSplitShade() {
|
||||
setSplitShadeTopMargin(400);
|
||||
mClockPositionAlgorithm.loadDimens(mResources);
|
||||
givenLockScreen();
|
||||
mIsSplitShade = true;
|
||||
// WHEN the position algorithm is run
|
||||
@@ -294,7 +293,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
||||
public void notifPaddingAccountsForMultiUserSwitcherInSplitShade() {
|
||||
setSplitShadeTopMargin(100);
|
||||
mUserSwitchHeight = 150;
|
||||
mClockPositionAlgorithm.loadDimens(mResources);
|
||||
givenLockScreen();
|
||||
mIsSplitShade = true;
|
||||
// WHEN the position algorithm is run
|
||||
@@ -307,7 +305,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
||||
public void clockDoesntAccountForMultiUserSwitcherInSplitShade() {
|
||||
setSplitShadeTopMargin(100);
|
||||
mUserSwitchHeight = 150;
|
||||
mClockPositionAlgorithm.loadDimens(mResources);
|
||||
givenLockScreen();
|
||||
mIsSplitShade = true;
|
||||
// WHEN the position algorithm is run
|
||||
@@ -382,10 +379,24 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
||||
mQsExpansion = 1;
|
||||
// WHEN the clock position algorithm is run
|
||||
positionClock();
|
||||
// THEN the clock Y position is the middle of the screen (SCREEN_HEIGHT / 2).
|
||||
// THEN the clock is transparent.
|
||||
assertThat(mClockPosition.clockAlpha).isEqualTo(TRANSPARENT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clockNotHiddenWhenQsIsExpandedInSplitShade() {
|
||||
// GIVEN on the split lock screen with QS expansion
|
||||
givenLockScreen();
|
||||
mIsSplitShade = true;
|
||||
setSplitShadeTopMargin(100);
|
||||
mQsExpansion = 1;
|
||||
|
||||
// WHEN the clock position algorithm is run
|
||||
positionClock();
|
||||
|
||||
assertThat(mClockPosition.clockAlpha).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clockPositionMinimizesBurnInMovementToAvoidUdfpsOnAOD() {
|
||||
// GIVEN a center aligned clock
|
||||
@@ -524,6 +535,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
||||
private void setSplitShadeTopMargin(int value) {
|
||||
when(mResources.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin))
|
||||
.thenReturn(value);
|
||||
mClockPositionAlgorithm.loadDimens(mResources);
|
||||
}
|
||||
|
||||
private void givenHighestBurnInOffset() {
|
||||
|
||||
Reference in New Issue
Block a user