diff options
| -rw-r--r-- | packages/SystemUI/res/values/dimens.xml | 12 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java | 16 |
2 files changed, 16 insertions, 12 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 786edf2becd7..f62249a74cdb 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -922,14 +922,18 @@ <dimen name="global_actions_translate">9dp</dimen> - <!-- the maximum offset in either direction that elements are moved horizontally to prevent - burn-in on AOD --> + <!-- The maximum offset in either direction that elements are moved horizontally to prevent + burn-in on AOD. --> <dimen name="burn_in_prevention_offset_x">8dp</dimen> - <!-- the maximum offset in either direction that elements are moved vertically to prevent - burn-in on AOD --> + <!-- The maximum offset in either direction that elements are moved vertically to prevent + burn-in on AOD. --> <dimen name="burn_in_prevention_offset_y">50dp</dimen> + <!-- The maximum offset in either direction that the charging indication moves vertically + to prevent burn-in on AOD. --> + <dimen name="charging_indication_burn_in_prevention_offset_y">5dp</dimen> + <dimen name="corner_size">8dp</dimen> <dimen name="top_padding">0dp</dimen> <dimen name="bottom_padding">48dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 25b97bb96373..d89bcdaffe3e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -174,6 +174,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private int mIndicationBottomMarginAmbient; private float mDarkAmount; private int mBurnInXOffset; + private int mBurnInYOffset; public KeyguardBottomAreaView(Context context) { this(context, null); @@ -247,6 +248,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL R.dimen.keyguard_indication_margin_bottom); mIndicationBottomMarginAmbient = getResources().getDimensionPixelSize( R.dimen.keyguard_indication_margin_bottom_ambient); + mBurnInYOffset = getResources().getDimensionPixelSize( + R.dimen.charging_indication_burn_in_prevention_offset_y); updateCameraVisibility(); mUnlockMethodCache = UnlockMethodCache.getInstance(getContext()); mUnlockMethodCache.addListener(this); @@ -319,6 +322,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL R.dimen.keyguard_indication_margin_bottom); mIndicationBottomMarginAmbient = getResources().getDimensionPixelSize( R.dimen.keyguard_indication_margin_bottom_ambient); + mBurnInYOffset = getResources().getDimensionPixelSize( + R.dimen.charging_indication_burn_in_prevention_offset_y); MarginLayoutParams mlp = (MarginLayoutParams) mIndicationArea.getLayoutParams(); if (mlp.bottomMargin != mIndicationBottomMargin) { mlp.bottomMargin = mIndicationBottomMargin; @@ -562,12 +567,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return; } mDarkAmount = darkAmount; - // Let's randomize the bottom margin every time we wake up to avoid burn-in. - if (darkAmount == 0) { - mIndicationBottomMarginAmbient = getResources().getDimensionPixelSize( - R.dimen.keyguard_indication_margin_bottom_ambient) - + (int) (Math.random() * mIndicationText.getTextSize()); - } mIndicationArea.setAlpha(MathUtils.lerp(1f, 0.7f, darkAmount)); mIndicationArea.setTranslationY(MathUtils.lerp(0, mIndicationBottomMargin - mIndicationBottomMarginAmbient, darkAmount)); @@ -844,8 +843,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL public void dozeTimeTick() { if (mDarkAmount == 1) { // Move indication every minute to avoid burn-in - final int dozeTranslation = mIndicationBottomMargin - mIndicationBottomMarginAmbient; - mIndicationArea.setTranslationY(dozeTranslation + (float) Math.random() * 5); + int dozeTranslation = mIndicationBottomMargin - mIndicationBottomMarginAmbient; + int burnInYOffset = (int) (-mBurnInYOffset + Math.random() * mBurnInYOffset * 2); + mIndicationArea.setTranslationY(dozeTranslation + burnInYOffset); } } |