Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1386acd authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

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
parent eb260e9a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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.
     */
+23 −4
Original line number Diff line number Diff line
@@ -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<KeyguardStat
    private final Object mLock = new Object();
    private final KeyguardLogger mLogger;

    // TODO(b/273443374): remove
    private NotificationMediaManager mNotificationMediaManager;

    private final ConfigurationController.ConfigurationListener mConfigurationListener =
            new ConfigurationController.ConfigurationListener() {
                @Override
@@ -283,7 +287,8 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
            SecureSettings secureSettings,
            CommandQueue commandQueue,
            @Main Executor mainExecutor,
            KeyguardLogger logger
            KeyguardLogger logger,
            NotificationMediaManager notificationMediaManager
    ) {
        super(view);
        mCarrierTextController = carrierTextController;
@@ -335,6 +340,7 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
                /* mask2= */ DISABLE2_SYSTEM_ICONS,
                this::updateViewState
        );
        mNotificationMediaManager = notificationMediaManager;
    }

    @Override
@@ -484,8 +490,11 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
                    * (1.0f - mKeyguardHeadsUpShowingAmount);
        }

        if (mSystemEventAnimator.isAnimationRunning()) {
        if (mSystemEventAnimator.isAnimationRunning()
                && !mNotificationMediaManager.isLockscreenWallpaperOnNotificationShade()) {
            newAlpha = Math.min(newAlpha, mSystemEventAnimatorAlpha);
        } else {
            mView.setTranslationX(0);
        }

        boolean hideForBypass =
@@ -625,11 +634,21 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat

    private StatusBarSystemEventDefaultAnimator getSystemEventAnimator(boolean isAnimationRunning) {
        return new StatusBarSystemEventDefaultAnimator(getResources(), (alpha) -> {
            // TODO(b/273443374): remove if-else condition
            if (!mNotificationMediaManager.isLockscreenWallpaperOnNotificationShade()) {
                mSystemEventAnimatorAlpha = alpha;
            } else {
                mSystemEventAnimatorAlpha = 1f;
            }
            updateViewState();
            return Unit.INSTANCE;
        }, (translationX) -> {
            // TODO(b/273443374): remove if-else condition
            if (!mNotificationMediaManager.isLockscreenWallpaperOnNotificationShade()) {
                mView.setTranslationX(translationX);
            } else {
                mView.setTranslationX(0);
            }
            return Unit.INSTANCE;
        }, isAnimationRunning);
    }
+5 −0
Original line number Diff line number Diff line
@@ -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() + ":");
+5 −1
Original line number Diff line number Diff line
@@ -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
        );
    }