diff --git a/core/jni/android_view_InputEventReceiver.cpp b/core/jni/android_view_InputEventReceiver.cpp
index 6fcff99..0f41229 100644
--- a/core/jni/android_view_InputEventReceiver.cpp
+++ b/core/jni/android_view_InputEventReceiver.cpp
@@ -374,7 +374,7 @@
                     }
                     inputEventObj =
                             android_view_KeyEvent_fromNative(env,
-                                                             static_cast<KeyEvent*>(inputEvent));
+                                                             static_cast<KeyEvent&>(*inputEvent));
                     break;
 
                 case InputEventType::MOTION: {
diff --git a/core/jni/android_view_InputEventSender.cpp b/core/jni/android_view_InputEventSender.cpp
index ad54004..15270ef 100644
--- a/core/jni/android_view_InputEventSender.cpp
+++ b/core/jni/android_view_InputEventSender.cpp
@@ -353,8 +353,7 @@
         jint seq, jobject eventObj) {
     sp<NativeInputEventSender> sender =
             reinterpret_cast<NativeInputEventSender*>(senderPtr);
-    KeyEvent event;
-    android_view_KeyEvent_toNative(env, eventObj, &event);
+    const KeyEvent event = android_view_KeyEvent_toNative(env, eventObj);
     status_t status = sender->sendKeyEvent(seq, &event);
     return !status;
 }
