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

Commit ca06d8b5 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

EventLog: Check for exception after add()

When reading events, calling Collection.add() may result in an
OutOfMemoryError or immutability error. Check for an exception
after the call in EventLog and SecurityLog.

Bug: 67511924
Test: m
Test: Device boots
Change-Id: If0fbf6b01051b5311eeb88d3f52470cd8b1eec59
parent ed8d2363
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -186,6 +186,9 @@ static void readEvents(JNIEnv* env, int loggerMode, jlong startTime, jobject out
        env->CallBooleanMethod(out, gCollectionAddID, event);
        env->DeleteLocalRef(event);
        env->DeleteLocalRef(array);
        if (env->ExceptionCheck() == JNI_TRUE) {
            break;
        }
    }

    android_logger_list_close(logger_list);
+3 −0
Original line number Diff line number Diff line
@@ -215,6 +215,9 @@ static void readEvents(JNIEnv* env, int loggerMode, jintArray tags, jlong startT
            env->CallBooleanMethod(out, gCollectionAddID, event);
            env->DeleteLocalRef(event);
            env->DeleteLocalRef(array);
            if (env->ExceptionCheck() == JNI_TRUE) {
                break;
            }
        }
    }