diff options
3 files changed, 70 insertions, 29 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java b/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java index 317d88585958..ebb98883c679 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java @@ -18,6 +18,7 @@ package com.android.systemui.shade; import android.view.MotionEvent; +import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.CentralSurfaces; @@ -39,16 +40,24 @@ public interface ShadeController { void instantCollapseShade(); /** See {@link #animateCollapseShade(int, boolean, boolean, float)}. */ - void animateCollapseShade(); + default void animateCollapseShade() { + animateCollapseShade(CommandQueue.FLAG_EXCLUDE_NONE); + } /** See {@link #animateCollapseShade(int, boolean, boolean, float)}. */ - void animateCollapseShade(int flags); + default void animateCollapseShade(int flags) { + animateCollapseShade(flags, false, false, 1.0f); + } /** See {@link #animateCollapseShade(int, boolean, boolean, float)}. */ - void animateCollapseShadeForced(); + default void animateCollapseShadeForced() { + animateCollapseShade(CommandQueue.FLAG_EXCLUDE_NONE, true, false, 1.0f); + } /** See {@link #animateCollapseShade(int, boolean, boolean, float)}. */ - void animateCollapseShadeForcedDelayed(); + default void animateCollapseShadeForcedDelayed() { + animateCollapseShade(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true, true, 1.0f); + } /** * Collapse the shade animated, showing the bouncer when on {@link StatusBarState#KEYGUARD} or @@ -155,17 +164,17 @@ public interface ShadeController { void onLaunchAnimationEnd(boolean launchIsFullScreen); /** Sets the listener for when the visibility of the shade changes. */ - void setVisibilityListener(ShadeVisibilityListener listener); + default void setVisibilityListener(ShadeVisibilityListener listener) {}; /** */ - void setNotificationPresenter(NotificationPresenter presenter); + default void setNotificationPresenter(NotificationPresenter presenter) {}; /** */ - void setNotificationShadeWindowViewController( - NotificationShadeWindowViewController notificationShadeWindowViewController); + default void setNotificationShadeWindowViewController( + NotificationShadeWindowViewController notificationShadeWindowViewController) {}; /** */ - void setShadeViewController(ShadeViewController shadeViewController); + default void setShadeViewController(ShadeViewController shadeViewController) {}; /** Listens for shade visibility changes. */ interface ShadeVisibilityListener { diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerEmptyImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerEmptyImpl.kt new file mode 100644 index 000000000000..4d0500786ca3 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerEmptyImpl.kt @@ -0,0 +1,52 @@ +package com.android.systemui.shade + +import android.view.MotionEvent +import com.android.systemui.dagger.SysUISingleton +import javax.inject.Inject + +/** Empty implementation of ShadeController for variants of Android without shades. */ +@SysUISingleton +open class ShadeControllerEmptyImpl @Inject constructor() : ShadeController { + override fun instantExpandShade() {} + override fun instantCollapseShade() {} + override fun animateCollapseShade( + flags: Int, + force: Boolean, + delayed: Boolean, + speedUpFactor: Float + ) {} + override fun animateExpandShade() {} + override fun animateExpandQs() {} + override fun postAnimateCollapseShade() {} + override fun postAnimateForceCollapseShade() {} + override fun postAnimateExpandQs() {} + override fun cancelExpansionAndCollapseShade() {} + override fun closeShadeIfOpen(): Boolean { + return false + } + override fun isKeyguard(): Boolean { + return false + } + override fun isShadeFullyOpen(): Boolean { + return false + } + override fun isExpandingOrCollapsing(): Boolean { + return false + } + override fun postOnShadeExpanded(action: Runnable?) {} + override fun addPostCollapseAction(action: Runnable?) {} + override fun runPostCollapseRunnables() {} + override fun collapseShade(): Boolean { + return false + } + override fun collapseShade(animate: Boolean) {} + override fun collapseOnMainThread() {} + override fun makeExpandedInvisible() {} + override fun makeExpandedVisible(force: Boolean) {} + override fun isExpandedVisible(): Boolean { + return false + } + override fun onStatusBarTouch(event: MotionEvent?) {} + override fun onLaunchAnimationCancelled(isLaunchForActivity: Boolean) {} + override fun onLaunchAnimationEnd(launchIsFullScreen: Boolean) {} +} diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java index b92afac047fa..af74a8d7dca1 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java @@ -112,26 +112,6 @@ public final class ShadeControllerImpl implements ShadeController { } @Override - public void animateCollapseShade() { - animateCollapseShade(CommandQueue.FLAG_EXCLUDE_NONE); - } - - @Override - public void animateCollapseShade(int flags) { - animateCollapseShade(flags, false, false, 1.0f); - } - - @Override - public void animateCollapseShadeForced() { - animateCollapseShade(CommandQueue.FLAG_EXCLUDE_NONE, true, false, 1.0f); - } - - @Override - public void animateCollapseShadeForcedDelayed() { - animateCollapseShade(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true, true, 1.0f); - } - - @Override public void animateCollapseShade(int flags, boolean force, boolean delayed, float speedUpFactor) { if (!force && mStatusBarStateController.getState() != StatusBarState.SHADE) { |