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

Commit c3a503d8 authored by Philip Quinn's avatar Philip Quinn
Browse files

Ping the StatusBar about power key events.

Bug: 63183852
Test: runtest systemui

Change-Id: I5d8209396e3e761b404c1071a7004f34c6e6c927
parent 8d51d3e5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -114,5 +114,5 @@ oneway interface IStatusBar
    void addQsTile(in ComponentName tile);
    void remQsTile(in ComponentName tile);
    void clickQsTile(in ComponentName tile);
    void handleSystemNavigationKey(in int key);
    void handleSystemKey(in int key);
}
+1 −1
Original line number Diff line number Diff line
@@ -75,5 +75,5 @@ interface IStatusBarService
    void addTile(in ComponentName tile);
    void remTile(in ComponentName tile);
    void clickTile(in ComponentName tile);
    void handleSystemNavigationKey(in int key);
    void handleSystemKey(in int key);
}
+6 −6
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ public class CommandQueue extends IStatusBar.Stub {
    private static final int MSG_TOGGLE_APP_SPLIT_SCREEN       = 30 << MSG_SHIFT;
    private static final int MSG_APP_TRANSITION_FINISHED       = 31 << MSG_SHIFT;
    private static final int MSG_DISMISS_KEYBOARD_SHORTCUTS    = 32 << MSG_SHIFT;
    private static final int MSG_HANDLE_SYSNAV_KEY             = 33 << MSG_SHIFT;
    private static final int MSG_HANDLE_SYSTEM_KEY             = 33 << MSG_SHIFT;
    private static final int MSG_SHOW_GLOBAL_ACTIONS           = 34 << MSG_SHIFT;

    public static final int FLAG_EXCLUDE_NONE = 0;
@@ -134,7 +134,7 @@ public class CommandQueue extends IStatusBar.Stub {
        default void remQsTile(ComponentName tile) { }
        default void clickTile(ComponentName tile) { }

        default void handleSystemNavigationKey(int arg1) { }
        default void handleSystemKey(int arg1) { }
        default void handleShowGlobalActionsMenu() { }
    }

@@ -415,9 +415,9 @@ public class CommandQueue extends IStatusBar.Stub {
    }

    @Override
    public void handleSystemNavigationKey(int key) {
    public void handleSystemKey(int key) {
        synchronized (mLock) {
            mHandler.obtainMessage(MSG_HANDLE_SYSNAV_KEY, key, 0).sendToTarget();
            mHandler.obtainMessage(MSG_HANDLE_SYSTEM_KEY, key, 0).sendToTarget();
        }
    }

@@ -600,9 +600,9 @@ public class CommandQueue extends IStatusBar.Stub {
                        mCallbacks.get(i).toggleSplitScreen();
                    }
                    break;
                case MSG_HANDLE_SYSNAV_KEY:
                case MSG_HANDLE_SYSTEM_KEY:
                    for (int i = 0; i < mCallbacks.size(); i++) {
                        mCallbacks.get(i).handleSystemNavigationKey(msg.arg1);
                        mCallbacks.get(i).handleSystemKey(msg.arg1);
                    }
                    break;
                case MSG_SHOW_GLOBAL_ACTIONS:
+2 −2
Original line number Diff line number Diff line
@@ -2945,8 +2945,8 @@ public class StatusBar extends SystemUI implements DemoMode,
     * settings. Down action closes the entire panel.
     */
    @Override
    public void handleSystemNavigationKey(int key) {
        if (SPEW) Log.d(TAG, "handleSystemNavigationKey: " + key);
    public void handleSystemKey(int key) {
        if (SPEW) Log.d(TAG, "handleNavigationKey: " + key);
        if (!panelsEnabled() || !mKeyguardMonitor.isDeviceInteractive()
                || mKeyguardMonitor.isShowing() && !mKeyguardMonitor.isOccluded()) {
            return;
+3 −3
Original line number Diff line number Diff line
@@ -269,9 +269,9 @@ public class CommandQueueTest extends SysuiTestCase {
    }

    @Test
    public void testHandleSysnavKey() {
        mCommandQueue.handleSystemNavigationKey(1);
    public void testHandleSysKey() {
        mCommandQueue.handleSystemKey(1);
        waitForIdleSync();
        verify(mCallbacks).handleSystemNavigationKey(eq(1));
        verify(mCallbacks).handleSystemKey(eq(1));
    }
}
Loading