summaryrefslogtreecommitdiff
path: root/native/android/input.cpp
diff options
context:
space:
mode:
author Arpit Singh <arpitks@google.com> 2024-02-16 12:10:39 +0000
committer Arpit Singh <arpitks@google.com> 2024-02-21 15:22:38 +0000
commit14ee29abbf9d8353982de0353548023fb590bdf5 (patch)
tree7318cab1767a82acd4402c4538adb6323bf45052 /native/android/input.cpp
parent51503c1a420f7523cad4c50fd79062c8c828c9c9 (diff)
Rename android.view.InputEvent obtain copy from native methods
Rename obtain Java InputEvent copy from native methods for Key and Motion events for consistency. This CL renames 1. android_view_MotionEvent_obtainAsCopy -> android_view_MotionEvent_obtainAsCopy 2. android_view_KeyEvent_fromNative -> android_view_KeyEvent_obtainAsCopy 3. android_view_KeyEvent_toNative -> android_view_KeyEvent_obtainAsCopy Bug: 324375527 Test: atest MotionEventTest KeyEventTest Change-Id: I2a2fee29fd8ffcce04a939d19d3f7a0ce0c5dcf1
Diffstat (limited to 'native/android/input.cpp')
-rw-r--r--native/android/input.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/native/android/input.cpp b/native/android/input.cpp
index 6efb0280ac02..4708e69447ec 100644
--- a/native/android/input.cpp
+++ b/native/android/input.cpp
@@ -87,7 +87,7 @@ int64_t AKeyEvent_getDownTime(const AInputEvent* key_event) {
const AInputEvent* AKeyEvent_fromJava(JNIEnv* env, jobject keyEvent) {
std::unique_ptr<KeyEvent> event = std::make_unique<KeyEvent>();
- *event = android::android_view_KeyEvent_toNative(env, keyEvent);
+ *event = android::android_view_KeyEvent_obtainAsCopy(env, keyEvent);
return event.release();
}
@@ -323,9 +323,9 @@ jobject AInputEvent_toJava(JNIEnv* env, const AInputEvent* aInputEvent) {
static_cast<const MotionEvent&>(
*aInputEvent));
case AINPUT_EVENT_TYPE_KEY:
- return android::android_view_KeyEvent_fromNative(env,
- static_cast<const KeyEvent&>(
- *aInputEvent));
+ return android::android_view_KeyEvent_obtainAsCopy(env,
+ static_cast<const KeyEvent&>(
+ *aInputEvent));
default:
LOG_ALWAYS_FATAL("Unexpected event type %d in AInputEvent_toJava.", eventType);
}