Only update native InputApplicationHandle once

This makes sure the write operation (NativeInputApplicationHandle
::updateInfo) is always called from window manager side once when
calling SurfaceControl.Transaction#setInputWindowInfo or
InputManagerService#setFocusedApplication. If the info of input
application handle is changed, a new instance will be created.
That avoids the race condition of reading the fields of the same
InputApplicationInfo instance from input dispatcher.

This CL resolves the merge conflict.

Bug: 171857140
Bug: 161334769
Bug: 174768985
Test: WindowInputTests

Merged-In: Ief84bbe6e6fa4da5309912059904932ccf775b75
Merged-In: I70de9835c7699fe6f56fc3655b0fee5c317ecc3a
Change-Id: I70de9835c7699fe6f56fc3655b0fee5c317ecc3a
This commit is contained in:
Riddle Hsu
2020-12-03 15:57:36 +08:00
committed by Siarhei Vishniakou
parent d852943072
commit c26a04ce1a
2 changed files with 2 additions and 3 deletions

View File

@@ -43,7 +43,6 @@ import android.os.Trace;
import android.os.UserHandle;
import android.util.ArrayMap;
import android.util.Slog;
import android.view.InputApplicationHandle;
import android.view.InputChannel;
import android.view.InputEventReceiver;
import android.view.InputWindowHandle;

View File

@@ -943,8 +943,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mLastRequestedHeight = 0;
mLayer = 0;
mInputWindowHandle = new InputWindowHandle(
mActivityRecord != null ?
mActivityRecord.getInputApplicationHandle(false /* update */) : null,
mActivityRecord != null
? mActivityRecord.getInputApplicationHandle(false /* update */) : null,
getDisplayId());
// Make sure we initial all fields before adding to parentWindow, to prevent exception