diff options
| author | 2022-05-11 21:32:27 +0000 | |
|---|---|---|
| committer | 2022-05-11 21:32:27 +0000 | |
| commit | dc9df06be2d8eead60ee9c87dfff3a81af4cdc9f (patch) | |
| tree | f7d6bf535d2254a323a8b64efee2dca98311ad4e | |
| parent | a68cbd63774979d09157076412442cbee0116f7e (diff) | |
| parent | 7e6088fa860b1c45c672a6a11da9a4c34420f1ac (diff) | |
Merge "Prevent to revoke input focus from recentsAnimationInputConsumer" into tm-dev am: 7e6088fa86
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18167461
Change-Id: Ia160162e5610ed25cad7c4902941e86cfb1721e3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | core/jni/android_view_SurfaceControl.cpp | 1 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/InputMonitor.java | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index c769da57eecc..4044c579a57f 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -1921,6 +1921,7 @@ static void nativeRemoveCurrentInputFocus(JNIEnv* env, jclass clazz, jlong trans FocusRequest request; request.timestamp = systemTime(SYSTEM_TIME_MONOTONIC); request.displayId = displayId; + request.windowName = "<null>"; transaction->setFocusedWindow(request); } diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java index ea72e12783c3..ce416ad89c95 100644 --- a/services/core/java/com/android/server/wm/InputMonitor.java +++ b/services/core/java/com/android/server/wm/InputMonitor.java @@ -416,8 +416,22 @@ final class InputMonitor { final IBinder focusToken = focus != null ? focus.mInputChannelToken : null; if (focusToken == null) { + if (recentsAnimationInputConsumer != null + && recentsAnimationInputConsumer.mWindowHandle != null + && mInputFocus == recentsAnimationInputConsumer.mWindowHandle.token) { + // Avoid removing input focus from recentsAnimationInputConsumer. + // When the recents animation input consumer has the input focus, + // mInputFocus does not match to mDisplayContent.mCurrentFocus. Making it to be + // a special case, that do not remove the input focus from it when + // mDisplayContent.mCurrentFocus is null. This special case should be removed + // once recentAnimationInputConsumer is removed. + return; + } // When an app is focused, but its window is not showing yet, remove the input focus - // from the current window. + // from the current window. This enforces the input focus to match + // mDisplayContent.mCurrentFocus. However, if more special cases are discovered that + // the input focus and mDisplayContent.mCurrentFocus are expected to mismatch, + // the whole logic of how and when to revoke focus needs to be checked. if (mDisplayContent.mFocusedApp != null && mInputFocus != null) { ProtoLog.v(WM_DEBUG_FOCUS_LIGHT, "App %s is focused," + " but the window is not ready. Start a transaction to remove focus from" |