Merge "Cleaning up KeyguardClockPositionAlgorithm and its tests" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
efa4aca7d3
@@ -1148,7 +1148,7 @@
|
|||||||
|
|
||||||
<!-- The maximum offset in either direction that elements are moved vertically to prevent
|
<!-- The maximum offset in either direction that elements are moved vertically to prevent
|
||||||
burn-in on AOD. -->
|
burn-in on AOD. -->
|
||||||
<dimen name="burn_in_prevention_offset_y_large_clock">42dp</dimen>
|
<dimen name="burn_in_prevention_offset_y_clock">42dp</dimen>
|
||||||
|
|
||||||
<!-- Clock maximum font size (dp is intentional, to prevent any further scaling) -->
|
<!-- Clock maximum font size (dp is intentional, to prevent any further scaling) -->
|
||||||
<dimen name="large_clock_text_size">150dp</dimen>
|
<dimen name="large_clock_text_size">150dp</dimen>
|
||||||
|
|||||||
@@ -32,23 +32,12 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherListView;
|
|||||||
* Utility class to calculate the clock position and top padding of notifications on Keyguard.
|
* Utility class to calculate the clock position and top padding of notifications on Keyguard.
|
||||||
*/
|
*/
|
||||||
public class KeyguardClockPositionAlgorithm {
|
public class KeyguardClockPositionAlgorithm {
|
||||||
/**
|
|
||||||
* How much the clock height influences the shade position.
|
|
||||||
* 0 means nothing, 1 means move the shade up by the height of the clock
|
|
||||||
* 0.5f means move the shade up by half of the size of the clock.
|
|
||||||
*/
|
|
||||||
private static float CLOCK_HEIGHT_WEIGHT = 0.7f;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Margin between the bottom of the status view and the notification shade.
|
* Margin between the bottom of the status view and the notification shade.
|
||||||
*/
|
*/
|
||||||
private int mStatusViewBottomMargin;
|
private int mStatusViewBottomMargin;
|
||||||
|
|
||||||
/**
|
|
||||||
* Height of the parent view - display size in px.
|
|
||||||
*/
|
|
||||||
private int mHeight;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Height of {@link KeyguardStatusView}.
|
* Height of {@link KeyguardStatusView}.
|
||||||
*/
|
*/
|
||||||
@@ -67,21 +56,6 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
*/
|
*/
|
||||||
private int mUserSwitchPreferredY;
|
private int mUserSwitchPreferredY;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether or not there is a custom clock face on keyguard.
|
|
||||||
*/
|
|
||||||
private boolean mHasCustomClock;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether or not the NSSL contains any visible notifications.
|
|
||||||
*/
|
|
||||||
private boolean mHasVisibleNotifs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Height of notification stack: Sum of height of each notification.
|
|
||||||
*/
|
|
||||||
private int mNotificationStackHeight;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher
|
* Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher
|
||||||
* avatar.
|
* avatar.
|
||||||
@@ -93,12 +67,6 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
*/
|
*/
|
||||||
private int mCutoutTopInset = 0;
|
private int mCutoutTopInset = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum bottom padding to avoid overlap with {@link KeyguardBottomAreaView} or
|
|
||||||
* the ambient indication.
|
|
||||||
*/
|
|
||||||
private int mMaxShadeBottom;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recommended distance from the status bar.
|
* Recommended distance from the status bar.
|
||||||
*/
|
*/
|
||||||
@@ -115,14 +83,9 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
private int mBurnInPreventionOffsetX;
|
private int mBurnInPreventionOffsetX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Burn-in prevention y translation.
|
* Burn-in prevention y translation for clock layouts.
|
||||||
*/
|
*/
|
||||||
private int mBurnInPreventionOffsetY;
|
private int mBurnInPreventionOffsetYClock;
|
||||||
|
|
||||||
/**
|
|
||||||
* Burn-in prevention y translation for large clock layouts.
|
|
||||||
*/
|
|
||||||
private int mBurnInPreventionOffsetYLargeClock;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doze/AOD transition amount.
|
* Doze/AOD transition amount.
|
||||||
@@ -160,34 +123,26 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
res.getDimensionPixelSize(R.dimen.keyguard_clock_top_margin) / 2;
|
res.getDimensionPixelSize(R.dimen.keyguard_clock_top_margin) / 2;
|
||||||
mBurnInPreventionOffsetX = res.getDimensionPixelSize(
|
mBurnInPreventionOffsetX = res.getDimensionPixelSize(
|
||||||
R.dimen.burn_in_prevention_offset_x);
|
R.dimen.burn_in_prevention_offset_x);
|
||||||
mBurnInPreventionOffsetY = res.getDimensionPixelSize(
|
mBurnInPreventionOffsetYClock = res.getDimensionPixelSize(
|
||||||
R.dimen.burn_in_prevention_offset_y);
|
R.dimen.burn_in_prevention_offset_y_clock);
|
||||||
mBurnInPreventionOffsetYLargeClock = res.getDimensionPixelSize(
|
|
||||||
R.dimen.burn_in_prevention_offset_y_large_clock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up algorithm values.
|
* Sets up algorithm values.
|
||||||
*/
|
*/
|
||||||
public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom,
|
public void setup(int keyguardStatusBarHeaderHeight, float panelExpansion,
|
||||||
int notificationStackHeight, float panelExpansion, int parentHeight,
|
|
||||||
int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY,
|
int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY,
|
||||||
boolean hasCustomClock, boolean hasVisibleNotifs, float dark,
|
float dark, float overStretchAmount, boolean bypassEnabled,
|
||||||
float overStrechAmount, boolean bypassEnabled, int unlockedStackScrollerPadding,
|
int unlockedStackScrollerPadding, float qsExpansion, int cutoutTopInset,
|
||||||
float qsExpansion, int cutoutTopInset, boolean isSplitShade) {
|
boolean isSplitShade) {
|
||||||
mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding,
|
mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding,
|
||||||
userSwitchHeight);
|
userSwitchHeight);
|
||||||
mMaxShadeBottom = maxShadeBottom;
|
|
||||||
mNotificationStackHeight = notificationStackHeight;
|
|
||||||
mPanelExpansion = panelExpansion;
|
mPanelExpansion = panelExpansion;
|
||||||
mHeight = parentHeight;
|
|
||||||
mKeyguardStatusHeight = keyguardStatusHeight + mStatusViewBottomMargin;
|
mKeyguardStatusHeight = keyguardStatusHeight + mStatusViewBottomMargin;
|
||||||
mUserSwitchHeight = userSwitchHeight;
|
mUserSwitchHeight = userSwitchHeight;
|
||||||
mUserSwitchPreferredY = userSwitchPreferredY;
|
mUserSwitchPreferredY = userSwitchPreferredY;
|
||||||
mHasCustomClock = hasCustomClock;
|
|
||||||
mHasVisibleNotifs = hasVisibleNotifs;
|
|
||||||
mDarkAmount = dark;
|
mDarkAmount = dark;
|
||||||
mOverStretchAmount = overStrechAmount;
|
mOverStretchAmount = overStretchAmount;
|
||||||
mBypassEnabled = bypassEnabled;
|
mBypassEnabled = bypassEnabled;
|
||||||
mUnlockedStackScrollerPadding = unlockedStackScrollerPadding;
|
mUnlockedStackScrollerPadding = unlockedStackScrollerPadding;
|
||||||
mQsExpansion = qsExpansion;
|
mQsExpansion = qsExpansion;
|
||||||
@@ -244,8 +199,8 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
|
|
||||||
// This will keep the clock at the top but out of the cutout area
|
// This will keep the clock at the top but out of the cutout area
|
||||||
float shift = 0;
|
float shift = 0;
|
||||||
if (clockY - mBurnInPreventionOffsetYLargeClock < mCutoutTopInset) {
|
if (clockY - mBurnInPreventionOffsetYClock < mCutoutTopInset) {
|
||||||
shift = mCutoutTopInset - (clockY - mBurnInPreventionOffsetYLargeClock);
|
shift = mCutoutTopInset - (clockY - mBurnInPreventionOffsetYClock);
|
||||||
}
|
}
|
||||||
float clockYDark = clockY + burnInPreventionOffsetY() + shift;
|
float clockYDark = clockY + burnInPreventionOffsetY() + shift;
|
||||||
|
|
||||||
@@ -281,7 +236,7 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float burnInPreventionOffsetY() {
|
private float burnInPreventionOffsetY() {
|
||||||
int offset = mBurnInPreventionOffsetYLargeClock;
|
int offset = mBurnInPreventionOffsetYClock;
|
||||||
|
|
||||||
return getBurnInOffset(offset * 2, false /* xAxis */) - offset;
|
return getBurnInOffset(offset * 2, false /* xAxis */) - offset;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1317,8 +1317,6 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateClockAppearance() {
|
private void updateClockAppearance() {
|
||||||
int totalHeight = mView.getHeight();
|
|
||||||
int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
|
|
||||||
int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard;
|
int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard;
|
||||||
boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
|
boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
|
||||||
final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
|
final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
|
||||||
@@ -1339,14 +1337,11 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()
|
mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()
|
||||||
? 1.0f : mInterpolatedDarkAmount;
|
? 1.0f : mInterpolatedDarkAmount;
|
||||||
mClockPositionAlgorithm.setup(mStatusBarHeaderHeightKeyguard,
|
mClockPositionAlgorithm.setup(mStatusBarHeaderHeightKeyguard,
|
||||||
totalHeight - bottomPadding,
|
|
||||||
mNotificationStackScrollLayoutController.getIntrinsicContentHeight(),
|
|
||||||
expandedFraction,
|
expandedFraction,
|
||||||
totalHeight,
|
|
||||||
mKeyguardStatusViewController.getLockscreenHeight(),
|
mKeyguardStatusViewController.getLockscreenHeight(),
|
||||||
userIconHeight,
|
userIconHeight,
|
||||||
userSwitcherPreferredY, hasCustomClock(),
|
userSwitcherPreferredY,
|
||||||
hasVisibleNotifications, darkamount, mOverStretchAmount,
|
darkamount, mOverStretchAmount,
|
||||||
bypassEnabled, getUnlockedStackScrollerPadding(),
|
bypassEnabled, getUnlockedStackScrollerPadding(),
|
||||||
computeQsExpansionFraction(),
|
computeQsExpansionFraction(),
|
||||||
mDisplayTopInset,
|
mDisplayTopInset,
|
||||||
|
|||||||
@@ -31,42 +31,31 @@ import org.junit.runner.RunWith;
|
|||||||
@SmallTest
|
@SmallTest
|
||||||
@RunWith(AndroidTestingRunner.class)
|
@RunWith(AndroidTestingRunner.class)
|
||||||
public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
||||||
|
|
||||||
private static final int SCREEN_HEIGHT = 2000;
|
private static final int SCREEN_HEIGHT = 2000;
|
||||||
private static final int EMPTY_MARGIN = 0;
|
private static final int EMPTY_MARGIN = 0;
|
||||||
private static final int EMPTY_HEIGHT = 0;
|
private static final int EMPTY_HEIGHT = 0;
|
||||||
private static final float ZERO_DRAG = 0.f;
|
private static final float ZERO_DRAG = 0.f;
|
||||||
private static final float OPAQUE = 1.f;
|
private static final float OPAQUE = 1.f;
|
||||||
private static final float TRANSPARENT = 0.f;
|
private static final float TRANSPARENT = 0.f;
|
||||||
private static final boolean HAS_CUSTOM_CLOCK = false;
|
|
||||||
private static final boolean HAS_VISIBLE_NOTIFS = false;
|
|
||||||
|
|
||||||
private KeyguardClockPositionAlgorithm mClockPositionAlgorithm;
|
private KeyguardClockPositionAlgorithm mClockPositionAlgorithm;
|
||||||
private KeyguardClockPositionAlgorithm.Result mClockPosition;
|
private KeyguardClockPositionAlgorithm.Result mClockPosition;
|
||||||
private int mNotificationStackHeight;
|
|
||||||
private float mPanelExpansion;
|
private float mPanelExpansion;
|
||||||
private int mKeyguardStatusHeight;
|
private int mKeyguardStatusHeight;
|
||||||
private float mDark;
|
private float mDark;
|
||||||
private boolean mHasCustomClock;
|
|
||||||
private boolean mHasVisibleNotifs;
|
|
||||||
private float mQsExpansion;
|
private float mQsExpansion;
|
||||||
private int mCutoutTopInset = 0; // in pixels
|
private int mCutoutTopInsetPx = 0;
|
||||||
private boolean mIsSplitShade = false;
|
private boolean mIsSplitShade = false;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm();
|
mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm();
|
||||||
mClockPosition = new KeyguardClockPositionAlgorithm.Result();
|
mClockPosition = new KeyguardClockPositionAlgorithm.Result();
|
||||||
|
|
||||||
mHasCustomClock = HAS_CUSTOM_CLOCK;
|
|
||||||
mHasVisibleNotifs = HAS_VISIBLE_NOTIFS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clockPositionTopOfScreenOnAOD() {
|
public void clockPositionTopOfScreenOnAOD() {
|
||||||
// GIVEN on AOD and both stack scroll and clock have 0 height
|
// GIVEN on AOD and clock has 0 height
|
||||||
givenAOD();
|
givenAOD();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -79,11 +68,10 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clockPositionBelowCutout() {
|
public void clockPositionBelowCutout() {
|
||||||
// GIVEN on AOD and both stack scroll and clock have 0 height
|
// GIVEN on AOD and clock has 0 height
|
||||||
givenAOD();
|
givenAOD();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
mCutoutTopInset = 300;
|
mCutoutTopInsetPx = 300;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the clock Y position is below the cutout
|
// THEN the clock Y position is below the cutout
|
||||||
@@ -97,7 +85,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void clockPositionAdjustsForKeyguardStatusOnAOD() {
|
public void clockPositionAdjustsForKeyguardStatusOnAOD() {
|
||||||
// GIVEN on AOD with a clock of height 100
|
// GIVEN on AOD with a clock of height 100
|
||||||
givenAOD();
|
givenAOD();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = 100;
|
mKeyguardStatusHeight = 100;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -112,7 +99,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void clockPositionLargeClockOnAOD() {
|
public void clockPositionLargeClockOnAOD() {
|
||||||
// GIVEN on AOD with a full screen clock
|
// GIVEN on AOD with a full screen clock
|
||||||
givenAOD();
|
givenAOD();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -125,9 +111,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clockPositionTopOfScreenOnLockScreen() {
|
public void clockPositionTopOfScreenOnLockScreen() {
|
||||||
// GIVEN on lock screen with stack scroll and clock of 0 height
|
// GIVEN on lock screen with clock of 0 height
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -137,25 +122,10 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
assertThat(mClockPosition.clockX).isEqualTo(0);
|
assertThat(mClockPosition.clockX).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void clockPositionWithStackScrollExpandOnLockScreen() {
|
|
||||||
// GIVEN on lock screen with stack scroll of height 500
|
|
||||||
givenLockScreen();
|
|
||||||
mNotificationStackHeight = 500;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
|
||||||
// WHEN the clock position algorithm is run
|
|
||||||
positionClock();
|
|
||||||
// THEN the clock Y position stays to the top
|
|
||||||
assertThat(mClockPosition.clockY).isEqualTo(0);
|
|
||||||
// AND the clock is positioned on the left.
|
|
||||||
assertThat(mClockPosition.clockX).isEqualTo(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clockPositionWithPartialDragOnLockScreen() {
|
public void clockPositionWithPartialDragOnLockScreen() {
|
||||||
// GIVEN dragging up on lock screen
|
// GIVEN dragging up on lock screen
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
mPanelExpansion = 0.5f;
|
mPanelExpansion = 0.5f;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
@@ -171,7 +141,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void clockPositionWithFullDragOnLockScreen() {
|
public void clockPositionWithFullDragOnLockScreen() {
|
||||||
// GIVEN the lock screen is dragged up
|
// GIVEN the lock screen is dragged up
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
mPanelExpansion = 0.f;
|
mPanelExpansion = 0.f;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
@@ -184,7 +153,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void largeClockOnLockScreenIsTransparent() {
|
public void largeClockOnLockScreenIsTransparent() {
|
||||||
// GIVEN on lock screen with a full screen clock
|
// GIVEN on lock screen with a full screen clock
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -194,9 +162,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void notifPositionTopOfScreenOnAOD() {
|
public void notifPositionTopOfScreenOnAOD() {
|
||||||
// GIVEN on AOD and both stack scroll and clock have 0 height
|
// GIVEN on AOD and clock has 0 height
|
||||||
givenAOD();
|
givenAOD();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -208,7 +175,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void notifPositionIndependentOfKeyguardStatusHeightOnAOD() {
|
public void notifPositionIndependentOfKeyguardStatusHeightOnAOD() {
|
||||||
// GIVEN on AOD and clock has a nonzero height
|
// GIVEN on AOD and clock has a nonzero height
|
||||||
givenAOD();
|
givenAOD();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = 100;
|
mKeyguardStatusHeight = 100;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -220,7 +186,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void notifPositionWithLargeClockOnAOD() {
|
public void notifPositionWithLargeClockOnAOD() {
|
||||||
// GIVEN on AOD and clock has a nonzero height
|
// GIVEN on AOD and clock has a nonzero height
|
||||||
givenAOD();
|
givenAOD();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -230,9 +195,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void notifPositionMiddleOfScreenOnLockScreen() {
|
public void notifPositionMiddleOfScreenOnLockScreen() {
|
||||||
// GIVEN on lock screen and both stack scroll and clock have 0 height
|
// GIVEN on lock screen and clock has 0 height
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -240,48 +204,21 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void notifPositionAdjustsForStackHeightOnLockScreen() {
|
|
||||||
// GIVEN on lock screen and stack scroller has a nonzero height
|
|
||||||
givenLockScreen();
|
|
||||||
mNotificationStackHeight = 500;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
|
||||||
// WHEN the position algorithm is run
|
|
||||||
positionClock();
|
|
||||||
// THEN the notif padding adjusts for keyguard status height
|
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void notifPositionAdjustsForClockHeightOnLockScreen() {
|
public void notifPositionAdjustsForClockHeightOnLockScreen() {
|
||||||
// GIVEN on lock screen and stack scroller has a nonzero height
|
// GIVEN on lock screen and stack scroller has a nonzero height
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = 200;
|
mKeyguardStatusHeight = 200;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the notif padding adjusts for both clock and notif stack.
|
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void notifPositionAdjustsForStackHeightAndClockHeightOnLockScreen() {
|
|
||||||
// GIVEN on lock screen and stack scroller has a nonzero height
|
|
||||||
givenLockScreen();
|
|
||||||
mNotificationStackHeight = 500;
|
|
||||||
mKeyguardStatusHeight = 200;
|
|
||||||
// WHEN the position algorithm is run
|
|
||||||
positionClock();
|
|
||||||
// THEN the notifs are placed below the statusview
|
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void notifPositionAlignedWithClockInSplitShadeMode() {
|
public void notifPositionAlignedWithClockInSplitShadeMode() {
|
||||||
// GIVEN on lock screen and split shade mode
|
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mIsSplitShade = true;
|
mIsSplitShade = true;
|
||||||
mHasCustomClock = true;
|
mKeyguardStatusHeight = 200;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the notif padding DOESN'T adjust for keyguard status height.
|
// THEN the notif padding DOESN'T adjust for keyguard status height.
|
||||||
@@ -292,7 +229,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void notifPositionWithLargeClockOnLockScreen() {
|
public void notifPositionWithLargeClockOnLockScreen() {
|
||||||
// GIVEN on lock screen and clock has a nonzero height
|
// GIVEN on lock screen and clock has a nonzero height
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
@@ -304,7 +240,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void notifPositionWithFullDragOnLockScreen() {
|
public void notifPositionWithFullDragOnLockScreen() {
|
||||||
// GIVEN the lock screen is dragged up
|
// GIVEN the lock screen is dragged up
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
mPanelExpansion = 0.f;
|
mPanelExpansion = 0.f;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
@@ -317,19 +252,17 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
public void notifPositionWithLargeClockFullDragOnLockScreen() {
|
public void notifPositionWithLargeClockFullDragOnLockScreen() {
|
||||||
// GIVEN the lock screen is dragged up and a full screen clock
|
// GIVEN the lock screen is dragged up and a full screen clock
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
||||||
mPanelExpansion = 0.f;
|
mPanelExpansion = 0.f;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the notif padding is zero.
|
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(
|
||||||
(int) (mKeyguardStatusHeight * .667f));
|
(int) (mKeyguardStatusHeight * .667f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clockHiddenWhenQsIsExpanded() {
|
public void clockHiddenWhenQsIsExpanded() {
|
||||||
// GIVEN on the lock screen with a custom clock and visible notifications
|
// GIVEN on the lock screen with visible notifications
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mQsExpansion = 1;
|
mQsExpansion = 1;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
@@ -349,12 +282,11 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void positionClock() {
|
private void positionClock() {
|
||||||
mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
|
mClockPositionAlgorithm.setup(EMPTY_MARGIN, mPanelExpansion, mKeyguardStatusHeight,
|
||||||
mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight,
|
|
||||||
0 /* userSwitchHeight */, 0 /* userSwitchPreferredY */,
|
0 /* userSwitchHeight */, 0 /* userSwitchPreferredY */,
|
||||||
mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */,
|
mDark, ZERO_DRAG, false /* bypassEnabled */,
|
||||||
0 /* unlockedStackScrollerPadding */, mQsExpansion,
|
0 /* unlockedStackScrollerPadding */, mQsExpansion,
|
||||||
mCutoutTopInset, mIsSplitShade);
|
mCutoutTopInsetPx, mIsSplitShade);
|
||||||
mClockPositionAlgorithm.run(mClockPosition);
|
mClockPositionAlgorithm.run(mClockPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user