Loading core/java/android/view/InputWindowHandle.java +6 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.graphics.Region; import android.gui.TouchOcclusionMode; import android.os.IBinder; import android.os.InputConfig; import android.util.Size; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -106,6 +107,9 @@ public final class InputWindowHandle { // Window frame. public final Rect frame = new Rect(); // The real size of the content, excluding any crop. If no buffer is rendered, this is 0,0 public Size contentSize = new Size(0, 0); public int surfaceInset; // Global scaling factor applied to touch events when they are dispatched Loading Loading @@ -199,6 +203,7 @@ public final class InputWindowHandle { transform.set(other.transform); } focusTransferTarget = other.focusTransferTarget; contentSize = new Size(other.contentSize.getWidth(), other.contentSize.getHeight()); } @Override Loading @@ -211,6 +216,7 @@ public final class InputWindowHandle { .append(", windowToken=").append(windowToken) .append(", displayId=").append(displayId) .append(", isClone=").append((inputConfig & InputConfig.CLONE) != 0) .append(", contentSize=").append(contentSize) .toString(); } Loading core/jni/android_hardware_input_InputWindowHandle.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ static struct { jfieldID layoutParamsType; jfieldID dispatchingTimeoutMillis; jfieldID frame; jfieldID contentSize; jfieldID surfaceInset; jfieldID scaleFactor; jfieldID touchableRegion; Loading Loading @@ -281,6 +282,9 @@ jobject android_view_InputWindowHandle_fromWindowInfo(JNIEnv* env, gui::WindowIn ScopedLocalRef<jobject> rectObj(env, JNICommon::objFromRect(env, windowInfo.frame)); env->SetObjectField(inputWindowHandle, gInputWindowHandleClassInfo.frame, rectObj.get()); ScopedLocalRef<jobject> sizeObj(env, JNICommon::objFromSize(env, windowInfo.contentSize)); env->SetObjectField(inputWindowHandle, gInputWindowHandleClassInfo.contentSize, sizeObj.get()); env->SetIntField(inputWindowHandle, gInputWindowHandleClassInfo.surfaceInset, windowInfo.surfaceInset); env->SetFloatField(inputWindowHandle, gInputWindowHandleClassInfo.scaleFactor, Loading Loading @@ -393,6 +397,9 @@ int register_android_view_InputWindowHandle(JNIEnv* env) { GET_FIELD_ID(gInputWindowHandleClassInfo.frame, clazz, "frame", "Landroid/graphics/Rect;"); GET_FIELD_ID(gInputWindowHandleClassInfo.contentSize, clazz, "contentSize", "Landroid/util/Size;"); GET_FIELD_ID(gInputWindowHandleClassInfo.surfaceInset, clazz, "surfaceInset", "I"); Loading core/jni/jni_common.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,11 @@ static struct { jfieldID top; } gRectClassInfo; static struct { jclass clazz; jmethodID ctor; } gSizeClassInfo; Rect JNICommon::rectFromObj(JNIEnv* env, jobject rectObj) { int left = env->GetIntField(rectObj, gRectClassInfo.left); int top = env->GetIntField(rectObj, gRectClassInfo.top); Loading @@ -47,6 +52,10 @@ jobject JNICommon::objFromRect(JNIEnv* env, Rect rect) { rect.right, rect.bottom); } jobject JNICommon::objFromSize(JNIEnv* env, Size size) { return env->NewObject(gSizeClassInfo.clazz, gSizeClassInfo.ctor, size.width, size.height); } int register_jni_common(JNIEnv* env) { jclass rectClazz = FindClassOrDie(env, "android/graphics/Rect"); gRectClassInfo.clazz = MakeGlobalRefOrDie(env, rectClazz); Loading @@ -55,6 +64,11 @@ int register_jni_common(JNIEnv* env) { gRectClassInfo.left = GetFieldIDOrDie(env, rectClazz, "left", "I"); gRectClassInfo.right = GetFieldIDOrDie(env, rectClazz, "right", "I"); gRectClassInfo.top = GetFieldIDOrDie(env, rectClazz, "top", "I"); jclass sizeClazz = FindClassOrDie(env, "android/util/Size"); gSizeClassInfo.clazz = MakeGlobalRefOrDie(env, sizeClazz); gSizeClassInfo.ctor = GetMethodIDOrDie(env, sizeClazz, "<init>", "(II)V"); return 0; } Loading core/jni/jni_common.h +3 −0 Original line number Diff line number Diff line Loading @@ -14,14 +14,17 @@ * limitations under the License. */ #include <jni.h> #include <ui/Size.h> namespace android { class Rect; using ui::Size; class JNICommon { public: static Rect rectFromObj(JNIEnv* env, jobject rectObj); static jobject objFromRect(JNIEnv* env, Rect rect); static jobject objFromSize(JNIEnv* env, Size size); }; } // namespace android No newline at end of file Loading
core/java/android/view/InputWindowHandle.java +6 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.graphics.Region; import android.gui.TouchOcclusionMode; import android.os.IBinder; import android.os.InputConfig; import android.util.Size; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -106,6 +107,9 @@ public final class InputWindowHandle { // Window frame. public final Rect frame = new Rect(); // The real size of the content, excluding any crop. If no buffer is rendered, this is 0,0 public Size contentSize = new Size(0, 0); public int surfaceInset; // Global scaling factor applied to touch events when they are dispatched Loading Loading @@ -199,6 +203,7 @@ public final class InputWindowHandle { transform.set(other.transform); } focusTransferTarget = other.focusTransferTarget; contentSize = new Size(other.contentSize.getWidth(), other.contentSize.getHeight()); } @Override Loading @@ -211,6 +216,7 @@ public final class InputWindowHandle { .append(", windowToken=").append(windowToken) .append(", displayId=").append(displayId) .append(", isClone=").append((inputConfig & InputConfig.CLONE) != 0) .append(", contentSize=").append(contentSize) .toString(); } Loading
core/jni/android_hardware_input_InputWindowHandle.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ static struct { jfieldID layoutParamsType; jfieldID dispatchingTimeoutMillis; jfieldID frame; jfieldID contentSize; jfieldID surfaceInset; jfieldID scaleFactor; jfieldID touchableRegion; Loading Loading @@ -281,6 +282,9 @@ jobject android_view_InputWindowHandle_fromWindowInfo(JNIEnv* env, gui::WindowIn ScopedLocalRef<jobject> rectObj(env, JNICommon::objFromRect(env, windowInfo.frame)); env->SetObjectField(inputWindowHandle, gInputWindowHandleClassInfo.frame, rectObj.get()); ScopedLocalRef<jobject> sizeObj(env, JNICommon::objFromSize(env, windowInfo.contentSize)); env->SetObjectField(inputWindowHandle, gInputWindowHandleClassInfo.contentSize, sizeObj.get()); env->SetIntField(inputWindowHandle, gInputWindowHandleClassInfo.surfaceInset, windowInfo.surfaceInset); env->SetFloatField(inputWindowHandle, gInputWindowHandleClassInfo.scaleFactor, Loading Loading @@ -393,6 +397,9 @@ int register_android_view_InputWindowHandle(JNIEnv* env) { GET_FIELD_ID(gInputWindowHandleClassInfo.frame, clazz, "frame", "Landroid/graphics/Rect;"); GET_FIELD_ID(gInputWindowHandleClassInfo.contentSize, clazz, "contentSize", "Landroid/util/Size;"); GET_FIELD_ID(gInputWindowHandleClassInfo.surfaceInset, clazz, "surfaceInset", "I"); Loading
core/jni/jni_common.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,11 @@ static struct { jfieldID top; } gRectClassInfo; static struct { jclass clazz; jmethodID ctor; } gSizeClassInfo; Rect JNICommon::rectFromObj(JNIEnv* env, jobject rectObj) { int left = env->GetIntField(rectObj, gRectClassInfo.left); int top = env->GetIntField(rectObj, gRectClassInfo.top); Loading @@ -47,6 +52,10 @@ jobject JNICommon::objFromRect(JNIEnv* env, Rect rect) { rect.right, rect.bottom); } jobject JNICommon::objFromSize(JNIEnv* env, Size size) { return env->NewObject(gSizeClassInfo.clazz, gSizeClassInfo.ctor, size.width, size.height); } int register_jni_common(JNIEnv* env) { jclass rectClazz = FindClassOrDie(env, "android/graphics/Rect"); gRectClassInfo.clazz = MakeGlobalRefOrDie(env, rectClazz); Loading @@ -55,6 +64,11 @@ int register_jni_common(JNIEnv* env) { gRectClassInfo.left = GetFieldIDOrDie(env, rectClazz, "left", "I"); gRectClassInfo.right = GetFieldIDOrDie(env, rectClazz, "right", "I"); gRectClassInfo.top = GetFieldIDOrDie(env, rectClazz, "top", "I"); jclass sizeClazz = FindClassOrDie(env, "android/util/Size"); gSizeClassInfo.clazz = MakeGlobalRefOrDie(env, sizeClazz); gSizeClassInfo.ctor = GetMethodIDOrDie(env, sizeClazz, "<init>", "(II)V"); return 0; } Loading
core/jni/jni_common.h +3 −0 Original line number Diff line number Diff line Loading @@ -14,14 +14,17 @@ * limitations under the License. */ #include <jni.h> #include <ui/Size.h> namespace android { class Rect; using ui::Size; class JNICommon { public: static Rect rectFromObj(JNIEnv* env, jobject rectObj); static jobject objFromRect(JNIEnv* env, Rect rect); static jobject objFromSize(JNIEnv* env, Size size); }; } // namespace android No newline at end of file