Merge "Properly fixing expansion state in lockscreen to shade transition" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b8b70b0a04
@@ -309,9 +309,12 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
*/
|
*/
|
||||||
private float getClockAlpha(int y) {
|
private float getClockAlpha(int y) {
|
||||||
float alphaKeyguard = Math.max(0, y / Math.max(1f, getClockY(1f, mDarkAmount)));
|
float alphaKeyguard = Math.max(0, y / Math.max(1f, getClockY(1f, mDarkAmount)));
|
||||||
float qsAlphaFactor = MathUtils.saturate(mQsExpansion / 0.3f);
|
if (!mIsSplitShade) {
|
||||||
qsAlphaFactor = 1f - qsAlphaFactor;
|
// in split shade QS are always expanded so this factor shouldn't apply
|
||||||
alphaKeyguard *= qsAlphaFactor;
|
float qsAlphaFactor = MathUtils.saturate(mQsExpansion / 0.3f);
|
||||||
|
qsAlphaFactor = 1f - qsAlphaFactor;
|
||||||
|
alphaKeyguard *= qsAlphaFactor;
|
||||||
|
}
|
||||||
alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
|
alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
|
||||||
return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
|
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.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
||||||
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
|
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
|
||||||
import static com.android.systemui.statusbar.StatusBarState.SHADE;
|
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.NotificationStackScrollLayout.ROWS_ALL;
|
||||||
import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_FOLD_TO_AOD;
|
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;
|
import static com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManagerKt.STATE_CLOSED;
|
||||||
@@ -2703,8 +2704,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float calculateNotificationsTopPadding() {
|
private float calculateNotificationsTopPadding() {
|
||||||
if (mSplitShadeEnabled && !mKeyguardShowing) {
|
if (mSplitShadeEnabled) {
|
||||||
return 0;
|
return mKeyguardShowing ? getKeyguardNotificationStaticPadding() : 0;
|
||||||
}
|
}
|
||||||
if (mKeyguardShowing && (mQsExpandImmediate
|
if (mKeyguardShowing && (mQsExpandImmediate
|
||||||
|| mIsExpanding && mQsExpandedWhenExpandingStarted)) {
|
|| mIsExpanding && mQsExpandedWhenExpandingStarted)) {
|
||||||
@@ -2778,6 +2779,9 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
mIsQsTranslationResetAnimator = mQsTranslationForFullShadeTransition > 0.0f;
|
mIsQsTranslationResetAnimator = mQsTranslationForFullShadeTransition > 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mSplitShadeEnabled) {
|
||||||
|
updateQsExpansionForLockscreenToShadeTransition(pxAmount);
|
||||||
|
}
|
||||||
float endPosition = 0;
|
float endPosition = 0;
|
||||||
if (pxAmount > 0.0f) {
|
if (pxAmount > 0.0f) {
|
||||||
if (mNotificationStackScrollLayoutController.getVisibleNotificationCount() == 0
|
if (mNotificationStackScrollLayoutController.getVisibleNotificationCount() == 0
|
||||||
@@ -2817,6 +2821,18 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
updateQsExpansion();
|
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
|
* Notify the panel that the pulse expansion has finished and that we're going to the full
|
||||||
* shade
|
* shade
|
||||||
@@ -3020,7 +3036,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
}
|
}
|
||||||
int maxHeight;
|
int maxHeight;
|
||||||
if (mQsExpandImmediate || mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted
|
if (mQsExpandImmediate || mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted
|
||||||
|| mPulsing) {
|
|| mPulsing || mSplitShadeEnabled) {
|
||||||
maxHeight = calculatePanelHeightQsExpanded();
|
maxHeight = calculatePanelHeightQsExpanded();
|
||||||
} else {
|
} else {
|
||||||
maxHeight = calculatePanelHeightShade();
|
maxHeight = calculatePanelHeightShade();
|
||||||
@@ -4771,11 +4787,6 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
duration = StackStateAnimator.ANIMATION_DURATION_STANDARD;
|
duration = StackStateAnimator.ANIMATION_DURATION_STANDARD;
|
||||||
}
|
}
|
||||||
mKeyguardStatusBarViewController.animateKeyguardStatusBarOut(startDelay, duration);
|
mKeyguardStatusBarViewController.animateKeyguardStatusBarOut(startDelay, duration);
|
||||||
if (mSplitShadeEnabled) {
|
|
||||||
// temporary workaround for QS height not being updated during lockscreen to
|
|
||||||
// shade transition
|
|
||||||
setQsExpanded(true);
|
|
||||||
}
|
|
||||||
updateQSMinHeight();
|
updateQSMinHeight();
|
||||||
} else if (oldState == StatusBarState.SHADE_LOCKED
|
} else if (oldState == StatusBarState.SHADE_LOCKED
|
||||||
&& statusBarState == KEYGUARD) {
|
&& statusBarState == KEYGUARD) {
|
||||||
|
|||||||
@@ -266,7 +266,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void clockPositionedDependingOnMarginInSplitShade() {
|
public void clockPositionedDependingOnMarginInSplitShade() {
|
||||||
setSplitShadeTopMargin(400);
|
setSplitShadeTopMargin(400);
|
||||||
mClockPositionAlgorithm.loadDimens(mResources);
|
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mIsSplitShade = true;
|
mIsSplitShade = true;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
@@ -294,7 +293,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void notifPaddingAccountsForMultiUserSwitcherInSplitShade() {
|
public void notifPaddingAccountsForMultiUserSwitcherInSplitShade() {
|
||||||
setSplitShadeTopMargin(100);
|
setSplitShadeTopMargin(100);
|
||||||
mUserSwitchHeight = 150;
|
mUserSwitchHeight = 150;
|
||||||
mClockPositionAlgorithm.loadDimens(mResources);
|
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mIsSplitShade = true;
|
mIsSplitShade = true;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
@@ -307,7 +305,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void clockDoesntAccountForMultiUserSwitcherInSplitShade() {
|
public void clockDoesntAccountForMultiUserSwitcherInSplitShade() {
|
||||||
setSplitShadeTopMargin(100);
|
setSplitShadeTopMargin(100);
|
||||||
mUserSwitchHeight = 150;
|
mUserSwitchHeight = 150;
|
||||||
mClockPositionAlgorithm.loadDimens(mResources);
|
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mIsSplitShade = true;
|
mIsSplitShade = true;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
@@ -382,10 +379,24 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
mQsExpansion = 1;
|
mQsExpansion = 1;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
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);
|
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
|
@Test
|
||||||
public void clockPositionMinimizesBurnInMovementToAvoidUdfpsOnAOD() {
|
public void clockPositionMinimizesBurnInMovementToAvoidUdfpsOnAOD() {
|
||||||
// GIVEN a center aligned clock
|
// GIVEN a center aligned clock
|
||||||
@@ -524,6 +535,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
private void setSplitShadeTopMargin(int value) {
|
private void setSplitShadeTopMargin(int value) {
|
||||||
when(mResources.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin))
|
when(mResources.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin))
|
||||||
.thenReturn(value);
|
.thenReturn(value);
|
||||||
|
mClockPositionAlgorithm.loadDimens(mResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void givenHighestBurnInOffset() {
|
private void givenHighestBurnInOffset() {
|
||||||
|
|||||||
Reference in New Issue
Block a user