Merge "Remove focus if no window and current focus is valid" into tm-dev am: f13bfa6c0a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17504684

Change-Id: I5f83455b00c79fca6e0bf91eace5d2d9cf7f2f40
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Arthur Hung
2022-03-31 06:54:58 +00:00
committed by Automerger Merge Worker

View File

@@ -414,10 +414,9 @@ final class InputMonitor {
final IBinder focusToken = focus != null ? focus.mInputChannelToken : null;
if (focusToken == null) {
mInputFocus = null;
// When an app is focused, but its window is not showing yet, remove the input focus
// from the current window.
if (mDisplayContent.mFocusedApp != null) {
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"
+ " the window of non-focused apps.",
@@ -426,6 +425,7 @@ final class InputMonitor {
"reason=UpdateInputWindows");
mInputTransaction.removeCurrentInputFocus(mDisplayId);
}
mInputFocus = null;
return;
}