diff options
7 files changed, 70 insertions, 0 deletions
| diff --git a/packages/SystemUI/plugin/bcsmartspace/src/com/android/systemui/plugins/BcSmartspaceDataPlugin.java b/packages/SystemUI/plugin/bcsmartspace/src/com/android/systemui/plugins/BcSmartspaceDataPlugin.java index 1811c02d549d..64c0f99f4ba7 100644 --- a/packages/SystemUI/plugin/bcsmartspace/src/com/android/systemui/plugins/BcSmartspaceDataPlugin.java +++ b/packages/SystemUI/plugin/bcsmartspace/src/com/android/systemui/plugins/BcSmartspaceDataPlugin.java @@ -128,6 +128,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.           */          default void setKeyguardBypassEnabled(boolean enabled) {} diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java index 41c1eda42e83..a0261309d61a 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java @@ -352,6 +352,13 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS      }      /** +     * 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.       */ diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java index 00500d617766..6854c97c3415 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java @@ -323,6 +323,13 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV      }      /** +     * 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.       */      public void updateAlignment( @@ -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 diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 8123627193d0..3acfe6c22134 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -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); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt index 518825cea5e0..6c1dc8c0a51d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt @@ -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.       */ diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java index b21cc6dde815..9e561ed290f7 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java @@ -408,4 +408,18 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {                  any(ClockRegistry.ClockChangeListener.class));          verify(mClockEventController, times).registerListeners(mView);      } + +    @Test +    public void testSplitShadeEnabledSetToSmartspaceController() { +        mController.setSplitShadeEnabled(true); +        verify(mSmartspaceController, times(1)).setSplitShadeEnabled(true); +        verify(mSmartspaceController, times(0)).setSplitShadeEnabled(false); +    } + +    @Test +    public void testSplitShadeDisabledSetToSmartspaceController() { +        mController.setSplitShadeEnabled(false); +        verify(mSmartspaceController, times(1)).setSplitShadeEnabled(false); +        verify(mSmartspaceController, times(0)).setSplitShadeEnabled(true); +    }  } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java index a2c632936047..512e5dc1a0d6 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java @@ -17,6 +17,7 @@  package com.android.keyguard;  import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times;  import static org.mockito.Mockito.verify;  import static org.mockito.Mockito.when; @@ -155,4 +156,18 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase {          verify(mControllerMock).setProperty(AnimatableProperty.SCALE_X, 20f, true);          verify(mControllerMock).setProperty(AnimatableProperty.SCALE_Y, 20f, true);      } + +    @Test +    public void splitShadeEnabledPassedToClockSwitchController() { +        mController.setSplitShadeEnabled(true); +        verify(mKeyguardClockSwitchController, times(1)).setSplitShadeEnabled(true); +        verify(mKeyguardClockSwitchController, times(0)).setSplitShadeEnabled(false); +    } + +    @Test +    public void splitShadeDisabledPassedToClockSwitchController() { +        mController.setSplitShadeEnabled(false); +        verify(mKeyguardClockSwitchController, times(1)).setSplitShadeEnabled(false); +        verify(mKeyguardClockSwitchController, times(0)).setSplitShadeEnabled(true); +    }  } |