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.
*/

View File

@@ -42,6 +42,9 @@ import com.android.systemui.Dumpable;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardSliceProvider;
import com.android.systemui.plugins.ActivityStarter;
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.policy.ConfigurationController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.ViewController;
@@ -199,6 +202,13 @@ public class KeyguardSliceViewController extends ViewController<KeyguardSliceVie
Trace.endSection();
}
/**
* Update position of the view, with optional animation
*/
void updatePosition(int x, AnimationProperties props, boolean animate) {
PropertyAnimator.setProperty(mView, AnimatableProperty.TRANSLATION_X, x, props, animate);
}
void showSlice(Slice slice) {
Trace.beginSection("KeyguardSliceViewController#showSlice");
if (slice == null) {

View File

@@ -186,12 +186,23 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
/**
* Update position of the view with an optional animation
*/
public void updatePosition(int clockTranslationX, int clockTranslationY,
boolean animateClock) {
PropertyAnimator.setProperty(mView, AnimatableProperty.X,
clockTranslationX, CLOCK_ANIMATION_PROPERTIES, animateClock);
PropertyAnimator.setProperty(mView, AnimatableProperty.Y,
clockTranslationY, CLOCK_ANIMATION_PROPERTIES, animateClock);
public void updatePosition(int x, int y, boolean animate) {
PropertyAnimator.setProperty(mView, AnimatableProperty.Y, y, CLOCK_ANIMATION_PROPERTIES,
animate);
if (mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) {
// reset any prior movement
PropertyAnimator.setProperty(mView, AnimatableProperty.X, 0,
CLOCK_ANIMATION_PROPERTIES, animate);
mKeyguardClockSwitchController.updatePosition(x, CLOCK_ANIMATION_PROPERTIES, animate);
} else {
// reset any prior movement
mKeyguardClockSwitchController.updatePosition(0, CLOCK_ANIMATION_PROPERTIES, animate);
PropertyAnimator.setProperty(mView, AnimatableProperty.X, x,
CLOCK_ANIMATION_PROPERTIES, animate);
}
}
/**

View File

@@ -16,9 +16,7 @@
package com.android.systemui.statusbar.notification;
import android.graphics.drawable.Drawable;
import android.util.FloatProperty;
import android.util.Log;
import android.util.Property;
import android.view.View;
@@ -34,9 +32,14 @@ public abstract class AnimatableProperty {
public static final AnimatableProperty X = AnimatableProperty.from(View.X,
R.id.x_animator_tag, R.id.x_animator_tag_start_value, R.id.x_animator_tag_end_value);
public static final AnimatableProperty Y = AnimatableProperty.from(View.Y,
R.id.y_animator_tag, R.id.y_animator_tag_start_value, R.id.y_animator_tag_end_value);
public static final AnimatableProperty TRANSLATION_X = AnimatableProperty.from(
View.TRANSLATION_X, R.id.x_animator_tag, R.id.x_animator_tag_start_value,
R.id.x_animator_tag_end_value);
/**
* Similar to X, however this doesn't allow for any other modifications other than from this
* property. When using X, it's possible that the view is laid out during the animation,

View File

@@ -257,7 +257,7 @@ public class KeyguardClockPositionAlgorithm {
// TODO(b/12836565) - prototyping only adjustment
if (mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL) {
// This will keep the clock at the top for AOD
darkAmount = 0f;
return (int) (clockY + burnInPreventionOffsetY() + mEmptyDragAmount);
}
return (int) (MathUtils.lerp(clockY, clockYDark, darkAmount) + mEmptyDragAmount);

View File

@@ -31,10 +31,13 @@ import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.notification.AnimatableProperty;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.PropertyAnimator;
import com.android.systemui.statusbar.notification.collection.ListEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.stack.AnimationProperties;
import com.android.wm.shell.bubbles.Bubbles;
import java.util.ArrayList;
@@ -175,6 +178,16 @@ public class NotificationIconAreaController implements
updateIconLayoutParams(mContext);
}
/**
* Update position of the view, with optional animation
*/
public void updatePosition(int x, AnimationProperties props, boolean animate) {
if (mAodIcons != null) {
PropertyAnimator.setProperty(mAodIcons, AnimatableProperty.TRANSLATION_X, x, props,
animate);
}
}
public void setupShelf(NotificationShelfController notificationShelfController) {
mShelfIcons = notificationShelfController.getShelfIcons();
notificationShelfController.setCollapsedIcons(mNotificationIcons);