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

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

Add onKeyEvent, to support KEYCODE_HOME

- Also added displayId to onBackEvent

Bug: 381339822
Flag: com.android.launcher3.home_button_uses_keycode_home
Test: Manual, OverviewCommandHelperTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:622a882e1f17d108a336ecfd3e4eb7aa9707f1e6)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7ff1e38f7d707d860d9bc7557056050c4aaf4025)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:ec15cee125b81d66eee0a24682b223c1f8713833
Merged-In: I55e2ee7adfa40c9d8f289a2b4c76aa12f80e78c3
Change-Id: I55e2ee7adfa40c9d8f289a2b4c76aa12f80e78c3
parent 06e69758
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -102,7 +102,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;

@@ -167,5 +167,10 @@ interface ISystemUiProxy {
     */
    oneway void toggleQuickSettingsPanel() = 56;

    // Next id = 57
    /**
     * 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
@@ -20,6 +20,7 @@ import static android.app.Flags.keyguardPrivateNotifications;
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;
@@ -289,9 +290,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);
                    });
        }