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

Commit 872973c1 authored by Devin Moore's avatar Devin Moore
Browse files

SensorManager: Don't try to attach looper thread without JVM

The fuzzer isn't currently running inside a JVM so we don't have access
to JNIEnv when creating SensorManager.

Test: m
Bug: 295558387
Change-Id: Ie6d3b8f0c4871b4b84bb9eb02a1cd6240652de60
parent 4d322774
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -197,6 +197,11 @@ ndk::ScopedAStatus SensorManagerAidl::getSensorList(std::vector<SensorInfo>* _ai
sp<Looper> SensorManagerAidl::getLooper() {
    std::lock_guard<std::mutex> lock(mThreadMutex);

    if (!mJavaVm) {
        LOG(ERROR) << "No Java VM. This must be running in a test or fuzzer.";
        return mLooper;
    }

    if (!mPollThread.joinable()) {
        // if thread not initialized, start thread
        mStopThread = false;