Add synchronous transaction to wait for setInputWindow to complete (5/n)
Added syncInputWindows method to JNI and SurfaceControl.Transaction
This enables the caller to request SF to wait until input windows have
been synced with InputDispatcher.
Bug: 123041491
Test: builds, runs
Change-Id: I2ddaa3f43eded2fb117cc2850ee7c8a20b2b63ec
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 6b8d8b1..003ee37 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -406,6 +406,11 @@
transaction->transferTouchFocus(fromToken, toToken);
}
+static void nativeSyncInputWindows(JNIEnv* env, jclass clazz, jlong transactionObj) {
+ auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
+ transaction->syncInputWindows();
+}
+
static void nativeSetMetadata(JNIEnv* env, jclass clazz, jlong transactionObj,
jlong nativeObject, jint id, jobject parcelObj) {
Parcel* parcel = parcelForJavaObject(env, parcelObj);
@@ -1246,7 +1251,9 @@
"(Landroid/os/IBinder;JJ)Landroid/hardware/display/DisplayedContentSample;",
(void*)nativeGetDisplayedContentSample },
{"nativeSetGeometry", "(JJLandroid/graphics/Rect;Landroid/graphics/Rect;J)V",
- (void*)nativeSetGeometry }
+ (void*)nativeSetGeometry },
+ {"nativeSyncInputWindows", "(J)V",
+ (void*)nativeSyncInputWindows }
};
int register_android_view_SurfaceControl(JNIEnv* env)