From e1386acd9ca8f2fbd8f8f6b9aa001359f3434bd9 Mon Sep 17 00:00:00 2001 From: Johannes Gallmann Date: Thu, 6 Apr 2023 16:11:57 +0200 Subject: [PATCH] Temporary workaround for plug-in chips on the lockscreen This change disables the chip animation for the lock screen statusbar when the user has two different wallpapers on the lockscreen and homescreen due to the reasons described in b/275209644. This CL can be reverted as soon as the LOCKSCREEN_LIVE_WALLPAPER flag reaches droidfood. Bug: 275209644 Test: Manual, i.e. testing plug-in chips on the lockscreen and homescreen with different wallpaper configurations (same wallpapers, different wallpapers, live wallpapers). Switching between lockscreen and homescreen during chip animations. Change-Id: I67ac4f60848b24c26542098f9372504a0ebfe9f9 --- .../statusbar/NotificationMediaManager.java | 7 +++++ .../KeyguardStatusBarViewController.java | 27 ++++++++++++++++--- .../statusbar/phone/LockscreenWallpaper.java | 5 ++++ .../KeyguardStatusBarViewControllerTest.java | 6 ++++- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java index ced725e0b1d60..ea9817c68c30d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java @@ -702,6 +702,13 @@ public class NotificationMediaManager implements Dumpable { mProcessArtworkTasks.remove(task); } + // TODO(b/273443374): remove + public boolean isLockscreenWallpaperOnNotificationShade() { + return mBackdrop != null && mLockscreenWallpaper != null + && !mLockscreenWallpaper.isLockscreenLiveWallpaperEnabled() + && (mBackdropFront.isVisibleToUser() || mBackdropBack.isVisibleToUser()); + } + /** * {@link AsyncTask} to prepare album art for use as backdrop on lock screen. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java index 3268032becf89..2814e8d8f97b1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java @@ -49,6 +49,7 @@ import com.android.systemui.plugins.log.LogLevel; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shade.NotificationPanelViewController; import com.android.systemui.statusbar.CommandQueue; +import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.disableflags.DisableStateTracker; @@ -119,6 +120,9 @@ public class KeyguardStatusBarViewController extends ViewController { - mSystemEventAnimatorAlpha = alpha; + // TODO(b/273443374): remove if-else condition + if (!mNotificationMediaManager.isLockscreenWallpaperOnNotificationShade()) { + mSystemEventAnimatorAlpha = alpha; + } else { + mSystemEventAnimatorAlpha = 1f; + } updateViewState(); return Unit.INSTANCE; }, (translationX) -> { - mView.setTranslationX(translationX); + // TODO(b/273443374): remove if-else condition + if (!mNotificationMediaManager.isLockscreenWallpaperOnNotificationShade()) { + mView.setTranslationX(translationX); + } else { + mView.setTranslationX(0); + } return Unit.INSTANCE; }, isAnimationRunning); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java index 0814ea593a0bb..c16877a999f3a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java @@ -233,6 +233,11 @@ public class LockscreenWallpaper extends IWallpaperManagerCallback.Stub implemen }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } + // TODO(b/273443374): remove + public boolean isLockscreenLiveWallpaperEnabled() { + return mWallpaperManager.isLockscreenLiveWallpaperEnabled(); + } + @Override public void dump(@NonNull PrintWriter pw, @NonNull String[] args) { pw.println(getClass().getSimpleName() + ":"); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java index eb0b9b3a3fb15..760a90b4d59a8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java @@ -54,6 +54,7 @@ import com.android.systemui.battery.BatteryMeterViewController; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shade.NotificationPanelViewController; import com.android.systemui.statusbar.CommandQueue; +import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler; import com.android.systemui.statusbar.policy.BatteryController; @@ -120,6 +121,8 @@ public class KeyguardStatusBarViewControllerTest extends SysuiTestCase { @Mock private CommandQueue mCommandQueue; @Mock private KeyguardLogger mLogger; + @Mock private NotificationMediaManager mNotificationMediaManager; + private TestNotificationPanelViewStateProvider mNotificationPanelViewStateProvider; private KeyguardStatusBarView mKeyguardStatusBarView; private KeyguardStatusBarViewController mController; @@ -167,7 +170,8 @@ public class KeyguardStatusBarViewControllerTest extends SysuiTestCase { mSecureSettings, mCommandQueue, mFakeExecutor, - mLogger + mLogger, + mNotificationMediaManager ); }