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

Commit a8a441b0 authored by Tony Wickham's avatar Tony Wickham Committed by Android Build Coastguard Worker
Browse files

Add onKeyEvent, to support KEYCODE_HOME

parent 848e575f
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ interface ISystemUiProxy {
    oneway void expandNotificationPanel() = 29;

    /**
     * Notifies SystemUI to invoke Back.
     * Notifies SystemUI of KEYCODE_BACK, sending a ACTION_DOWN followed by ACTION_UP.
     */
    oneway void onBackPressed() = 44;

@@ -125,5 +125,10 @@ interface ISystemUiProxy {
     */
    oneway void takeScreenshot(in ScreenshotRequest request) = 51;

    // Next id = 52
    /**
     * Notifies SystemUI of a KeyEvent of the specified type (e.g. KEYCODE_BACK, KEYCODE_HOME).
     */
    oneway void onKeyEvent(int keycode) = 60;

    // Next id = 61
}
+12 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.recents;
import static android.content.Intent.ACTION_PACKAGE_ADDED;
import static android.content.Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST;
import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
import static android.view.KeyEvent.KEYCODE_BACK;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
@@ -237,9 +238,16 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis

        @Override
        public void onBackPressed() {
            verifyCallerAndClearCallingIdentityPostMain("onBackPressed", () -> {
                sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
                sendEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK);
            onKeyEvent(KEYCODE_BACK);
        }

        @Override
        public void onKeyEvent(int keycode) {
            verifyCallerAndClearCallingIdentityPostMain(
                    "onKeyEvent " + KeyEvent.keyCodeToString(keycode),
                    () -> {
                        sendEvent(KeyEvent.ACTION_DOWN, keycode);
                        sendEvent(KeyEvent.ACTION_UP, keycode);
                    });
        }