blob: 2265268f4d20beb0f723c4140a1cedf0cb0de241 [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;
62 jfieldID layer;
63 jfieldID ownerPid;
64 jfieldID ownerUid;
65 jfieldID inputFeatures;
Jeff Brown83d616a2012-09-09 20:33:43 -070066 jfieldID displayId;
Tiger Huang04dc4cc2019-01-17 18:41:41 +080067 jfieldID portalToDisplayId;
Vishnu Nair40efb712019-03-12 13:37:51 -070068 jfieldID replaceTouchableRegionWithCrop;
Vishnu Nairbc9beab2019-06-25 17:28:58 -070069 WeakRefHandleField touchableRegionSurfaceControl;
Jeff Brown928e0542011-01-10 11:17:36 -080070} gInputWindowHandleClassInfo;
71
72static Mutex gHandleMutex;
73
74
75// --- NativeInputWindowHandle ---
76
Robert Carr0bcbe642018-10-11 19:07:43 -070077NativeInputWindowHandle::NativeInputWindowHandle(jweak objWeak) :
Jeff Brown928e0542011-01-10 11:17:36 -080078 mObjWeak(objWeak) {
79}
80
81NativeInputWindowHandle::~NativeInputWindowHandle() {
82 JNIEnv* env = AndroidRuntime::getJNIEnv();
83 env->DeleteWeakGlobalRef(mObjWeak);
Vishnu Nairc06ec082019-08-20 09:12:26 -070084
85 // Clear the weak reference to the layer handle and flush any binder ref count operations so we
86 // do not hold on to any binder references.
87 // TODO(b/139697085) remove this after it can be flushed automatically
88 mInfo.touchableRegionCropHandle.clear();
89 IPCThreadState::self()->flushCommands();
Jeff Brown928e0542011-01-10 11:17:36 -080090}
91
92jobject NativeInputWindowHandle::getInputWindowHandleObjLocalRef(JNIEnv* env) {
93 return env->NewLocalRef(mObjWeak);
94}
95
Jeff Browncc4f7db2011-08-30 20:34:48 -070096bool NativeInputWindowHandle::updateInfo() {
Jeff Brown9302c872011-07-13 22:51:29 -070097 JNIEnv* env = AndroidRuntime::getJNIEnv();
98 jobject obj = env->NewLocalRef(mObjWeak);
99 if (!obj) {
Arthur Hung06ad38d2018-11-05 19:23:21 +0800100 releaseChannel();
Jeff Brown9302c872011-07-13 22:51:29 -0700101 return false;
102 }
103
Arthur Hung06ad38d2018-11-05 19:23:21 +0800104 mInfo.touchableRegion.clear();
Jeff Browncc4f7db2011-08-30 20:34:48 -0700105
Siarhei Vishniakoue890f592018-10-15 18:53:06 -0700106 jobject tokenObj = env->GetObjectField(obj, gInputWindowHandleClassInfo.token);
Robert Carreadae822018-10-11 19:07:03 -0700107 if (tokenObj) {
108 mInfo.token = ibinderForJavaObject(env, tokenObj);
Vishnu Nair40efb712019-03-12 13:37:51 -0700109 env->DeleteLocalRef(tokenObj);
Jeff Brown9302c872011-07-13 22:51:29 -0700110 } else {
Robert Carreadae822018-10-11 19:07:03 -0700111 mInfo.token.clear();
Jeff Brown9302c872011-07-13 22:51:29 -0700112 }
113
Siarhei Vishniakoue890f592018-10-15 18:53:06 -0700114 mInfo.name = getStringField(env, obj, gInputWindowHandleClassInfo.name, "<null>");
Jeff Brown9302c872011-07-13 22:51:29 -0700115
Arthur Hung06ad38d2018-11-05 19:23:21 +0800116 mInfo.layoutParamsFlags = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700117 gInputWindowHandleClassInfo.layoutParamsFlags);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800118 mInfo.layoutParamsType = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700119 gInputWindowHandleClassInfo.layoutParamsType);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800120 mInfo.dispatchingTimeout = env->GetLongField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700121 gInputWindowHandleClassInfo.dispatchingTimeoutNanos);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800122 mInfo.frameLeft = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700123 gInputWindowHandleClassInfo.frameLeft);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800124 mInfo.frameTop = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700125 gInputWindowHandleClassInfo.frameTop);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800126 mInfo.frameRight = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700127 gInputWindowHandleClassInfo.frameRight);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800128 mInfo.frameBottom = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700129 gInputWindowHandleClassInfo.frameBottom);
Robert Carrfcc08522018-11-14 14:02:52 -0800130 mInfo.surfaceInset = env->GetIntField(obj,
131 gInputWindowHandleClassInfo.surfaceInset);
Robert Carr51141c02018-11-26 13:11:05 -0800132 mInfo.globalScaleFactor = env->GetFloatField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700133 gInputWindowHandleClassInfo.scaleFactor);
134
135 jobject regionObj = env->GetObjectField(obj,
136 gInputWindowHandleClassInfo.touchableRegion);
137 if (regionObj) {
Derek Sollenberger40d78132019-08-12 11:06:08 -0400138 for (graphics::RegionIterator it(env, regionObj); !it.isDone(); it.next()) {
139 ARect rect = it.getRect();
140 mInfo.addTouchableRegion(Rect(rect.left, rect.top, rect.right, rect.bottom));
Michael Wrighta407d6a2014-02-05 18:02:40 -0800141 }
Jeff Brown9302c872011-07-13 22:51:29 -0700142 env->DeleteLocalRef(regionObj);
Jeff Brown9302c872011-07-13 22:51:29 -0700143 }
144
Arthur Hung06ad38d2018-11-05 19:23:21 +0800145 mInfo.visible = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700146 gInputWindowHandleClassInfo.visible);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800147 mInfo.canReceiveKeys = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700148 gInputWindowHandleClassInfo.canReceiveKeys);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800149 mInfo.hasFocus = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700150 gInputWindowHandleClassInfo.hasFocus);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800151 mInfo.hasWallpaper = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700152 gInputWindowHandleClassInfo.hasWallpaper);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800153 mInfo.paused = env->GetBooleanField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700154 gInputWindowHandleClassInfo.paused);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800155 mInfo.layer = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700156 gInputWindowHandleClassInfo.layer);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800157 mInfo.ownerPid = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700158 gInputWindowHandleClassInfo.ownerPid);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800159 mInfo.ownerUid = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700160 gInputWindowHandleClassInfo.ownerUid);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800161 mInfo.inputFeatures = env->GetIntField(obj,
Jeff Brown9302c872011-07-13 22:51:29 -0700162 gInputWindowHandleClassInfo.inputFeatures);
Arthur Hung06ad38d2018-11-05 19:23:21 +0800163 mInfo.displayId = env->GetIntField(obj,
Jeff Brown83d616a2012-09-09 20:33:43 -0700164 gInputWindowHandleClassInfo.displayId);
Tiger Huang04dc4cc2019-01-17 18:41:41 +0800165 mInfo.portalToDisplayId = env->GetIntField(obj,
166 gInputWindowHandleClassInfo.portalToDisplayId);
Jeff Brown9302c872011-07-13 22:51:29 -0700167
Robert Carr0bcbe642018-10-11 19:07:43 -0700168 jobject inputApplicationHandleObj = env->GetObjectField(obj,
169 gInputWindowHandleClassInfo.inputApplicationHandle);
170 if (inputApplicationHandleObj) {
171 sp<InputApplicationHandle> inputApplicationHandle =
Riddle Hsucd958bc2019-01-23 15:40:26 +0800172 android_view_InputApplicationHandle_getHandle(env, inputApplicationHandleObj);
Robert Carr0bcbe642018-10-11 19:07:43 -0700173 if (inputApplicationHandle != nullptr) {
174 inputApplicationHandle->updateInfo();
175 mInfo.applicationInfo = *(inputApplicationHandle->getInfo());
176 }
177 env->DeleteLocalRef(inputApplicationHandleObj);
178 }
179
Vishnu Nair40efb712019-03-12 13:37:51 -0700180 mInfo.replaceTouchableRegionWithCrop = env->GetBooleanField(obj,
181 gInputWindowHandleClassInfo.replaceTouchableRegionWithCrop);
182
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700183 jobject weakSurfaceCtrl = env->GetObjectField(obj,
184 gInputWindowHandleClassInfo.touchableRegionSurfaceControl.ctrl);
185 bool touchableRegionCropHandleSet = false;
186 if (weakSurfaceCtrl) {
Vishnu Nair40efb712019-03-12 13:37:51 -0700187 // Promote java weak reference.
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700188 jobject strongSurfaceCtrl = env->CallObjectMethod(weakSurfaceCtrl,
189 gInputWindowHandleClassInfo.touchableRegionSurfaceControl.get);
190 if (strongSurfaceCtrl) {
191 jlong mNativeObject = env->GetLongField(strongSurfaceCtrl,
192 gInputWindowHandleClassInfo.touchableRegionSurfaceControl.mNativeObject);
193 if (mNativeObject) {
194 auto ctrl = reinterpret_cast<SurfaceControl *>(mNativeObject);
195 mInfo.touchableRegionCropHandle = ctrl->getHandle();
196 touchableRegionCropHandleSet = true;
197 }
198 env->DeleteLocalRef(strongSurfaceCtrl);
Vishnu Nair40efb712019-03-12 13:37:51 -0700199 }
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700200 env->DeleteLocalRef(weakSurfaceCtrl);
201 }
202 if (!touchableRegionCropHandleSet) {
203 mInfo.touchableRegionCropHandle.clear();
Vishnu Nair40efb712019-03-12 13:37:51 -0700204 }
205
Jeff Brown9302c872011-07-13 22:51:29 -0700206 env->DeleteLocalRef(obj);
207 return true;
208}
209
Jeff Brown928e0542011-01-10 11:17:36 -0800210
211// --- Global functions ---
212
Riddle Hsucd958bc2019-01-23 15:40:26 +0800213sp<NativeInputWindowHandle> android_view_InputWindowHandle_getHandle(
Jeff Brown928e0542011-01-10 11:17:36 -0800214 JNIEnv* env, jobject inputWindowHandleObj) {
215 if (!inputWindowHandleObj) {
216 return NULL;
217 }
218
219 AutoMutex _l(gHandleMutex);
220
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000221 jlong ptr = env->GetLongField(inputWindowHandleObj, gInputWindowHandleClassInfo.ptr);
Jeff Brown928e0542011-01-10 11:17:36 -0800222 NativeInputWindowHandle* handle;
223 if (ptr) {
224 handle = reinterpret_cast<NativeInputWindowHandle*>(ptr);
225 } else {
Jeff Brown928e0542011-01-10 11:17:36 -0800226 jweak objWeak = env->NewWeakGlobalRef(inputWindowHandleObj);
Robert Carr0bcbe642018-10-11 19:07:43 -0700227 handle = new NativeInputWindowHandle(objWeak);
Riddle Hsucd958bc2019-01-23 15:40:26 +0800228 handle->incStrong((void*)android_view_InputWindowHandle_getHandle);
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000229 env->SetLongField(inputWindowHandleObj, gInputWindowHandleClassInfo.ptr,
230 reinterpret_cast<jlong>(handle));
Jeff Brown928e0542011-01-10 11:17:36 -0800231 }
232 return handle;
233}
234
235
236// --- JNI ---
237
Riddle Hsucd958bc2019-01-23 15:40:26 +0800238static void android_view_InputWindowHandle_nativeDispose(JNIEnv* env, jobject obj) {
Jeff Brown928e0542011-01-10 11:17:36 -0800239 AutoMutex _l(gHandleMutex);
240
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000241 jlong ptr = env->GetLongField(obj, gInputWindowHandleClassInfo.ptr);
Jeff Brown928e0542011-01-10 11:17:36 -0800242 if (ptr) {
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000243 env->SetLongField(obj, gInputWindowHandleClassInfo.ptr, 0);
Jeff Brown928e0542011-01-10 11:17:36 -0800244
245 NativeInputWindowHandle* handle = reinterpret_cast<NativeInputWindowHandle*>(ptr);
Riddle Hsucd958bc2019-01-23 15:40:26 +0800246 handle->decStrong((void*)android_view_InputWindowHandle_getHandle);
Jeff Brown928e0542011-01-10 11:17:36 -0800247 }
248}
249
250
Daniel Micay76f6a862015-09-19 17:31:01 -0400251static const JNINativeMethod gInputWindowHandleMethods[] = {
Jeff Brown928e0542011-01-10 11:17:36 -0800252 /* name, signature, funcPtr */
253 { "nativeDispose", "()V",
Riddle Hsucd958bc2019-01-23 15:40:26 +0800254 (void*) android_view_InputWindowHandle_nativeDispose },
Jeff Brown928e0542011-01-10 11:17:36 -0800255};
256
257#define FIND_CLASS(var, className) \
258 var = env->FindClass(className); \
Chih-Hung Hsieh6c896162016-05-19 15:29:38 -0700259 LOG_FATAL_IF(! (var), "Unable to find class " className);
Jeff Brown928e0542011-01-10 11:17:36 -0800260
261#define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \
262 var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \
Chih-Hung Hsieh6c896162016-05-19 15:29:38 -0700263 LOG_FATAL_IF(! (var), "Unable to find field " fieldName);
Jeff Brown928e0542011-01-10 11:17:36 -0800264
Vishnu Nair40efb712019-03-12 13:37:51 -0700265#define GET_METHOD_ID(var, clazz, methodName, methodSignature) \
266 var = env->GetMethodID(clazz, methodName, methodSignature); \
267 LOG_FATAL_IF(! (var), "Unable to find method " methodName);
268
Riddle Hsucd958bc2019-01-23 15:40:26 +0800269int register_android_view_InputWindowHandle(JNIEnv* env) {
Robert Carr788f5742018-07-30 17:46:45 -0700270 int res = jniRegisterNativeMethods(env, "android/view/InputWindowHandle",
Jeff Brown928e0542011-01-10 11:17:36 -0800271 gInputWindowHandleMethods, NELEM(gInputWindowHandleMethods));
Bernhard Rosenkränzer9c1c90e2014-11-12 14:45:58 +0100272 (void) res; // Faked use when LOG_NDEBUG.
Jeff Brown928e0542011-01-10 11:17:36 -0800273 LOG_FATAL_IF(res < 0, "Unable to register native methods.");
274
Carl Shapiro17cc33a2011-03-05 20:53:16 -0800275 jclass clazz;
Robert Carr788f5742018-07-30 17:46:45 -0700276 FIND_CLASS(clazz, "android/view/InputWindowHandle");
Jeff Brown928e0542011-01-10 11:17:36 -0800277
Carl Shapiro17cc33a2011-03-05 20:53:16 -0800278 GET_FIELD_ID(gInputWindowHandleClassInfo.ptr, clazz,
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +0000279 "ptr", "J");
Jeff Brown928e0542011-01-10 11:17:36 -0800280
Siarhei Vishniakoue890f592018-10-15 18:53:06 -0700281 GET_FIELD_ID(gInputWindowHandleClassInfo.inputApplicationHandle, clazz,
Robert Carr788f5742018-07-30 17:46:45 -0700282 "inputApplicationHandle", "Landroid/view/InputApplicationHandle;");
Jeff Brown928e0542011-01-10 11:17:36 -0800283
Robert Carreadae822018-10-11 19:07:03 -0700284 GET_FIELD_ID(gInputWindowHandleClassInfo.token, clazz,
285 "token", "Landroid/os/IBinder;");
Jeff Brown9302c872011-07-13 22:51:29 -0700286
287 GET_FIELD_ID(gInputWindowHandleClassInfo.name, clazz,
288 "name", "Ljava/lang/String;");
289
290 GET_FIELD_ID(gInputWindowHandleClassInfo.layoutParamsFlags, clazz,
291 "layoutParamsFlags", "I");
292
293 GET_FIELD_ID(gInputWindowHandleClassInfo.layoutParamsType, clazz,
294 "layoutParamsType", "I");
295
296 GET_FIELD_ID(gInputWindowHandleClassInfo.dispatchingTimeoutNanos, clazz,
297 "dispatchingTimeoutNanos", "J");
298
299 GET_FIELD_ID(gInputWindowHandleClassInfo.frameLeft, clazz,
300 "frameLeft", "I");
301
302 GET_FIELD_ID(gInputWindowHandleClassInfo.frameTop, clazz,
303 "frameTop", "I");
304
305 GET_FIELD_ID(gInputWindowHandleClassInfo.frameRight, clazz,
306 "frameRight", "I");
307
308 GET_FIELD_ID(gInputWindowHandleClassInfo.frameBottom, clazz,
309 "frameBottom", "I");
310
Robert Carrfcc08522018-11-14 14:02:52 -0800311 GET_FIELD_ID(gInputWindowHandleClassInfo.surfaceInset, clazz,
312 "surfaceInset", "I");
313
Jeff Brown9302c872011-07-13 22:51:29 -0700314 GET_FIELD_ID(gInputWindowHandleClassInfo.scaleFactor, clazz,
315 "scaleFactor", "F");
316
317 GET_FIELD_ID(gInputWindowHandleClassInfo.touchableRegion, clazz,
318 "touchableRegion", "Landroid/graphics/Region;");
319
320 GET_FIELD_ID(gInputWindowHandleClassInfo.visible, clazz,
321 "visible", "Z");
322
323 GET_FIELD_ID(gInputWindowHandleClassInfo.canReceiveKeys, clazz,
324 "canReceiveKeys", "Z");
325
326 GET_FIELD_ID(gInputWindowHandleClassInfo.hasFocus, clazz,
327 "hasFocus", "Z");
328
329 GET_FIELD_ID(gInputWindowHandleClassInfo.hasWallpaper, clazz,
330 "hasWallpaper", "Z");
331
332 GET_FIELD_ID(gInputWindowHandleClassInfo.paused, clazz,
333 "paused", "Z");
334
335 GET_FIELD_ID(gInputWindowHandleClassInfo.layer, clazz,
336 "layer", "I");
337
338 GET_FIELD_ID(gInputWindowHandleClassInfo.ownerPid, clazz,
339 "ownerPid", "I");
340
341 GET_FIELD_ID(gInputWindowHandleClassInfo.ownerUid, clazz,
342 "ownerUid", "I");
343
344 GET_FIELD_ID(gInputWindowHandleClassInfo.inputFeatures, clazz,
345 "inputFeatures", "I");
Jeff Brown83d616a2012-09-09 20:33:43 -0700346
347 GET_FIELD_ID(gInputWindowHandleClassInfo.displayId, clazz,
348 "displayId", "I");
Tiger Huang04dc4cc2019-01-17 18:41:41 +0800349
350 GET_FIELD_ID(gInputWindowHandleClassInfo.portalToDisplayId, clazz,
351 "portalToDisplayId", "I");
Vishnu Nair40efb712019-03-12 13:37:51 -0700352
353 GET_FIELD_ID(gInputWindowHandleClassInfo.replaceTouchableRegionWithCrop, clazz,
354 "replaceTouchableRegionWithCrop", "Z");
355
356 jclass weakRefClazz;
357 FIND_CLASS(weakRefClazz, "java/lang/ref/Reference");
358
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700359 GET_METHOD_ID(gInputWindowHandleClassInfo.touchableRegionSurfaceControl.get, weakRefClazz,
Vishnu Nair40efb712019-03-12 13:37:51 -0700360 "get", "()Ljava/lang/Object;")
361
Vishnu Nairbc9beab2019-06-25 17:28:58 -0700362 GET_FIELD_ID(gInputWindowHandleClassInfo.touchableRegionSurfaceControl.ctrl, clazz,
363 "touchableRegionSurfaceControl", "Ljava/lang/ref/WeakReference;");
364
365 jclass surfaceControlClazz;
366 FIND_CLASS(surfaceControlClazz, "android/view/SurfaceControl");
367 GET_FIELD_ID(gInputWindowHandleClassInfo.touchableRegionSurfaceControl.mNativeObject,
368 surfaceControlClazz, "mNativeObject", "J");
369
Jeff Brown928e0542011-01-10 11:17:36 -0800370 return 0;
371}
372
373} /* namespace android */