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

Commit 6458bb87 authored by Kateryna Ivanova's avatar Kateryna Ivanova Committed by Android Build Coastguard Worker
Browse files

Improve transition between AOD and lockscreen when media is playing for

split shade

* hide the targets before AOD -> Lockscreen transition to avoid jump of
the media object

Bug: 174229939
Test: manual test for switching between AOD and lockscreen while media
is playing and with ring doorbell card
Test: atest CardPagerAdapterTest, BcSmartspaceViewTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1adcfa6eb12c8562b41e6ac5d4f2c6e90c65378d)
Merged-In: I9ad176b726beb2b7d7e07eb9b4c42d0f317ed53c
Change-Id: I9ad176b726beb2b7d7e07eb9b4c42d0f317ed53c
parent d31907c0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -127,6 +127,16 @@ public interface BcSmartspaceDataPlugin extends Plugin {
         */
        void setDozeAmount(float amount);

        /**
         * Set if dozing is true or false
         */
        default void setDozing(boolean dozing) {}

        /**
         * Set if split shade enabled
         */
        default void setSplitShadeEnabled(boolean enabled) {}

        /**
         * Set the current keyguard bypass enabled status.
         */
+7 −0
Original line number Diff line number Diff line
@@ -351,6 +351,13 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        mView.setSplitShadeCentered(splitShadeCentered);
    }

    /**
     * Set if the split shade is enabled
     */
    public void setSplitShadeEnabled(boolean splitShadeEnabled) {
        mSmartspaceController.setSplitShadeEnabled(splitShadeEnabled);
    }

    /**
     * Set which clock should be displayed on the keyguard. The other one will be automatically
     * hidden.
+10 −0
Original line number Diff line number Diff line
@@ -322,6 +322,13 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
        return clock != null && clock.getLargeClock().getConfig().getHasCustomWeatherDataDisplay();
    }

    /**
     * Set if the split shade is enabled
     */
    public void setSplitShadeEnabled(boolean enabled) {
        mKeyguardClockSwitchController.setSplitShadeEnabled(enabled);
    }

    /**
     * Updates the alignment of the KeyguardStatusView and animates the transition if requested.
     */
@@ -350,6 +357,9 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
        }

        mInteractionJankMonitor.begin(mView, CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION);
        /* This transition blocks any layout changes while running. For that reason
        * special logic with setting visibility was added to {@link BcSmartspaceView#setDozing}
        * for split shade to avoid jump of the media object. */
        ChangeBounds transition = new ChangeBounds();
        if (splitShadeEnabled) {
            // Excluding media from the transition on split-shade, as it doesn't transition
+2 −0
Original line number Diff line number Diff line
@@ -1172,6 +1172,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
                mKeyguardStatusViewComponentFactory.build(keyguardStatusView);
        mKeyguardStatusViewController = statusViewComponent.getKeyguardStatusViewController();
        mKeyguardStatusViewController.init();
        mKeyguardStatusViewController.setSplitShadeEnabled(mSplitShadeEnabled);
        updateClockAppearance();

        if (mKeyguardUserSwitcherController != null) {
@@ -1224,6 +1225,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump

    private void onSplitShadeEnabledChanged() {
        mShadeLog.logSplitShadeChanged(mSplitShadeEnabled);
        mKeyguardStatusViewController.setSplitShadeEnabled(mSplitShadeEnabled);
        // Reset any left over overscroll state. It is a rare corner case but can happen.
        mQsController.setOverScrollAmount(0);
        mScrimController.setNotificationsOverScrollAmount(0);
+12 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ constructor(
    private var showSensitiveContentForCurrentUser = false
    private var showSensitiveContentForManagedUser = false
    private var managedUserHandle: UserHandle? = null
    private var mSplitShadeEnabled = false

    // TODO(b/202758428): refactor so that we can test color updates via region samping, similar to
    //  how we test color updates when theme changes (See testThemeChangeUpdatesTextColor).
@@ -131,6 +132,7 @@ constructor(
    // TODO: Move logic into SmartspaceView
    var stateChangeListener = object : View.OnAttachStateChangeListener {
        override fun onViewAttachedToWindow(v: View) {
            (v as SmartspaceView).setSplitShadeEnabled(mSplitShadeEnabled)
            smartspaceViews.add(v as SmartspaceView)

            connectSession()
@@ -216,6 +218,11 @@ constructor(
            execution.assertIsMainThread()
            smartspaceViews.forEach { it.setDozeAmount(eased) }
        }

        override fun onDozingChanged(isDozing: Boolean) {
            execution.assertIsMainThread()
            smartspaceViews.forEach { it.setDozing(isDozing) }
        }
    }

    private val deviceProvisionedListener =
@@ -421,6 +428,11 @@ constructor(
        reloadSmartspace()
    }

    fun setSplitShadeEnabled(enabled: Boolean) {
        mSplitShadeEnabled = enabled
        smartspaceViews.forEach { it.setSplitShadeEnabled(enabled) }
    }

    /**
     * Requests the smartspace session for an update.
     */
Loading