[Huawei P8 ROMs, Kernels, Recoveries, & Other Devel] nexolight:
I don't get it

This is where it happens:

static inline jmethodID GetMethodIDOrDie(JNIEnv* env, jclass clazz, const char* method_name,
const char* method_signature) {
jmethodID res = env->GetMethodID(clazz, method_name, method_signature);
LOG_ALWAYS_FATAL_IF(res == NULL, "Unable to find method %s", method_name);
return res;
}

this is in android_view_KeyEvent.cpp:

static struct {
jclass clazz;

jmethodID obtain;
jmethodID recycle;

jfieldID mDeviceId;
jfieldID mSource;
jfieldID mMetaState;
jfieldID mAction;
jfieldID mKeyCode;
jfieldID mScanCode;
jfieldID mRepeatCount;
jfieldID mFlags;
jfieldID mDownTime;
jfieldID mEventTime;
jfieldID mCharacters;
} gKeyEventClassInfo;

.......

int register_android_view_KeyEvent(JNIEnv* env) {
jclass clazz = FindClassOrDie(env, "android/view/KeyEvent");
gKeyEventClassInfo.clazz = MakeGlobalRefOrDie(env, clazz);

gKeyEventClassInfo.obtain = GetStaticMethodIDOrDie(env, gKeyEventClassInfo.clazz,
"obtain", "(JJIIIIIIIILjava/lang/String;)Landroid/view/KeyEvent;");
gKeyEventClassInfo.recycle = GetMethodIDOrDie(env, gKeyEventClassInfo.clazz,
"recycle", "()V");

gKeyEventClassInfo.mDeviceId = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mDeviceId", "I");
gKeyEventClassInfo.mSource = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mSource", "I");
gKeyEventClassInfo.mMetaState = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mMetaState",
"I");
gKeyEventClassInfo.mAction = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mAction", "I");
gKeyEventClassInfo.mKeyCode = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mKeyCode", "I");
gKeyEventClassInfo.mScanCode = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mScanCode", "I");
gKeyEventClassInfo.mRepeatCount = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mRepeatCount",
"I");
gKeyEventClassInfo.mFlags = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mFlags", "I");
gKeyEventClassInfo.mDownTime = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mDownTime", "J");
gKeyEventClassInfo.mEventTime = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mEventTime",
"J");
gKeyEventClassInfo.mCharacters = GetFieldIDOrDie(env, gKeyEventClassInfo.clazz, "mCharacters",
"Ljava/lang/String;");

return RegisterMethodsOrDie(env, "android/view/KeyEvent", g_methods, NELEM(g_methods));
}

and this is in android.view.KeyEvent

private static KeyEvent obtain() {
final KeyEvent ev;
synchronized (gRecyclerLock) {
ev = gRecyclerTop;
if (ev == null) {
return new KeyEvent();
}
gRecyclerTop = ev.mNext;
gRecyclerUsed -= 1;
}
ev.mNext = null;
ev.prepareForReuse();
return ev;
}

/**
* Obtains a (potentially recycled) key event.
*
* @hide
*/
public static KeyEvent obtain(long downTime, long eventTime, int action,
int code, int repeat, int metaState,
int deviceId, int scancode, int flags, int source, String characters) {
KeyEvent ev = obtain();
ev.mDownTime = downTime;
ev.mEventTime = eventTime;
ev.mAction = action;
ev.mKeyCode = code;
ev.mRepeatCount = repeat;
ev.mMetaState = metaState;
ev.mDeviceId = deviceId;
ev.mScanCode = scancode;
ev.mFlags = flags;
ev.mSource = source;
ev.mCharacters = characters;
return ev;
}

Edit:

Something like this would probably be a way to get it to boot... but I'd rather fix it than just make it non-fatal.

Edit: found out that the in the vendor android_runtime.so this function is referenced with:

(JJIIIIIIIIILjava/lang/String;)Landroid/view/KeyEvent;

However it is declared with:

(JJIIIIIIIILjava/lang/String;)Landroid/view/KeyEvent;

So it takes one integer more.

Edit:

The missing field argument is probably mHwFlags.