Send KEYCODE_HOME for home button instead of startActivity directly Also updated calls to onBackEvent to match new signature of including displayId. Bug: 381339822 Flag: com.android.launcher3.home_button_uses_keycode_home Test: manual, also OverviewCommandHelperTest (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9ba5fcaffa95621af543be20851806f7dec88183) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:063dd3bcdd0dcbff5be4f53a6f39c4070f76706b) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4758973488ef3f85483a52f08d0bfc87954ad2e7) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5bac97af31ef8ae48e5c49effcf7231d02a234d0) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:979a35df7aa7e9cb153409abc3b96861b2581ca1) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b91ab66683ae04842c8c8eac6ec61a407416826c) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c652ca9ea210336af22cf8191f723ba1a0f352b0) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5625c5b8a621b7daf5945764905402ff121b8429) Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:2f9f1570f46547ba07a8b28bdaa2f1b482441912 Merged-In: I6e1272e1526e8b136376852f8ff50e3fa68bbede Change-Id: I6e1272e1526e8b136376852f8ff50e3fa68bbede
diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index dffdc5a..ea9d16b 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -24,6 +24,7 @@ import android.os.Build; import android.os.SystemClock; import android.os.Trace; +import android.view.KeyEvent; import androidx.annotation.BinderThread; import androidx.annotation.Nullable; @@ -64,14 +65,17 @@ private final TouchInteractionService mService; private final OverviewComponentObserver mOverviewComponentObserver; private final TaskAnimationManager mTaskAnimationManager; + private final SystemUiProxy mSystemUiProxy; private final ArrayList<CommandInfo> mPendingCommands = new ArrayList<>(); public OverviewCommandHelper(TouchInteractionService service, OverviewComponentObserver observer, - TaskAnimationManager taskAnimationManager) { + TaskAnimationManager taskAnimationManager, + SystemUiProxy systemUiProxy) { mService = service; mOverviewComponentObserver = observer; mTaskAnimationManager = taskAnimationManager; + mSystemUiProxy = systemUiProxy; } /** @@ -170,7 +174,7 @@ return true; } if (cmd.type == TYPE_HOME) { - mService.startActivity(mOverviewComponentObserver.getHomeIntent()); + mSystemUiProxy.onKeyEvent(KeyEvent.KEYCODE_HOME); return true; } } else {
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 39d8b54..686c932 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -136,6 +136,17 @@ } @Override + public void onKeyEvent(int keycode) { + if (mSystemUiProxy != null) { + try { + mSystemUiProxy.onKeyEvent(keycode); + } catch (RemoteException e) { + Log.w(TAG, "Failed call onKeyEvent", e); + } + } + } + + @Override public void onImeSwitcherPressed() { if (mSystemUiProxy != null) { try {
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 61d36fb..4d7f839 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -438,7 +438,8 @@ mTaskAnimationManager = new TaskAnimationManager(this); mOverviewComponentObserver = new OverviewComponentObserver(this, mDeviceState); mOverviewCommandHelper = new OverviewCommandHelper(this, - mOverviewComponentObserver, mTaskAnimationManager); + mOverviewComponentObserver, mTaskAnimationManager, + SystemUiProxy.INSTANCE.get(this)); mResetGestureInputConsumer = new ResetGestureInputConsumer(mTaskAnimationManager); mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer(); mInputConsumer.registerInputConsumer();