diff options
| -rw-r--r-- | services/sensorservice/aidl/SensorManager.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/services/sensorservice/aidl/SensorManager.cpp b/services/sensorservice/aidl/SensorManager.cpp index 9b0334443b..ee4c5f819c 100644 --- a/services/sensorservice/aidl/SensorManager.cpp +++ b/services/sensorservice/aidl/SensorManager.cpp @@ -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; |