AOD - Burn in adjustments

Move both the clock and keyguard slice area towards the middle for x
adjustments, and retain the current Y adjustments.

Bug: 172360102
Test: follow burn in instructions here:
/frameworks/base/packages/SystemUI/docs/clock-plugins.md

Change-Id: Id22d777724bf9be58758b1a2b260a7933af8e999
This commit is contained in:
Matt Pietal
2020-11-03 15:11:20 -05:00
parent 94b76b2267
commit 6a350b53cf
6 changed files with 67 additions and 9 deletions

View File

@@ -22,6 +22,7 @@ import android.text.format.DateFormat;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.android.internal.colorextraction.ColorExtractor;
import com.android.keyguard.clock.ClockManager;
@@ -30,6 +31,9 @@ import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ClockPlugin;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.notification.AnimatableProperty;
import com.android.systemui.statusbar.notification.PropertyAnimator;
import com.android.systemui.statusbar.notification.stack.AnimationProperties;
import com.android.systemui.statusbar.phone.NotificationIconAreaController;
import com.android.systemui.statusbar.phone.NotificationIconContainer;
import com.android.systemui.util.ViewController;
@@ -51,6 +55,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
private final ClockManager mClockManager;
private final KeyguardSliceViewController mKeyguardSliceViewController;
private final NotificationIconAreaController mNotificationIconAreaController;
private FrameLayout mNewLockscreenClockFrame;
private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL;
@@ -114,6 +119,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mColorExtractor.addOnColorsChangedListener(mColorsListener);
mView.updateColors(getGradientColors());
updateAodIcons();
mNewLockscreenClockFrame = mView.findViewById(R.id.new_lockscreen_clock_view);
}
@Override
@@ -179,6 +185,21 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mView.refresh();
}
/**
* Update position of the view, with optional animation. Move the slice view and the clock
* slightly towards the center in order to prevent burn-in. Y positioning occurs at the
* view parent level.
*/
void updatePosition(int x, AnimationProperties props, boolean animate) {
x = Math.abs(x);
if (mNewLockscreenClockFrame != null) {
PropertyAnimator.setProperty(mNewLockscreenClockFrame, AnimatableProperty.TRANSLATION_X,
-x, props, animate);
}
mKeyguardSliceViewController.updatePosition(x, props, animate);
mNotificationIconAreaController.updatePosition(x, props, animate);
}
/**
* Update lockscreen mode that may change clock display.
*/