blob: 79f62cb19db06d72979309c285965e7108f1b4d7 [file] [log] [blame]
Jeff Brown928e0542011-01-10 11:17:36 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "InputWindowHandle"
18
Steven Moreland2279b252017-07-19 09:50:45 -070019#include <nativehelper/JNIHelp.h>
Siarhei Vishniakoue890f592018-10-15 18:53:06 -070020#include "core_jni_helpers.h"
Jeff Brown928e0542011-01-10 11:17:36 -080021#include "jni.h"
22#include <android_runtime/AndroidRuntime.h>
23#include <utils/threads.h>
24
Derek Sollenberger40d78132019-08-12 11:06:08 -040025#include <android/graphics/region.h>
Vishnu Nairbc9beab2019-06-25 17:28:58 -070026#include <gui/SurfaceControl.h>
Michael Wrighta407d6a2014-02-05 18:02:40 -080027#include <ui/Region.h>
Jeff Brown9302c872011-07-13 22:51:29 -070028
Robert Carre1db3202018-07-23 15:24:59 -070029#include "android_hardware_input_InputWindowHandle.h"
30#include "android_hardware_input_InputApplicationHandle.h"
Robert Carr0bcbe642018-10-11 19:07:43 -070031#include "android_util_Binder.h"
Vishnu Nairc06ec082019-08-20 09:12:26 -070032#include <binder/IPCThreadState.h>
Jeff Brown928e0542011-01-10 11:17:36 -080033
34namespace android {
35
Vishnu Nair40efb712019-03-12 13:37:51 -070036struct WeakRefHandleField {
Vishnu Nairbc9beab2019-06-25 17:28:58 -070037 jfieldID ctrl;
Vishnu Nair40efb712019-03-12 13:37:51 -070038 jmethodID get;
Vishnu Nairbc9beab2019-06-25 17:28:58 -070039 jfieldID mNativeObject;
Vishnu Nair40efb712019-03-12 13:37:51 -070040};
41
Jeff Brown928e0542011-01-10 11:17:36 -080042static struct {
Jeff Brown928e0542011-01-10 11:17:36 -080043 jfieldID ptr;
44 jfieldID inputApplicationHandle;
Robert Carreadae822018-10-11 19:07:03 -070045 jfieldID token;
Jeff Brown9302c872011-07-13 22:51:29 -070046 jfieldID name;
47 jfieldID layoutParamsFlags;
48 jfieldID layoutParamsType;
49 jfieldID dispatchingTimeoutNanos;
50 jfieldID frameLeft;
51 jfieldID frameTop;
52 jfieldID frameRight;
53 jfieldID frameBottom;
Robert Carrfcc08522018-11-14 14:02:52 -080054 jfieldID surfaceInset;
Jeff Brown9302c872011-07-13 22:51:29 -070055 jfieldID scaleFactor;
56 jfieldID touchableRegion;
57 jfieldID visible;
58 jfieldID canReceiveKeys;
59 jfieldID hasFocus;
60 jfieldID hasWallpaper;
61 jfieldID paused;
Jeff Brown9302c872011-07-13 22:51:29 -070062 jfieldID ownerPid;
63 jfieldID ownerUid;
64 jfieldID inputFeatures;
Jeff Brown83d616a2012-09-09 20:33:43 -070065 jfieldID displayId;
Tiger Huang04dc4cc2019-01-17 18:41:41 +080066 jfieldID portalToDisplayId;
Vishnu Nair40efb712019-03-12 13:37:51 -070067 jfieldID replaceTouchableRegionWithCrop;
Vishnu Nairbc9beab2019-06-25 17:28:58 -070068 WeakRefHandleField touchableRegionSurfaceControl;
Jeff Brown928e0542011-01-10 11:17:36 -080069} gInputWindowHandleClassInfo;
70
71static Mutex gHandleMutex;
72
73
74// --- NativeInputWindowHandle ---
75
Robert Carr0bcbe642018-10-11 19:07:43 -070076NativeInputWindowHandle::NativeInputWindowHandle(jweak objWeak) :
Jeff Brown928e0542011-01-10 11:17:36 -080077 mObjWeak(objWeak) {
78}
79
80NativeInputWindowHandle::~NativeInputWindowHandle() {
81 JNIEnv* env = AndroidRuntime::getJNIEnv();
82 env->DeleteWeakGlobalRef(mObjWeak);
Vishnu Nairc06ec082019-08-20 09:12:26 -070083
84 // Clear the weak reference to the layer handle and flush any binder ref count operations so we
85 // do not hold on to any binder references.
86 // TODO(b/139697085) remove this after it can be flushed automatically
87 mInfo.touchableRegionCropHandle.clear();
88 IPCThreadState::self()->flushCommands();
Jeff Brown928e0542011-01-10 11:17:36 -080089}
90
91jobject NativeInputWindowHandle::getInputWindowHandleObjLocalRef(JNIEnv* env) {
92 return env->NewLocalRef(mObjWeak);
93}
94
Jeff Browncc4f7db2011-08-30 20:34:48 -070095bool NativeInputWindowHandle::updateInfo() {
Jeff Brown9302c872011-07-13 22:51:29 -070096 JNIEnv* env = AndroidRuntime::getJNIEnv();
97 jobject obj = env->NewLocalRef(mObjWeak);
98 if (!obj) {
Arthur Hung06ad38d2018-11-05 19:23:21 +080099 releaseChannel();
Jeff Brown9302c872011-07-13 22:51:29 -0700100 return false;
101 }
102
Arthur Hung06ad38d2018-11-05 19:23:21 +0800103 mInfo.touchableRegion.clear();
Jeff Browncc4f7db2011-08-30 20:34:48 -0700104
Siarhei Vishniakoue890f592018-10-15 18:53:06 -0700105 jobject tokenObj = env->GetObjectField(obj, gInputWindowHandleClassInfo.token);
Robert Carreadae822018-10-11 19:07:03 -0700106 if (tokenObj) {
107 mInfo.token = ibinderForJavaObject(env, tokenObj);
Vishnu Nair40efb712019-03-12 13:37:51 -0700108 env->DeleteLocalRef(tokenObj);
Jeff Brown9302c872011-07-13 22:51:29 -0700109 } else {
Robert Carreadae822018-10-11 19:07:03 -0700110 mInfo.token.clear();
Jeff Brown9302c872011-07-13 22:51:29 -0700111 }
112
Siarhei Vishniakoue890f592018-10-15 18:53:06 -0700113 mInfo.name = getStringField(env, obj, gInputWindowHandleClassInfo.name, "<null>");
Jeff Brown9302c872011-07-13 22:51:29 -0700114
Arthur Hung06ad38d2018-11-05 19:23:21 +0800115 mInfo.layoutParamsFlags = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700116 gInputWindowHandleClassInfo.layoutParamsFlags);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800117 mInfo.layoutParamsType = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700118 gInputWindowHandleClassInfo.layoutParamsType);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800119 mInfo.dispatchingTimeout = env->GetLongField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700120 gInputWindowHandleClassInfo.dispatchingTimeoutNanos);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800121 mInfo.frameLeft = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700122 gInputWindowHandleClassInfo.frameLeft);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800123 mInfo.frameTop = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700124 gInputWindowHandleClassInfo.frameTop);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800125 mInfo.frameRight = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700126 gInputWindowHandleClassInfo.frameRight);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800127 mInfo.frameBottom = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700128 gInputWindowHandleClassInfo.frameBottom);
Robert Carrfcc08522018-11-14 14:02:52 -0800129 mInfo.surfaceInset = env->GetIntField(obj,
130 gInputWindowHandleClassInfo.surfaceInset);
Robert Carr51141c02018-11-26 13:11:05 -0800131 mInfo.globalScaleFactor = env->GetFloatField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700132 gInputWindowHandleClassInfo.scaleFactor);
133
134 jobject regionObj = env->GetObjectField(obj,
135 gInputWindowHandleClassInfo.touchableRegion);
136 if (regionObj) {
Derek Sollenberger40d78132019-08-12 11:06:08 -0400137 for (graphics::RegionIterator it(env, regionObj); !it.isDone(); it.next()) {
138 ARect rect = it.getRect();
139 mInfo.addTouchableRegion(Rect(rect.left, rect.top, rect.right, rect.bottom));
Michael Wrighta407d6a2014-02-05 18:02:40 -0800140 }
Jeff Brown9302c872011-07-13 22:51:29 -0700141 env->DeleteLocalRef(regionObj);
Jeff Brown9302c872011-07-13 22:51:29 -0700142 }
143
Arthur Hung06ad38d2018-11-05 19:23:21 +0800144 mInfo.visible = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700145 gInputWindowHandleClassInfo.visible);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800146 mInfo.canReceiveKeys = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700147 gInputWindowHandleClassInfo.canReceiveKeys);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800148 mInfo.hasFocus = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700149 gInputWindowHandleClassInfo.hasFocus);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800150 mInfo.hasWallpaper = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700151 gInputWindowHandleClassInfo.hasWallpaper);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800152 mInfo.paused = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700153 gInputWindowHandleClassInfo.paused);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800154 mInfo.ownerPid = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700155 gInputWindowHandleClassInfo.ownerPid);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800156 mInfo.ownerUid = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700157 gInputWindowHandleClassInfo.ownerUid);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800158 mInfo.inputFeatures = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700159 gInputWindowHandleClassInfo.inputFeatures);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800160 mInfo.displayId = env->GetIntField(obj,
Jeff Brown83d616a2012-09-09 20:33:43 -0700161 gInputWindowHandleClassInfo.displayId);
Tiger Huang04dc4cc2019-01-17 18:41:41 +0800162 mInfo.portalToDisplayId = env->GetIntField(obj,
163 gInputWindowHandleClassInfo.portalToDisplayId);
Jeff Brown9302c872011-07-13 22:51:29 -0700164
Robert Carr0bcbe642018-10-11 19:07:43 -0700165 jobject inputApplicationHandleObj = env->GetObjectField(obj,
166 gInputWindowHandleClassInfo.inputApplicationHandle);
167 if (inputApplicationHandleObj) {
168 sp<InputApplicationHandle> inputApplicationHandle =
Riddle Hsucd958bc2019-01-23 15:40:26 +0800169 android_view_InputApplicationHandle_getHandle(env, inputApplicationHandleObj);
Robert Carr0bcbe642018-10-11 19:07:43 -0700170 if (inputApplicationHandle != nullptr) {
171 inputApplicationHandle->updateInfo();
172 mInfo.applicationInfo = *(inputApplicationHandle->getInfo());
173 }
174 env->DeleteLocalRef(inputApplicationHandleObj);
175 }
176
Vishnu Nair40efb712019-03-12 13:37:51 -0700177 mInfo.replaceTouchableRegionWithCrop = env->GetBooleanField(obj,
178 gInputWindowHandleClassInfo.replaceTouchableRegionWithCrop);
179
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700180 jobject weakSurfaceCtrl = env->GetObjectField(obj,
181 gInputWindowHandleClassInfo.touchableRegionSurfaceControl.ctrl);
182 bool touchableRegionCropHandleSet = false;
183 if (weakSurfaceCtrl) {
Vishnu Nair40efb712019-03-12 13:37:51 -0700184 // Promote java weak reference.
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700185 jobject strongSurfaceCtrl = env->CallObjectMethod(weakSurfaceCtrl,
186 gInputWindowHandleClassInfo.touchableRegionSurfaceControl.get);
187 if (strongSurfaceCtrl) {
188 jlong mNativeObject = env->GetLongField(strongSurfaceCtrl,
189 gInputWindowHandleClassInfo.touchableRegionSurfaceControl.mNativeObject);
190 if (mNativeObject) {
191 auto ctrl = reinterpret_cast<SurfaceControl *>(mNativeObject);
192 mInfo.touchableRegionCropHandle = ctrl->getHandle();
193 touchableRegionCropHandleSet = true;
194 }
195 env->DeleteLocalRef(strongSurfaceCtrl);
Vishnu Nair40efb712019-03-12 13:37:51 -0700196 }
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700197 env->DeleteLocalRef(weakSurfaceCtrl);
198 }
199 if (!touchableRegionCropHandleSet) {
200 mInfo.touchableRegionCropHandle.clear();
Vishnu Nair40efb712019-03-12 13:37:51 -0700201 }
202
Jeff Brown9302c872011-07-13 22:51:29 -0700203 env->DeleteLocalRef(obj);
204 return true;
205}
206
Jeff Brown928e0542011-01-10 11:17:36 -0800207
208// --- Global functions ---
209
Riddle Hsucd958bc2019-01-23 15:40:26 +0800210sp<NativeInputWindowHandle> android_view_InputWindowHandle_getHandle(
Jeff Brown928e0542011-01-10 11:17:36 -0800211 JNIEnv* env, jobject inputWindowHandleObj) {
212 if (!inputWindowHandleObj) {
213 return NULL;
214 }
215
216 AutoMutex _l(gHandleMutex);
217
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000218 jlong ptr = env->GetLongField(inputWindowHandleObj, gInputWindowHandleClassInfo.ptr);
Jeff Brown928e0542011-01-10 11:17:36 -0800219 NativeInputWindowHandle* handle;
220 if (ptr) {
221 handle = reinterpret_cast<NativeInputWindowHandle*>(ptr);
222 } else {
Jeff Brown928e0542011-01-10 11:17:36 -0800223 jweak objWeak = env->NewWeakGlobalRef(inputWindowHandleObj);
Robert Carr0bcbe642018-10-11 19:07:43 -0700224 handle = new NativeInputWindowHandle(objWeak);
Riddle Hsucd958bc2019-01-23 15:40:26 +0800225 handle->incStrong((void*)android_view_InputWindowHandle_getHandle);
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000226 env->SetLongField(inputWindowHandleObj, gInputWindowHandleClassInfo.ptr,
227 reinterpret_cast<jlong>(handle));
Jeff Brown928e0542011-01-10 11:17:36 -0800228 }
229 return handle;
230}
231
232
233// --- JNI ---
234
Riddle Hsucd958bc2019-01-23 15:40:26 +0800235static void android_view_InputWindowHandle_nativeDispose(JNIEnv* env, jobject obj) {
Jeff Brown928e0542011-01-10 11:17:36 -0800236 AutoMutex _l(gHandleMutex);
237
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000238 jlong ptr = env->GetLongField(obj, gInputWindowHandleClassInfo.ptr);
Jeff Brown928e0542011-01-10 11:17:36 -0800239 if (ptr) {
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000240 env->SetLongField(obj, gInputWindowHandleClassInfo.ptr, 0);
Jeff Brown928e0542011-01-10 11:17:36 -0800241
242 NativeInputWindowHandle* handle = reinterpret_cast<NativeInputWindowHandle*>(ptr);
Riddle Hsucd958bc2019-01-23 15:40:26 +0800243 handle->decStrong((void*)android_view_InputWindowHandle_getHandle);
Jeff Brown928e0542011-01-10 11:17:36 -0800244 }
245}
246
247
Daniel Micay76f6a862015-09-19 17:31:01 -0400248static const JNINativeMethod gInputWindowHandleMethods[] = {
Jeff Brown928e0542011-01-10 11:17:36 -0800249 /* name, signature, funcPtr */
250 { "nativeDispose", "()V",
Riddle Hsucd958bc2019-01-23 15:40:26 +0800251 (void*) android_view_InputWindowHandle_nativeDispose },
Jeff Brown928e0542011-01-10 11:17:36 -0800252};
253
254#define FIND_CLASS(var, className) \
255 var = env->FindClass(className); \
Chih-Hung Hsieh6c896162016-05-19 15:29:38 -0700256 LOG_FATAL_IF(! (var), "Unable to find class " className);
Jeff Brown928e0542011-01-10 11:17:36 -0800257
258#define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \
259 var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \
Chih-Hung Hsieh6c896162016-05-19 15:29:38 -0700260 LOG_FATAL_IF(! (var), "Unable to find field " fieldName);
Jeff Brown928e0542011-01-10 11:17:36 -0800261
Vishnu Nair40efb712019-03-12 13:37:51 -0700262#define GET_METHOD_ID(var, clazz, methodName, methodSignature) \
263 var = env->GetMethodID(clazz, methodName, methodSignature); \
264 LOG_FATAL_IF(! (var), "Unable to find method " methodName);
265
Riddle Hsucd958bc2019-01-23 15:40:26 +0800266int register_android_view_InputWindowHandle(JNIEnv* env) {
Robert Carr788f5742018-07-30 17:46:45 -0700267 int res = jniRegisterNativeMethods(env, "android/view/InputWindowHandle",
Jeff Brown928e0542011-01-10 11:17:36 -0800268 gInputWindowHandleMethods, NELEM(gInputWindowHandleMethods));
Bernhard Rosenkränzer9c1c90e2014-11-12 14:45:58 +0100269 (void) res; // Faked use when LOG_NDEBUG.
Jeff Brown928e0542011-01-10 11:17:36 -0800270 LOG_FATAL_IF(res < 0, "Unable to register native methods.");
271
Carl Shapiro17cc33a2011-03-05 20:53:16 -0800272 jclass clazz;
Robert Carr788f5742018-07-30 17:46:45 -0700273 FIND_CLASS(clazz, "android/view/InputWindowHandle");
Jeff Brown928e0542011-01-10 11:17:36 -0800274
Carl Shapiro17cc33a2011-03-05 20:53:16 -0800275 GET_FIELD_ID(gInputWindowHandleClassInfo.ptr, clazz,
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000276 "ptr", "J");
Jeff Brown928e0542011-01-10 11:17:36 -0800277
Siarhei Vishniakoue890f592018-10-15 18:53:06 -0700278 GET_FIELD_ID(gInputWindowHandleClassInfo.inputApplicationHandle, clazz,
Robert Carr788f5742018-07-30 17:46:45 -0700279 "inputApplicationHandle", "Landroid/view/InputApplicationHandle;");
Jeff Brown928e0542011-01-10 11:17:36 -0800280
Robert Carreadae822018-10-11 19:07:03 -0700281 GET_FIELD_ID(gInputWindowHandleClassInfo.token, clazz,
282 "token", "Landroid/os/IBinder;");
Jeff Brown9302c872011-07-13 22:51:29 -0700283
284 GET_FIELD_ID(gInputWindowHandleClassInfo.name, clazz,
285 "name", "Ljava/lang/String;");
286
287 GET_FIELD_ID(gInputWindowHandleClassInfo.layoutParamsFlags, clazz,
288 "layoutParamsFlags", "I");
289
290 GET_FIELD_ID(gInputWindowHandleClassInfo.layoutParamsType, clazz,
291 "layoutParamsType", "I");
292
293 GET_FIELD_ID(gInputWindowHandleClassInfo.dispatchingTimeoutNanos, clazz,
294 "dispatchingTimeoutNanos", "J");
295
296 GET_FIELD_ID(gInputWindowHandleClassInfo.frameLeft, clazz,
297 "frameLeft", "I");
298
299 GET_FIELD_ID(gInputWindowHandleClassInfo.frameTop, clazz,
300 "frameTop", "I");
301
302 GET_FIELD_ID(gInputWindowHandleClassInfo.frameRight, clazz,
303 "frameRight", "I");
304
305 GET_FIELD_ID(gInputWindowHandleClassInfo.frameBottom, clazz,
306 "frameBottom", "I");
307
Robert Carrfcc08522018-11-14 14:02:52 -0800308 GET_FIELD_ID(gInputWindowHandleClassInfo.surfaceInset, clazz,
309 "surfaceInset", "I");
310
Jeff Brown9302c872011-07-13 22:51:29 -0700311 GET_FIELD_ID(gInputWindowHandleClassInfo.scaleFactor, clazz,
312 "scaleFactor", "F");
313
314 GET_FIELD_ID(gInputWindowHandleClassInfo.touchableRegion, clazz,
315 "touchableRegion", "Landroid/graphics/Region;");
316
317 GET_FIELD_ID(gInputWindowHandleClassInfo.visible, clazz,
318 "visible", "Z");
319
320 GET_FIELD_ID(gInputWindowHandleClassInfo.canReceiveKeys, clazz,
321 "canReceiveKeys", "Z");
322
323 GET_FIELD_ID(gInputWindowHandleClassInfo.hasFocus, clazz,
324 "hasFocus", "Z");
325
326 GET_FIELD_ID(gInputWindowHandleClassInfo.hasWallpaper, clazz,
327 "hasWallpaper", "Z");
328
329 GET_FIELD_ID(gInputWindowHandleClassInfo.paused, clazz,
330 "paused", "Z");
331
Jeff Brown9302c872011-07-13 22:51:29 -0700332 GET_FIELD_ID(gInputWindowHandleClassInfo.ownerPid, clazz,
333 "ownerPid", "I");
334
335 GET_FIELD_ID(gInputWindowHandleClassInfo.ownerUid, clazz,
336 "ownerUid", "I");
337
338 GET_FIELD_ID(gInputWindowHandleClassInfo.inputFeatures, clazz,
339 "inputFeatures", "I");
Jeff Brown83d616a2012-09-09 20:33:43 -0700340
341 GET_FIELD_ID(gInputWindowHandleClassInfo.displayId, clazz,
342 "displayId", "I");
Tiger Huang04dc4cc2019-01-17 18:41:41 +0800343
344 GET_FIELD_ID(gInputWindowHandleClassInfo.portalToDisplayId, clazz,
345 "portalToDisplayId", "I");
Vishnu Nair40efb712019-03-12 13:37:51 -0700346
347 GET_FIELD_ID(gInputWindowHandleClassInfo.replaceTouchableRegionWithCrop, clazz,
348 "replaceTouchableRegionWithCrop", "Z");
349
350 jclass weakRefClazz;
351 FIND_CLASS(weakRefClazz, "java/lang/ref/Reference");
352
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700353 GET_METHOD_ID(gInputWindowHandleClassInfo.touchableRegionSurfaceControl.get, weakRefClazz,
Vishnu Nair40efb712019-03-12 13:37:51 -0700354 "get", "()Ljava/lang/Object;")
355
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700356 GET_FIELD_ID(gInputWindowHandleClassInfo.touchableRegionSurfaceControl.ctrl, clazz,
357 "touchableRegionSurfaceControl", "Ljava/lang/ref/WeakReference;");
358
359 jclass surfaceControlClazz;
360 FIND_CLASS(surfaceControlClazz, "android/view/SurfaceControl");
361 GET_FIELD_ID(gInputWindowHandleClassInfo.touchableRegionSurfaceControl.mNativeObject,
362 surfaceControlClazz, "mNativeObject", "J");
363
Jeff Brown928e0542011-01-10 11:17:36 -0800364 return 0;
365}
366
367} /* namespace android */