Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +13 −5 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import com.android.systemui.R; * Utility class to calculate the clock position and top padding of notifications on Keyguard. */ 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 Loading Loading @@ -80,6 +79,11 @@ public class KeyguardClockPositionAlgorithm { */ private int mMinTopMargin; /** * Minimum top inset (in pixels) to avoid overlap with any display cutouts. */ private int mCutoutTopInset = 0; /** * Maximum bottom padding to avoid overlap with {@link KeyguardBottomAreaView} or * the ambient indication. Loading Loading @@ -172,7 +176,7 @@ public class KeyguardClockPositionAlgorithm { float panelExpansion, int parentHeight, int keyguardStatusHeight, int clockPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount, boolean bypassEnabled, int unlockedStackScrollerPadding, boolean showLockIcon, float qsExpansion) { float qsExpansion, int cutoutTopInset) { mMinTopMargin = statusBarMinHeight + (showLockIcon ? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon); mMaxShadeBottom = maxShadeBottom; Loading @@ -188,6 +192,7 @@ public class KeyguardClockPositionAlgorithm { mBypassEnabled = bypassEnabled; mUnlockedStackScrollerPadding = unlockedStackScrollerPadding; mQsExpansion = qsExpansion; mCutoutTopInset = cutoutTopInset; } public void run(Result result) { Loading Loading @@ -270,10 +275,13 @@ public class KeyguardClockPositionAlgorithm { float darkAmount = mBypassEnabled && !mHasCustomClock ? 1.0f : mDarkAmount; // TODO(b/12836565) - prototyping only adjustment if (mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL) { // This will keep the clock at the top clockYDark = (int) (clockY + burnInPreventionOffsetY()); // This will keep the clock at the top but out of the cutout area float shift = 0; if (clockY - mBurnInPreventionOffsetYLargeClock < mCutoutTopInset) { shift = mCutoutTopInset - (clockY - mBurnInPreventionOffsetYLargeClock); } clockYDark = clockY + burnInPreventionOffsetY() + shift; } return (int) (MathUtils.lerp(clockY, clockYDark, darkAmount) + mEmptyDragAmount); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +7 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.os.PowerManager; import android.os.SystemClock; import android.util.Log; import android.util.MathUtils; import android.view.DisplayCutout; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.VelocityTracker; Loading Loading @@ -344,6 +345,7 @@ public class NotificationPanelViewController extends PanelViewController { private float mEmptyDragAmount; private float mDownX; private float mDownY; private int mDisplayCutoutTopInset = 0; // in pixels private final KeyguardClockPositionAlgorithm mClockPositionAlgorithm = Loading Loading @@ -909,7 +911,8 @@ public class NotificationPanelViewController extends PanelViewController { hasVisibleNotifications, mInterpolatedDarkAmount, mEmptyDragAmount, bypassEnabled, getUnlockedStackScrollerPadding(), mUpdateMonitor.shouldShowLockIcon(), getQsExpansionFraction()); getQsExpansionFraction(), mDisplayCutoutTopInset); mClockPositionAlgorithm.run(mClockPositionResult); mKeyguardStatusViewController.updatePosition( mClockPositionResult.clockX, mClockPositionResult.clockY, Loading Loading @@ -3835,6 +3838,9 @@ public class NotificationPanelViewController extends PanelViewController { private class OnApplyWindowInsetsListener implements View.OnApplyWindowInsetsListener { public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { final DisplayCutout displayCutout = v.getRootWindowInsets().getDisplayCutout(); mDisplayCutoutTopInset = displayCutout != null ? displayCutout.getSafeInsetTop() : 0; mNavigationBarBottomHeight = insets.getStableInsetBottom(); updateMaxHeadsUpTranslation(); return insets; Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase { private boolean mHasCustomClock; private boolean mHasVisibleNotifs; private float mQsExpansion; private int mCutoutTopInset = 0; // in pixels @Before public void setUp() { Loading Loading @@ -394,7 +395,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase { mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight, mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight, mPreferredClockY, mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */, 0 /* unlockedStackScrollerPadding */, false /* udfpsEnrolled */, mQsExpansion); 0 /* unlockedStackScrollerPadding */, false /* udfpsEnrolled */, mQsExpansion, mCutoutTopInset); mClockPositionAlgorithm.run(mClockPosition); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +13 −5 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import com.android.systemui.R; * Utility class to calculate the clock position and top padding of notifications on Keyguard. */ 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 Loading Loading @@ -80,6 +79,11 @@ public class KeyguardClockPositionAlgorithm { */ private int mMinTopMargin; /** * Minimum top inset (in pixels) to avoid overlap with any display cutouts. */ private int mCutoutTopInset = 0; /** * Maximum bottom padding to avoid overlap with {@link KeyguardBottomAreaView} or * the ambient indication. Loading Loading @@ -172,7 +176,7 @@ public class KeyguardClockPositionAlgorithm { float panelExpansion, int parentHeight, int keyguardStatusHeight, int clockPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount, boolean bypassEnabled, int unlockedStackScrollerPadding, boolean showLockIcon, float qsExpansion) { float qsExpansion, int cutoutTopInset) { mMinTopMargin = statusBarMinHeight + (showLockIcon ? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon); mMaxShadeBottom = maxShadeBottom; Loading @@ -188,6 +192,7 @@ public class KeyguardClockPositionAlgorithm { mBypassEnabled = bypassEnabled; mUnlockedStackScrollerPadding = unlockedStackScrollerPadding; mQsExpansion = qsExpansion; mCutoutTopInset = cutoutTopInset; } public void run(Result result) { Loading Loading @@ -270,10 +275,13 @@ public class KeyguardClockPositionAlgorithm { float darkAmount = mBypassEnabled && !mHasCustomClock ? 1.0f : mDarkAmount; // TODO(b/12836565) - prototyping only adjustment if (mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL) { // This will keep the clock at the top clockYDark = (int) (clockY + burnInPreventionOffsetY()); // This will keep the clock at the top but out of the cutout area float shift = 0; if (clockY - mBurnInPreventionOffsetYLargeClock < mCutoutTopInset) { shift = mCutoutTopInset - (clockY - mBurnInPreventionOffsetYLargeClock); } clockYDark = clockY + burnInPreventionOffsetY() + shift; } return (int) (MathUtils.lerp(clockY, clockYDark, darkAmount) + mEmptyDragAmount); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +7 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.os.PowerManager; import android.os.SystemClock; import android.util.Log; import android.util.MathUtils; import android.view.DisplayCutout; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.VelocityTracker; Loading Loading @@ -344,6 +345,7 @@ public class NotificationPanelViewController extends PanelViewController { private float mEmptyDragAmount; private float mDownX; private float mDownY; private int mDisplayCutoutTopInset = 0; // in pixels private final KeyguardClockPositionAlgorithm mClockPositionAlgorithm = Loading Loading @@ -909,7 +911,8 @@ public class NotificationPanelViewController extends PanelViewController { hasVisibleNotifications, mInterpolatedDarkAmount, mEmptyDragAmount, bypassEnabled, getUnlockedStackScrollerPadding(), mUpdateMonitor.shouldShowLockIcon(), getQsExpansionFraction()); getQsExpansionFraction(), mDisplayCutoutTopInset); mClockPositionAlgorithm.run(mClockPositionResult); mKeyguardStatusViewController.updatePosition( mClockPositionResult.clockX, mClockPositionResult.clockY, Loading Loading @@ -3835,6 +3838,9 @@ public class NotificationPanelViewController extends PanelViewController { private class OnApplyWindowInsetsListener implements View.OnApplyWindowInsetsListener { public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { final DisplayCutout displayCutout = v.getRootWindowInsets().getDisplayCutout(); mDisplayCutoutTopInset = displayCutout != null ? displayCutout.getSafeInsetTop() : 0; mNavigationBarBottomHeight = insets.getStableInsetBottom(); updateMaxHeadsUpTranslation(); return insets; Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase { private boolean mHasCustomClock; private boolean mHasVisibleNotifs; private float mQsExpansion; private int mCutoutTopInset = 0; // in pixels @Before public void setUp() { Loading Loading @@ -394,7 +395,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase { mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight, mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight, mPreferredClockY, mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */, 0 /* unlockedStackScrollerPadding */, false /* udfpsEnrolled */, mQsExpansion); 0 /* unlockedStackScrollerPadding */, false /* udfpsEnrolled */, mQsExpansion, mCutoutTopInset); mClockPositionAlgorithm.run(mClockPosition); } }