Merge "KeyguardClockPositionAlgorithm Test updates" into sc-dev
This commit is contained in:
@@ -287,20 +287,6 @@ public class KeyguardClockSwitch extends RelativeLayout {
|
|||||||
return mClockView.getTextSize();
|
return mClockView.getTextSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the preferred Y position of the clock.
|
|
||||||
*
|
|
||||||
* @param totalHeight Height of the parent container.
|
|
||||||
* @return preferred Y position.
|
|
||||||
*/
|
|
||||||
int getPreferredY(int totalHeight) {
|
|
||||||
if (mClockPlugin != null) {
|
|
||||||
return mClockPlugin.getPreferredY(totalHeight);
|
|
||||||
} else {
|
|
||||||
return totalHeight / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the time of the clock, due to either time tick broadcast or doze time tick alarm.
|
* Refresh the time of the clock, due to either time tick broadcast or doze time tick alarm.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -256,16 +256,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
|||||||
return mView.getTextSize();
|
return mView.getTextSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the preferred Y position of the clock.
|
|
||||||
*
|
|
||||||
* @param totalHeight The height available to position the clock.
|
|
||||||
* @return Y position of clock.
|
|
||||||
*/
|
|
||||||
public int getClockPreferredY(int totalHeight) {
|
|
||||||
return mView.getPreferredY(totalHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh clock. Called in response to TIME_TICK broadcasts.
|
* Refresh clock. Called in response to TIME_TICK broadcasts.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -186,16 +186,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
|||||||
return mKeyguardClockSwitchController.getClockTextSize();
|
return mKeyguardClockSwitchController.getClockTextSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the preferred Y position of the clock.
|
|
||||||
*
|
|
||||||
* @param totalHeight The height available to position the clock.
|
|
||||||
* @return Y position of clock.
|
|
||||||
*/
|
|
||||||
public int getClockPreferredY(int totalHeight) {
|
|
||||||
return mKeyguardClockSwitchController.getClockPreferredY(totalHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the height of the keyguard status view.
|
* Get the height of the keyguard status view.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -62,11 +62,6 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
*/
|
*/
|
||||||
private int mUserSwitchHeight;
|
private int mUserSwitchHeight;
|
||||||
|
|
||||||
/**
|
|
||||||
* Preferred Y position of clock.
|
|
||||||
*/
|
|
||||||
private int mClockPreferredY;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preferred Y position of user avatar used by the multi-user switcher.
|
* Preferred Y position of user avatar used by the multi-user switcher.
|
||||||
*/
|
*/
|
||||||
@@ -176,8 +171,8 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
*/
|
*/
|
||||||
public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom,
|
public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom,
|
||||||
int notificationStackHeight, float panelExpansion, int parentHeight,
|
int notificationStackHeight, float panelExpansion, int parentHeight,
|
||||||
int keyguardStatusHeight, int userSwitchHeight, int clockPreferredY,
|
int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY,
|
||||||
int userSwitchPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark,
|
boolean hasCustomClock, boolean hasVisibleNotifs, float dark,
|
||||||
float overStrechAmount, boolean bypassEnabled, int unlockedStackScrollerPadding,
|
float overStrechAmount, boolean bypassEnabled, int unlockedStackScrollerPadding,
|
||||||
float qsExpansion, int cutoutTopInset, boolean isSplitShade) {
|
float qsExpansion, int cutoutTopInset, boolean isSplitShade) {
|
||||||
mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding,
|
mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding,
|
||||||
@@ -188,7 +183,6 @@ public class KeyguardClockPositionAlgorithm {
|
|||||||
mHeight = parentHeight;
|
mHeight = parentHeight;
|
||||||
mKeyguardStatusHeight = keyguardStatusHeight;
|
mKeyguardStatusHeight = keyguardStatusHeight;
|
||||||
mUserSwitchHeight = userSwitchHeight;
|
mUserSwitchHeight = userSwitchHeight;
|
||||||
mClockPreferredY = clockPreferredY;
|
|
||||||
mUserSwitchPreferredY = userSwitchPreferredY;
|
mUserSwitchPreferredY = userSwitchPreferredY;
|
||||||
mHasCustomClock = hasCustomClock;
|
mHasCustomClock = hasCustomClock;
|
||||||
mHasVisibleNotifs = hasVisibleNotifs;
|
mHasVisibleNotifs = hasVisibleNotifs;
|
||||||
|
|||||||
@@ -1228,7 +1228,6 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
private void updateClockAppearance() {
|
private void updateClockAppearance() {
|
||||||
int totalHeight = mView.getHeight();
|
int totalHeight = mView.getHeight();
|
||||||
int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
|
int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
|
||||||
int clockPreferredY = mKeyguardStatusViewController.getClockPreferredY(totalHeight);
|
|
||||||
int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard;
|
int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard;
|
||||||
boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
|
boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
|
||||||
final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
|
final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
|
||||||
@@ -1249,7 +1248,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
totalHeight,
|
totalHeight,
|
||||||
mKeyguardStatusViewController.getHeight(),
|
mKeyguardStatusViewController.getHeight(),
|
||||||
userIconHeight,
|
userIconHeight,
|
||||||
clockPreferredY, userSwitcherPreferredY, hasCustomClock(),
|
userSwitcherPreferredY, hasCustomClock(),
|
||||||
hasVisibleNotifications, darkamount, mOverStretchAmount,
|
hasVisibleNotifications, darkamount, mOverStretchAmount,
|
||||||
bypassEnabled, getUnlockedStackScrollerPadding(),
|
bypassEnabled, getUnlockedStackScrollerPadding(),
|
||||||
computeQsExpansionFraction(),
|
computeQsExpansionFraction(),
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import org.junit.runner.RunWith;
|
|||||||
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 PREFERRED_CLOCK_Y = SCREEN_HEIGHT / 2;
|
|
||||||
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;
|
||||||
@@ -48,7 +47,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
private float mPanelExpansion;
|
private float mPanelExpansion;
|
||||||
private int mKeyguardStatusHeight;
|
private int mKeyguardStatusHeight;
|
||||||
private float mDark;
|
private float mDark;
|
||||||
private int mPreferredClockY;
|
|
||||||
private boolean mHasCustomClock;
|
private boolean mHasCustomClock;
|
||||||
private boolean mHasVisibleNotifs;
|
private boolean mHasVisibleNotifs;
|
||||||
private float mQsExpansion;
|
private float mQsExpansion;
|
||||||
@@ -60,21 +58,36 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm();
|
mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm();
|
||||||
mClockPosition = new KeyguardClockPositionAlgorithm.Result();
|
mClockPosition = new KeyguardClockPositionAlgorithm.Result();
|
||||||
|
|
||||||
mPreferredClockY = PREFERRED_CLOCK_Y;
|
|
||||||
mHasCustomClock = HAS_CUSTOM_CLOCK;
|
mHasCustomClock = HAS_CUSTOM_CLOCK;
|
||||||
mHasVisibleNotifs = HAS_VISIBLE_NOTIFS;
|
mHasVisibleNotifs = HAS_VISIBLE_NOTIFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clockPositionMiddleOfScreenOnAOD() {
|
public void clockPositionTopOfScreenOnAOD() {
|
||||||
// GIVEN on AOD and both stack scroll and clock have 0 height
|
// GIVEN on AOD and both stack scroll and clock have 0 height
|
||||||
givenAOD();
|
givenAOD();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
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();
|
||||||
// THEN the clock Y position is the middle of the screen (SCREEN_HEIGHT / 2).
|
// THEN the clock Y position is the top of the screen
|
||||||
assertThat(mClockPosition.clockY).isEqualTo(1000);
|
assertThat(mClockPosition.clockY).isEqualTo(0);
|
||||||
|
// AND the clock is opaque and positioned on the left.
|
||||||
|
assertThat(mClockPosition.clockX).isEqualTo(0);
|
||||||
|
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void clockPositionBelowCutout() {
|
||||||
|
// GIVEN on AOD and both stack scroll and clock have 0 height
|
||||||
|
givenAOD();
|
||||||
|
mNotificationStackHeight = EMPTY_HEIGHT;
|
||||||
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
|
mCutoutTopInset = 300;
|
||||||
|
// WHEN the clock position algorithm is run
|
||||||
|
positionClock();
|
||||||
|
// THEN the clock Y position is below the cutout
|
||||||
|
assertThat(mClockPosition.clockY).isEqualTo(300);
|
||||||
// AND the clock is opaque and positioned on the left.
|
// AND the clock is opaque and positioned on the left.
|
||||||
assertThat(mClockPosition.clockX).isEqualTo(0);
|
assertThat(mClockPosition.clockX).isEqualTo(0);
|
||||||
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
||||||
@@ -88,8 +101,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
mKeyguardStatusHeight = 100;
|
mKeyguardStatusHeight = 100;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the clock Y position adjusts for the clock height (SCREEN_HEIGHT / 2 - 100).
|
// THEN the clock Y position is at the top
|
||||||
assertThat(mClockPosition.clockY).isEqualTo(900);
|
assertThat(mClockPosition.clockY).isEqualTo(0);
|
||||||
// AND the clock is opaque and positioned on the left.
|
// AND the clock is opaque and positioned on the left.
|
||||||
assertThat(mClockPosition.clockX).isEqualTo(0);
|
assertThat(mClockPosition.clockX).isEqualTo(0);
|
||||||
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
||||||
@@ -111,18 +124,17 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clockPositionMiddleOfScreenOnLockScreen() {
|
public void clockPositionTopOfScreenOnLockScreen() {
|
||||||
// GIVEN on lock screen with stack scroll and clock of 0 height
|
// GIVEN on lock screen with stack scroll and clock of 0 height
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
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();
|
||||||
// THEN the clock Y position is the middle of the screen (SCREEN_HEIGHT / 2).
|
// THEN the clock Y position is the top of the screen
|
||||||
assertThat(mClockPosition.clockY).isEqualTo(1000);
|
assertThat(mClockPosition.clockY).isEqualTo(0);
|
||||||
// AND the clock is opaque and positioned on the left.
|
// AND the clock is positioned on the left.
|
||||||
assertThat(mClockPosition.clockX).isEqualTo(0);
|
assertThat(mClockPosition.clockX).isEqualTo(0);
|
||||||
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -133,11 +145,10 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
// WHEN the clock position algorithm is run
|
// WHEN the clock position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the clock Y position adjusts for stack scroll height ( (SCREEN_HEIGHT - 500 ) / 2).
|
// THEN the clock Y position stays to the top
|
||||||
assertThat(mClockPosition.clockY).isEqualTo(750);
|
assertThat(mClockPosition.clockY).isEqualTo(0);
|
||||||
// AND the clock is opaque and positioned on the left.
|
// AND the clock is positioned on the left.
|
||||||
assertThat(mClockPosition.clockX).isEqualTo(0);
|
assertThat(mClockPosition.clockX).isEqualTo(0);
|
||||||
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -182,15 +193,15 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void notifPositionMiddleOfScreenOnAOD() {
|
public void notifPositionTopOfScreenOnAOD() {
|
||||||
// GIVEN on AOD and both stack scroll and clock have 0 height
|
// GIVEN on AOD and both stack scroll and clock have 0 height
|
||||||
givenAOD();
|
givenAOD();
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
mNotificationStackHeight = EMPTY_HEIGHT;
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the notif padding is half of the screen (SCREEN_HEIGHT / 2).
|
// THEN the notif padding is 0 (top of screen)
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(1000);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -201,8 +212,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
mKeyguardStatusHeight = 100;
|
mKeyguardStatusHeight = 100;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the notif padding is half of the screen (SCREEN_HEIGHT / 2).
|
// THEN the notif padding adjusts for keyguard status height
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(1000);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -225,8 +236,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the notif padding is half of the screen (SCREEN_HEIGHT / 2).
|
// THEN the notif are placed to the top of the screen
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(1000);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -237,8 +248,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the notif padding adjusts for the expanded notif stack.
|
// THEN the notif padding adjusts for keyguard status height
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(750);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -250,7 +261,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
// 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.
|
// THEN the notif padding adjusts for both clock and notif stack.
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(1000);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -261,8 +272,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
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.
|
// THEN the notifs are placed below the statusview
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(810);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -270,12 +281,11 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
// GIVEN on lock screen and split shade mode
|
// GIVEN on lock screen and split shade mode
|
||||||
givenLockScreen();
|
givenLockScreen();
|
||||||
mIsSplitShade = true;
|
mIsSplitShade = true;
|
||||||
mPreferredClockY = 100;
|
|
||||||
mHasCustomClock = true;
|
mHasCustomClock = true;
|
||||||
// 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.
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(mPreferredClockY);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -286,8 +296,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
mKeyguardStatusHeight = SCREEN_HEIGHT;
|
||||||
// WHEN the position algorithm is run
|
// WHEN the position algorithm is run
|
||||||
positionClock();
|
positionClock();
|
||||||
// THEN the notif padding is half of the screen (SCREEN_HEIGHT / 2).
|
// THEN the notif padding is below keyguard status area
|
||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(1000);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(SCREEN_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -316,58 +326,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
|
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void preferredCustomClockPositionNoNotifications() {
|
|
||||||
// GIVEN on the lock screen with a custom clock and no visible notifications
|
|
||||||
givenLockScreen();
|
|
||||||
mPreferredClockY = 100;
|
|
||||||
mHasCustomClock = true;
|
|
||||||
mHasVisibleNotifs = false;
|
|
||||||
// AND given empty height for clock and stack scroller
|
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
|
||||||
// WHEN the clock position algorithm is run
|
|
||||||
positionClock();
|
|
||||||
// THEN the clock Y position is the preferred Y position.
|
|
||||||
assertThat(mClockPosition.clockY).isEqualTo(100);
|
|
||||||
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void preferredDefaultClockPositionNoNotifications() {
|
|
||||||
// GIVEN on the lock screen with a custom clock and no visible notifications
|
|
||||||
givenLockScreen();
|
|
||||||
mPreferredClockY = 100;
|
|
||||||
mHasCustomClock = false;
|
|
||||||
mHasVisibleNotifs = false;
|
|
||||||
// AND given empty height for clock and stack scroller
|
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
|
||||||
// WHEN the clock position algorithm is run
|
|
||||||
positionClock();
|
|
||||||
// THEN the clock Y position is the middle of the screen (SCREEN_HEIGHT / 2) and not
|
|
||||||
// preferred.
|
|
||||||
assertThat(mClockPosition.clockY).isEqualTo(1000);
|
|
||||||
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void preferredCustomClockPositionWithVisibleNotifications() {
|
|
||||||
// GIVEN on the lock screen with a custom clock and visible notifications
|
|
||||||
givenLockScreen();
|
|
||||||
mPreferredClockY = 100;
|
|
||||||
mHasCustomClock = true;
|
|
||||||
mHasVisibleNotifs = true;
|
|
||||||
// AND given empty height for clock and stack scroller
|
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
|
||||||
// WHEN the clock position algorithm is run
|
|
||||||
positionClock();
|
|
||||||
// THEN the clock Y position is the middle of the screen (SCREEN_HEIGHT / 2).
|
|
||||||
assertThat(mClockPosition.clockY).isEqualTo(1000);
|
|
||||||
assertThat(mClockPosition.clockAlpha).isEqualTo(OPAQUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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 a custom clock and visible notifications
|
||||||
@@ -379,22 +337,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
assertThat(mClockPosition.clockAlpha).isEqualTo(TRANSPARENT);
|
assertThat(mClockPosition.clockAlpha).isEqualTo(TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void preferredCustomClockPositionWithVisibleNotificationsOnAod() {
|
|
||||||
// GIVEN on the lock screen with a custom clock and visible notifications
|
|
||||||
givenAOD();
|
|
||||||
mPreferredClockY = 100;
|
|
||||||
mHasCustomClock = true;
|
|
||||||
mHasVisibleNotifs = true;
|
|
||||||
// AND given empty height for clock and stack scroller
|
|
||||||
mNotificationStackHeight = EMPTY_HEIGHT;
|
|
||||||
mKeyguardStatusHeight = EMPTY_HEIGHT;
|
|
||||||
// WHEN the clock position algorithm is run
|
|
||||||
positionClock();
|
|
||||||
// THEN the clock Y position is the preferred Y position.
|
|
||||||
assertThat(mClockPosition.clockY).isEqualTo(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void givenAOD() {
|
private void givenAOD() {
|
||||||
mPanelExpansion = 1.f;
|
mPanelExpansion = 1.f;
|
||||||
mDark = 1.f;
|
mDark = 1.f;
|
||||||
@@ -408,7 +350,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
|
|||||||
private void positionClock() {
|
private void positionClock() {
|
||||||
mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
|
mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
|
||||||
mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight,
|
mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight,
|
||||||
0 /* userSwitchHeight */, mPreferredClockY, 0 /* userSwitchPreferredY */,
|
0 /* userSwitchHeight */, 0 /* userSwitchPreferredY */,
|
||||||
mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */,
|
mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */,
|
||||||
0 /* unlockedStackScrollerPadding */, mQsExpansion,
|
0 /* unlockedStackScrollerPadding */, mQsExpansion,
|
||||||
mCutoutTopInset, mIsSplitShade);
|
mCutoutTopInset, mIsSplitShade);
|
||||||
|
|||||||
Reference in New Issue
Block a user