Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17688475 authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "[LayoutlibLoader] Print exception when FindClassOrDie, etc fail" into main

parents 465f3a4f 019f2629
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -362,6 +362,22 @@ static void init_keyboard(JNIEnv* env, const vector<string>& keyboardPaths) {

using namespace android;

// Called right before aborting by LOG_ALWAYS_FATAL. Print the pending exception.
void abort_handler(const char* abort_message) {
    ALOGE("Abort to abort the process...");

    JNIEnv* env = NULL;
    if (javaVM->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
        ALOGE("vm->GetEnv() failed");
        return;
    }
    if (env->ExceptionOccurred() != NULL) {
        ALOGE("Pending exception:");
        env->ExceptionDescribe();
    }
    ALOGE("Aborting because: %s", abort_message);
}

JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
    javaVM = vm;
    JNIEnv* env = nullptr;
@@ -369,6 +385,8 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
        return JNI_ERR;
    }

    __android_log_set_aborter(abort_handler);

    init_android_graphics();

    // Configuration is stored as java System properties.