summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Devin Moore <devinmoore@google.com> 2023-09-07 15:58:36 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-09-07 15:58:36 +0000
commit66a0d71aff19e5ed4b9d820607b8a3fef1d9f384 (patch)
tree1feccbfcafc79edf396d76b302b7f552ea390b85
parent912f0b238b68eb5fec1d26ccc4c2699e5dd43d7c (diff)
parent872973c13bb9735a0f1b2584fe81382b70d127f0 (diff)
Merge "SensorManager: Don't try to attach looper thread without JVM" into main
-rw-r--r--services/sensorservice/aidl/SensorManager.cpp5
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;