diff --git a/core/jni/android_view_InputQueue.cpp b/core/jni/android_view_InputQueue.cpp
index 2c4966e..21db37e 100644
--- a/core/jni/android_view_InputQueue.cpp
+++ b/core/jni/android_view_InputQueue.cpp
@@ -221,12 +221,7 @@
         jboolean predispatch) {
     InputQueue* queue = reinterpret_cast<InputQueue*>(ptr);
     KeyEvent* event = queue->createKeyEvent();
-    status_t status = android_view_KeyEvent_toNative(env, eventObj, event);
-    if (status) {
-        queue->recycleInputEvent(event);
-        jniThrowRuntimeException(env, "Could not read contents of KeyEvent object.");
-        return -1;
-    }
+    *event = android_view_KeyEvent_toNative(env, eventObj);
 
     if (predispatch) {
         event->setFlags(event->getFlags() | AKEY_EVENT_FLAG_PREDISPATCH);
diff --git a/core/jni/android_view_KeyCharacterMap.cpp b/core/jni/android_view_KeyCharacterMap.cpp
index 469e577..8fa03cf 100644
--- a/core/jni/android_view_KeyCharacterMap.cpp
+++ b/core/jni/android_view_KeyCharacterMap.cpp
@@ -217,7 +217,7 @@
         result = env->NewObjectArray(jsize(events.size()), gKeyEventClassInfo.clazz, NULL);
         if (result) {
             for (size_t i = 0; i < events.size(); i++) {
-                jobject keyEventObj = android_view_KeyEvent_fromNative(env, &events.itemAt(i));
+                jobject keyEventObj = android_view_KeyEvent_fromNative(env, events.itemAt(i));
                 if (!keyEventObj) break; // threw OOM exception
                 env->SetObjectArrayElement(result, jsize(i), keyEventObj);
                 env->DeleteLocalRef(keyEventObj);
diff --git a/core/jni/android_view_KeyEvent.cpp b/core/jni/android_view_KeyEvent.cpp
index d5568df..a9c9919 100644
--- a/core/jni/android_view_KeyEvent.cpp
+++ b/core/jni/android_view_KeyEvent.cpp
@@ -94,16 +94,16 @@
 
 // ----------------------------------------------------------------------------
 
-jobject android_view_KeyEvent_fromNative(JNIEnv* env, const KeyEvent* event) {
-    ScopedLocalRef<jbyteArray> hmac = toJbyteArray(env, event->getHmac());
+jobject android_view_KeyEvent_fromNative(JNIEnv* env, const KeyEvent& event) {
+    ScopedLocalRef<jbyteArray> hmac = toJbyteArray(env, event.getHmac());
     jobject eventObj =
             env->CallStaticObjectMethod(gKeyEventClassInfo.clazz, gKeyEventClassInfo.obtain,
-                                        event->getId(), event->getDownTime(), event->getEventTime(),
-                                        event->getAction(), event->getKeyCode(),
-                                        event->getRepeatCount(), event->getMetaState(),
-                                        event->getDeviceId(), event->getScanCode(),
-                                        event->getFlags(), event->getSource(),
-                                        event->getDisplayId(), hmac.get(), nullptr);
+                                        event.getId(), event.getDownTime(), event.getEventTime(),
+                                        event.getAction(), event.getKeyCode(),
+                                        event.getRepeatCount(), event.getMetaState(),
+                                        event.getDeviceId(), event.getScanCode(), event.getFlags(),
+                                        event.getSource(), event.getDisplayId(), hmac.get(),
+                                        nullptr);
     if (env->ExceptionCheck()) {
         ALOGE("An exception occurred while obtaining a key event.");
         LOGE_EX(env);
@@ -113,8 +113,7 @@
     return eventObj;
 }
 
-status_t android_view_KeyEvent_toNative(JNIEnv* env, jobject eventObj,
-        KeyEvent* event) {
+KeyEvent android_view_KeyEvent_toNative(JNIEnv* env, jobject eventObj) {
     jint id = env->GetIntField(eventObj, gKeyEventClassInfo.mId);
     jint deviceId = env->GetIntField(eventObj, gKeyEventClassInfo.mDeviceId);
     jint source = env->GetIntField(eventObj, gKeyEventClassInfo.mSource);
@@ -133,9 +132,10 @@
     jlong downTime = env->GetLongField(eventObj, gKeyEventClassInfo.mDownTime);
     jlong eventTime = env->GetLongField(eventObj, gKeyEventClassInfo.mEventTime);
 
-    event->initialize(id, deviceId, source, displayId, *hmac, action, flags, keyCode, scanCode,
-                      metaState, repeatCount, downTime, eventTime);
-    return OK;
+    KeyEvent event;
+    event.initialize(id, deviceId, source, displayId, *hmac, action, flags, keyCode, scanCode,
+                     metaState, repeatCount, downTime, eventTime);
+    return event;
 }
 
 status_t android_view_KeyEvent_recycle(JNIEnv* env, jobject eventObj) {
diff --git a/core/jni/android_view_KeyEvent.h b/core/jni/android_view_KeyEvent.h
index dab6bb7..bc4876a 100644
--- a/core/jni/android_view_KeyEvent.h
+++ b/core/jni/android_view_KeyEvent.h
@@ -27,12 +27,11 @@
 
 /* Obtains an instance of a DVM KeyEvent object as a copy of a native KeyEvent instance.
  * Returns NULL on error. */
-extern jobject android_view_KeyEvent_fromNative(JNIEnv* env, const KeyEvent* event);
+extern jobject android_view_KeyEvent_fromNative(JNIEnv* env, const KeyEvent& event);
 
 /* Copies the contents of a DVM KeyEvent object to a native KeyEvent instance.
  * Returns non-zero on error. */
-extern status_t android_view_KeyEvent_toNative(JNIEnv* env, jobject eventObj,
-        KeyEvent* event);
+extern KeyEvent android_view_KeyEvent_toNative(JNIEnv* env, jobject eventObj);
 
 /* Recycles a DVM KeyEvent object.
  * Key events should only be recycled if they are owned by the system since user
diff --git a/native/android/input.cpp b/native/android/input.cpp
index 1bff97d..64e8efe 100644
--- a/native/android/input.cpp
+++ b/native/android/input.cpp
@@ -87,11 +87,8 @@
 
 const AInputEvent* AKeyEvent_fromJava(JNIEnv* env, jobject keyEvent) {
     std::unique_ptr<KeyEvent> event = std::make_unique<KeyEvent>();
-    android::status_t ret = android::android_view_KeyEvent_toNative(env, keyEvent, event.get());
-    if (ret == android::OK) {
-        return event.release();
-    }
-    return nullptr;
+    *event = android::android_view_KeyEvent_toNative(env, keyEvent);
+    return event.release();
 }
 
 int64_t AKeyEvent_getEventTime(const AInputEvent* key_event) {
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index 7ff3ecb..f0d718a 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -1304,7 +1304,7 @@
         case InputEventType::KEY:
             inputEventObj.reset(
                     android_view_KeyEvent_fromNative(env,
-                                                     static_cast<const KeyEvent*>(&inputEvent)));
+                                                     static_cast<const KeyEvent&>(inputEvent)));
             break;
         case InputEventType::MOTION:
             inputEventObj.reset(
@@ -1352,7 +1352,7 @@
 
     const nsecs_t when = keyEvent.getEventTime();
     JNIEnv* env = jniEnv();
-    ScopedLocalRef<jobject> keyEventObj(env, android_view_KeyEvent_fromNative(env, &keyEvent));
+    ScopedLocalRef<jobject> keyEventObj(env, android_view_KeyEvent_fromNative(env, keyEvent));
     if (!keyEventObj.get()) {
         ALOGE("Failed to obtain key event object for interceptKeyBeforeQueueing.");
         return;
@@ -1431,7 +1431,7 @@
 
     // Token may be null
     ScopedLocalRef<jobject> tokenObj(env, javaObjectForIBinder(env, token));
-    ScopedLocalRef<jobject> keyEventObj(env, android_view_KeyEvent_fromNative(env, &keyEvent));
+    ScopedLocalRef<jobject> keyEventObj(env, android_view_KeyEvent_fromNative(env, keyEvent));
     if (!keyEventObj.get()) {
         ALOGE("Failed to obtain key event object for interceptKeyBeforeDispatching.");
         return 0;
@@ -1462,7 +1462,7 @@
 
     // Note: tokenObj may be null.
     ScopedLocalRef<jobject> tokenObj(env, javaObjectForIBinder(env, token));
-    ScopedLocalRef<jobject> keyEventObj(env, android_view_KeyEvent_fromNative(env, &keyEvent));
+    ScopedLocalRef<jobject> keyEventObj(env, android_view_KeyEvent_fromNative(env, keyEvent));
     if (!keyEventObj.get()) {
         ALOGE("Failed to obtain key event object for dispatchUnhandledKey.");
         return {};
@@ -1481,9 +1481,7 @@
         return {};
     }
 
-    KeyEvent fallbackEvent;
-    LOG_ALWAYS_FATAL_IF(
-            android_view_KeyEvent_toNative(env, fallbackKeyEventObj.get(), &fallbackEvent) != OK);
+    const KeyEvent fallbackEvent = android_view_KeyEvent_toNative(env, fallbackKeyEventObj.get());
     android_view_KeyEvent_recycle(env, fallbackKeyEventObj.get());
     return fallbackEvent;
 }
@@ -1876,13 +1874,7 @@
     InputEventInjectionSync mode = static_cast<InputEventInjectionSync>(syncMode);
 
     if (env->IsInstanceOf(inputEventObj, gKeyEventClassInfo.clazz)) {
-        KeyEvent keyEvent;
-        status_t status = android_view_KeyEvent_toNative(env, inputEventObj, & keyEvent);
-        if (status) {
-            jniThrowRuntimeException(env, "Could not read contents of KeyEvent object.");
-            return static_cast<jint>(InputEventInjectionResult::FAILED);
-        }
-
+        const KeyEvent keyEvent = android_view_KeyEvent_toNative(env, inputEventObj);
         const InputEventInjectionResult result =
                 im->getInputManager()->getDispatcher().injectInputEvent(&keyEvent, targetUid, mode,
                                                                         std::chrono::milliseconds(
@@ -1913,13 +1905,7 @@
     NativeInputManager* im = getNativeInputManager(env, nativeImplObj);
 
     if (env->IsInstanceOf(inputEventObj, gKeyEventClassInfo.clazz)) {
-        KeyEvent keyEvent;
-        status_t status = android_view_KeyEvent_toNative(env, inputEventObj, &keyEvent);
-        if (status) {
-            jniThrowRuntimeException(env, "Could not read contents of KeyEvent object.");
-            return nullptr;
-        }
-
+        const KeyEvent keyEvent = android_view_KeyEvent_toNative(env, inputEventObj);
         std::unique_ptr<VerifiedInputEvent> verifiedEvent =
                 im->getInputManager()->getDispatcher().verifyInputEvent(keyEvent);
         if (verifiedEvent == nullptr) {
