summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-17 19:38:38 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-17 19:38:38 +0000
commitb99511985d9d2e8632ef7be39ec0e23f5fd36491 (patch)
treebdfabd6b9e939f7646b7047e4ed193320edb5d15
parent054c435e2e7ec39d461f6a48544c4800acdfa7ac (diff)
parent7a9378a05f3f99a22978098e3d64379474d4ae8e (diff)
downloadnative-android11-platform-release.tar.gz
Change-Id: I35be7abef7e5408bff421f9ff6552317156e05dc
-rw-r--r--libs/sensor/SensorManager.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/libs/sensor/SensorManager.cpp b/libs/sensor/SensorManager.cpp
index f5dd36adae..22adc93667 100644
--- a/libs/sensor/SensorManager.cpp
+++ b/libs/sensor/SensorManager.cpp
@@ -172,11 +172,8 @@ status_t SensorManager::assertStateLocked() {
mSensors = mSensorServer->getSensorList(mOpPackageName);
size_t count = mSensors.size();
- if (count == 0) {
- ALOGE("Failed to get Sensor list");
- mSensorServer.clear();
- return UNKNOWN_ERROR;
- }
+ // If count is 0, mSensorList will be non-null. This is old
+ // existing behavior and callers expect this.
mSensorList =
static_cast<Sensor const**>(malloc(count * sizeof(Sensor*)));
LOG_ALWAYS_FATAL_IF(mSensorList == nullptr, "mSensorList NULL");