From 278e7d6db351930a199b2f864809b7c22b971a71 Mon Sep 17 00:00:00 2001 From: Bill Lin Date: Wed, 13 Jun 2018 18:07:15 +0800 Subject: [PATCH] Only enable setAntiBurnInOffsetX() in AOD(Ambient) condition NotificationPanelView detect the ACTION_DOWN X-position for expanding Panel and dispatch x-offset to QSFrame and StackScroller However, StackScroller reset the translateX via updateAntiBurnInTranslation() Base on previous patches to enhance setAntiBurnInOffsetX policy 1. ag/3536525 (Fixes: 72527703) 2. ag/3846247 (Fixes: 77541088) Test: atest packages/SystemUI/tests/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayoutTest.java Change-Id: I52c86e865d97282e40b6f2847a2ff0190e4d80e9 Fix: 110102296 --- .../statusbar/phone/NotificationPanelView.java | 2 +- .../stack/NotificationStackScrollLayout.java | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 95ae2c4ad9062..2d8b54527cb9b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -2489,7 +2489,7 @@ public class NotificationPanelView extends PanelView implements } protected void setVerticalPanelTranslation(float translation) { - mNotificationStackScroller.setTranslationX(translation); + mNotificationStackScroller.setVerticalPanelTranslation(translation); mQsFrame.setTranslationX(translation); int size = mVerticalTranslationListener.size(); for (int i = 0; i < size; i++) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 01ee7f1230af0..9d0d295a26ca1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -422,6 +422,7 @@ public class NotificationStackScrollLayout extends ViewGroup private int mHeadsUpInset; private HeadsUpAppearanceController mHeadsUpAppearanceController; private NotificationIconAreaController mIconAreaController; + private float mVerticalPanelTranslation; public NotificationStackScrollLayout(Context context) { this(context, null); @@ -4003,8 +4004,13 @@ public class NotificationStackScrollLayout extends ViewGroup notifyHeightChangeListener(mShelf); } - private void updateAntiBurnInTranslation() { - setTranslationX(mAntiBurnInOffsetX * mDarkAmount); + private void updatePanelTranslation() { + setTranslationX(mVerticalPanelTranslation + mAntiBurnInOffsetX * mDarkAmount); + } + + public void setVerticalPanelTranslation(float verticalPanelTranslation) { + mVerticalPanelTranslation = verticalPanelTranslation; + updatePanelTranslation(); } /** @@ -4034,7 +4040,7 @@ public class NotificationStackScrollLayout extends ViewGroup } updateAlgorithmHeightAndPadding(); updateBackgroundDimming(); - updateAntiBurnInTranslation(); + updatePanelTranslation(); requestChildrenUpdate(); } @@ -4602,7 +4608,7 @@ public class NotificationStackScrollLayout extends ViewGroup public void setAntiBurnInOffsetX(int antiBurnInOffsetX) { mAntiBurnInOffsetX = antiBurnInOffsetX; - updateAntiBurnInTranslation(); + updatePanelTranslation(); } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {