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

Commit c130a2ca authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "Add ISystemUiProxy#toggleQuickSettingsPanel." into main

parents a5b030c7 aa3ed507
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ oneway interface IStatusBar
    void animateExpandNotificationsPanel();
    void animateExpandSettingsPanel(String subPanel);
    void animateCollapsePanels();
    void togglePanel();
    void toggleNotificationsPanel();

    void showWirelessChargingAnimation(int batteryLevel);

+6 −1
Original line number Diff line number Diff line
@@ -162,5 +162,10 @@ interface ISystemUiProxy {
    oneway void setOverrideHomeButtonLongPress(long duration, float slopMultiplier, boolean haptic)
            = 55;

    // Next id = 56
    /**
     * Notifies to toggle quick settings panel.
     */
    oneway void toggleQuickSettingsPanel() = 56;

    // Next id = 57
}
+9 −3
Original line number Diff line number Diff line
@@ -117,6 +117,8 @@ import com.android.systemui.unfold.progress.UnfoldTransitionProgressForwarder;
import com.android.wm.shell.desktopmode.DesktopModeStatus;
import com.android.wm.shell.sysui.ShellInterface;

import dagger.Lazy;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
@@ -128,8 +130,6 @@ import java.util.function.Supplier;
import javax.inject.Inject;
import javax.inject.Provider;

import dagger.Lazy;

/**
 * Class to send information from overview to launcher with a binder.
 */
@@ -414,7 +414,13 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        @Override
        public void toggleNotificationPanel() {
            verifyCallerAndClearCallingIdentityPostMain("toggleNotificationPanel", () ->
                    mCommandQueue.togglePanel());
                    mCommandQueue.toggleNotificationsPanel());
        }

        @Override
        public void toggleQuickSettingsPanel() {
            verifyCallerAndClearCallingIdentityPostMain("toggleQuickSettingsPanel", () ->
                    mCommandQueue.toggleQuickSettingsPanel());
        }

        private boolean verifyCaller(String reason) {
+44 −8
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ public class CommandQueue extends IStatusBar.Stub implements
    private static final int MSG_DISMISS_KEYBOARD_SHORTCUTS        = 32 << MSG_SHIFT;
    private static final int MSG_HANDLE_SYSTEM_KEY                 = 33 << MSG_SHIFT;
    private static final int MSG_SHOW_GLOBAL_ACTIONS               = 34 << MSG_SHIFT;
    private static final int MSG_TOGGLE_PANEL                      = 35 << MSG_SHIFT;
    private static final int MSG_TOGGLE_NOTIFICATION_PANEL         = 35 << MSG_SHIFT;
    private static final int MSG_SHOW_SHUTDOWN_UI                  = 36 << MSG_SHIFT;
    private static final int MSG_SET_TOP_APP_HIDES_STATUS_BAR      = 37 << MSG_SHIFT;
    private static final int MSG_ROTATION_PROPOSAL                 = 38 << MSG_SHIFT;
@@ -180,6 +180,7 @@ public class CommandQueue extends IStatusBar.Stub implements
    private static final int MSG_SET_QS_TILES = 79 << MSG_SHIFT;
    private static final int MSG_ENTER_DESKTOP = 80 << MSG_SHIFT;
    private static final int MSG_SET_SPLITSCREEN_FOCUS = 81 << MSG_SHIFT;
    private static final int MSG_TOGGLE_QUICK_SETTINGS_PANEL = 82 << MSG_SHIFT;
    public static final int FLAG_EXCLUDE_NONE = 0;
    public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
    public static final int FLAG_EXCLUDE_RECENTS_PANEL = 1 << 1;
@@ -222,10 +223,33 @@ public class CommandQueue extends IStatusBar.Stub implements
         */
        default void disable(int displayId, @DisableFlags int state1, @Disable2Flags int state2,
                boolean animate) { }

        /**
         * Called to expand Notifications panel with animation.
         */
        default void animateExpandNotificationsPanel() { }
        /**
         * Called to collapse Notifications panel with animation.
         * @param flags Exclusion flags. See {@link FLAG_EXCLUDE_NONE}.
         * @param force True to force the operation.
         */
        default void animateCollapsePanels(int flags, boolean force) { }
        default void togglePanel() { }
        default void animateExpandSettingsPanel(String obj) { }

        /**
         * Called to toggle Notifications panel.
         */
        default void toggleNotificationsPanel() { }

        /**
         * Called to expand Quick Settings panel with animation.
         * @param subPanel subPanel one wish to expand.
         */
        default void animateExpandSettingsPanel(String subPanel) { }

        /**
         * Called to toggle Quick Settings panel.
         */
        default void toggleQuickSettingsPanel() { }

        /**
         * Called to notify IME window status changes.
@@ -696,10 +720,10 @@ public class CommandQueue extends IStatusBar.Stub implements
        }
    }

    public void togglePanel() {
    public void toggleNotificationsPanel() {
        synchronized (mLock) {
            mHandler.removeMessages(MSG_TOGGLE_PANEL);
            mHandler.obtainMessage(MSG_TOGGLE_PANEL, 0, 0).sendToTarget();
            mHandler.removeMessages(MSG_TOGGLE_NOTIFICATION_PANEL);
            mHandler.obtainMessage(MSG_TOGGLE_NOTIFICATION_PANEL, 0, 0).sendToTarget();
        }
    }

@@ -710,6 +734,13 @@ public class CommandQueue extends IStatusBar.Stub implements
        }
    }

    public void toggleQuickSettingsPanel() {
        synchronized (mLock) {
            mHandler.removeMessages(MSG_TOGGLE_QUICK_SETTINGS_PANEL);
            mHandler.obtainMessage(MSG_TOGGLE_QUICK_SETTINGS_PANEL, 0, 0).sendToTarget();
        }
    }

    @Override
    public void setImeWindowStatus(int displayId, IBinder token, int vis, int backDisposition,
            boolean showImeSwitcher) {
@@ -1494,9 +1525,9 @@ public class CommandQueue extends IStatusBar.Stub implements
                        mCallbacks.get(i).animateCollapsePanels(msg.arg1, msg.arg2 != 0);
                    }
                    break;
                case MSG_TOGGLE_PANEL:
                case MSG_TOGGLE_NOTIFICATION_PANEL:
                    for (int i = 0; i < mCallbacks.size(); i++) {
                        mCallbacks.get(i).togglePanel();
                        mCallbacks.get(i).toggleNotificationsPanel();
                    }
                    break;
                case MSG_EXPAND_SETTINGS:
@@ -1504,6 +1535,11 @@ public class CommandQueue extends IStatusBar.Stub implements
                        mCallbacks.get(i).animateExpandSettingsPanel((String) msg.obj);
                    }
                    break;
                case MSG_TOGGLE_QUICK_SETTINGS_PANEL:
                    for (int i = 0; i < mCallbacks.size(); i++) {
                        mCallbacks.get(i).toggleQuickSettingsPanel();
                    }
                    break;
                case MSG_SHOW_IME_BUTTON:
                    args = (SomeArgs) msg.obj;
                    handleShowImeButton(args.argi1 /* displayId */, (IBinder) args.arg1 /* token */,
+15 −2
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import com.android.systemui.shade.QuickSettingsController;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeHeaderController;
import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor;
import com.android.systemui.shade.domain.interactor.ShadeInteractor;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
@@ -82,6 +83,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
    private final com.android.systemui.shade.ShadeController mShadeController;
    private final CommandQueue mCommandQueue;
    private final PanelExpansionInteractor mPanelExpansionInteractor;
    private final Lazy<ShadeInteractor> mShadeInteractorLazy;
    private final ShadeHeaderController mShadeHeaderController;
    private final RemoteInputQuickSettingsDisabler mRemoteInputQuickSettingsDisabler;
    private final MetricsLogger mMetricsLogger;
@@ -121,6 +123,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
            ShadeController shadeController,
            CommandQueue commandQueue,
            PanelExpansionInteractor panelExpansionInteractor,
            Lazy<ShadeInteractor> shadeInteractorLazy,
            ShadeHeaderController shadeHeaderController,
            RemoteInputQuickSettingsDisabler remoteInputQuickSettingsDisabler,
            MetricsLogger metricsLogger,
@@ -148,6 +151,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
        mShadeController = shadeController;
        mCommandQueue = commandQueue;
        mPanelExpansionInteractor = panelExpansionInteractor;
        mShadeInteractorLazy = shadeInteractorLazy;
        mShadeHeaderController = shadeHeaderController;
        mRemoteInputQuickSettingsDisabler = remoteInputQuickSettingsDisabler;
        mMetricsLogger = metricsLogger;
@@ -487,14 +491,23 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
    }

    @Override
    public void togglePanel() {
        if (mPanelExpansionInteractor.isPanelExpanded()) {
    public void toggleNotificationsPanel() {
        if (mShadeInteractorLazy.get().isAnyExpanded().getValue()) {
            mShadeController.animateCollapseShade();
        } else {
            mShadeController.animateExpandShade();
        }
    }

    @Override
    public void toggleQuickSettingsPanel() {
        if (mShadeInteractorLazy.get().isQsExpanded().getValue()) {
            mShadeController.animateCollapseShade();
        } else {
            mShadeController.animateExpandQs();
        }
    }

    private boolean isGoingToSleep() {
        return mWakefulnessLifecycle.getWakefulness()
                == WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP;
Loading