Merge "Fix overlap between notifications and lock icon in portrait shade" into udc-dev am: 674a19a2d3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23589950 Change-Id: I28ed4c65a00e97d1de536b19e48243c6bf7f1751 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1653,10 +1653,9 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
|
|||||||
Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding));
|
Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding));
|
||||||
mKeyguardNotificationBottomPadding = bottomPadding;
|
mKeyguardNotificationBottomPadding = bottomPadding;
|
||||||
|
|
||||||
float staticTopPadding = mClockPositionAlgorithm.getLockscreenMinStackScrollerPadding()
|
float staticTopPadding = mClockPositionAlgorithm.getLockscreenNotifPadding(
|
||||||
// getMinStackScrollerPadding is from the top of the screen,
|
mNotificationStackScrollLayoutController.getTop());
|
||||||
// but we need it from the top of the NSSL.
|
|
||||||
- mNotificationStackScrollLayoutController.getTop();
|
|
||||||
mKeyguardNotificationTopPadding = staticTopPadding;
|
mKeyguardNotificationTopPadding = staticTopPadding;
|
||||||
|
|
||||||
// To debug the available space, enable debug lines in this class. If you change how the
|
// To debug the available space, enable debug lines in this class. If you change how the
|
||||||
@@ -1670,8 +1669,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
|
|||||||
Log.i(TAG, "\n");
|
Log.i(TAG, "\n");
|
||||||
Log.i(TAG, "staticTopPadding[" + staticTopPadding
|
Log.i(TAG, "staticTopPadding[" + staticTopPadding
|
||||||
+ "] = Clock.padding["
|
+ "] = Clock.padding["
|
||||||
+ mClockPositionAlgorithm.getLockscreenMinStackScrollerPadding()
|
+ mClockPositionAlgorithm.getLockscreenNotifPadding(
|
||||||
+ "] - NSSLC.top[" + mNotificationStackScrollLayoutController.getTop()
|
mNotificationStackScrollLayoutController.getTop())
|
||||||
+ "]"
|
+ "]"
|
||||||
);
|
);
|
||||||
Log.i(TAG, "bottomPadding[" + bottomPadding
|
Log.i(TAG, "bottomPadding[" + bottomPadding
|
||||||
|
|||||||
@@ -229,12 +229,18 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLockscreenMinStackScrollerPadding() {
|
/**
|
||||||
|
* @param nsslTop NotificationStackScrollLayout top, which is below top of the srceen.
|
||||||
|
* @return Distance from nsslTop to top of the first view in the lockscreen shade.
|
||||||
|
*/
|
||||||
|
public float getLockscreenNotifPadding(float nsslTop) {
|
||||||
if (mBypassEnabled) {
|
if (mBypassEnabled) {
|
||||||
return mUnlockedStackScrollerPadding;
|
return mUnlockedStackScrollerPadding - nsslTop;
|
||||||
} else if (mIsSplitShade) {
|
} else if (mIsSplitShade) {
|
||||||
return mSplitShadeTargetTopMargin + mUserSwitchHeight;
|
return mSplitShadeTargetTopMargin + mUserSwitchHeight - nsslTop;
|
||||||
} else {
|
} else {
|
||||||
|
// Non-bypass portrait shade already uses values from nsslTop
|
||||||
|
// so we don't need to subtract it here.
|
||||||
return mMinTopMargin + mKeyguardStatusHeight;
|
return mMinTopMargin + mKeyguardStatusHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
private float mQsExpansion;
|
private float mQsExpansion;
|
||||||
private int mCutoutTopInset = 0;
|
private int mCutoutTopInset = 0;
|
||||||
private boolean mIsSplitShade = false;
|
private boolean mIsSplitShade = false;
|
||||||
|
private boolean mBypassEnabled = false;
|
||||||
|
private int mUnlockedStackScrollerPadding = 0;
|
||||||
private float mUdfpsTop = -1;
|
private float mUdfpsTop = -1;
|
||||||
private float mClockBottom = SCREEN_HEIGHT / 2;
|
private float mClockBottom = SCREEN_HEIGHT / 2;
|
||||||
private boolean mClockTopAligned;
|
private boolean mClockTopAligned;
|
||||||
@@ -339,15 +341,52 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void notifMinPaddingAlignedWithClockInSplitShadeMode() {
|
public void notifPadding_splitShade() {
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mIsSplitShade = true;
|
mIsSplitShade = true;
|
||||||
mKeyguardStatusHeight = 200;
|
mKeyguardStatusHeight = 200;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the padding DOESN'T adjust for keyguard status height.
|
// THEN the padding DOESN'T adjust for keyguard status height.
|
||||||
assertThat(mClockPositionAlgorithm.getLockscreenMinStackScrollerPadding())
|
assertThat(mClockPositionAlgorithm.getLockscreenNotifPadding(/* nsslTop= */ 10))
|
||||||
.isEqualTo(mKeyguardStatusBarHeaderHeight);
|
.isEqualTo(mKeyguardStatusBarHeaderHeight - 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void notifPadding_portraitShade_bypassOff() {
|
||||||
|
givenLockScreen();
|
||||||
|
mIsSplitShade = false;
|
||||||
|
mBypassEnabled = false;
|
||||||
|
|
||||||
|
// mMinTopMargin = 100 = 80 + max(20, 0)
|
||||||
|
mKeyguardStatusBarHeaderHeight = 80;
|
||||||
|
mUserSwitchHeight = 20;
|
||||||
|
when(mResources.getDimensionPixelSize(R.dimen.keyguard_clock_top_margin))
|
||||||
|
.thenReturn(0);
|
||||||
|
|
||||||
|
mKeyguardStatusHeight = 200;
|
||||||
|
|
||||||
|
// WHEN the position algorithm is run
|
||||||
|
positionClock();
|
||||||
|
|
||||||
|
// THEN padding = 300 = mMinTopMargin(100) + mKeyguardStatusHeight(200)
|
||||||
|
assertThat(mClockPositionAlgorithm.getLockscreenNotifPadding(/* nsslTop= */ 50))
|
||||||
|
.isEqualTo(300);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void notifPadding_portraitShade_bypassOn() {
|
||||||
|
givenLockScreen();
|
||||||
|
mIsSplitShade = false;
|
||||||
|
mBypassEnabled = true;
|
||||||
|
mUnlockedStackScrollerPadding = 200;
|
||||||
|
|
||||||
|
// WHEN the position algorithm is run
|
||||||
|
positionClock();
|
||||||
|
|
||||||
|
// THEN padding = 150 = mUnlockedStackScrollerPadding(200) - nsslTop(50)
|
||||||
|
assertThat(mClockPositionAlgorithm.getLockscreenNotifPadding(/* nsslTop= */ 50))
|
||||||
|
.isEqualTo(150);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -589,8 +628,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
0 /* userSwitchPreferredY */,
|
0 /* userSwitchPreferredY */,
|
||||||
mDark,
|
mDark,
|
||||||
ZERO_DRAG,
|
ZERO_DRAG,
|
||||||
false /* bypassEnabled */,
|
mBypassEnabled,
|
||||||
0 /* unlockedStackScrollerPadding */,
|
mUnlockedStackScrollerPadding,
|
||||||
mQsExpansion,
|
mQsExpansion,
|
||||||
mCutoutTopInset,
|
mCutoutTopInset,
|
||||||
mIsSplitShade,
|
mIsSplitShade,
|
||||||
|
|||||||
Reference in New Issue
Block a user