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

Commit dbe43d52 authored by Justin Weir's avatar Justin Weir
Browse files

Add empty implementation of ShadeController

Variants without shades want this, so there should be only one, and
it should be in the shade package to make updates not require topics.
Also adds some default methods to ShadeController to reduce the size
of ShadeControllerEmptyImpl and deemphasize ShadeController methods
that are too tied to implementation details of ShadeControllerImpl.

Test: presubmits are sufficient
Bug: 288867586
Change-Id: Ia7015378f85a8a68db049069b2d678b57c4390b1
Merged-In: Ia7015378f85a8a68db049069b2d678b57c4390b1
parent d756cad8
Loading
Loading
Loading
Loading
+18 −9
Original line number Diff line number Diff line
@@ -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 {
+52 −0
Original line number Diff line number Diff line
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) {}
}
+0 −20
Original line number Diff line number Diff line
@@ -111,26 +111,6 @@ public final class ShadeControllerImpl implements ShadeController {
        mCommandQueue.recomputeDisableFlags(mDisplayId, false /* animate */);
    }

    @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) {