[sensorservice] Fix inconsistent states in SensorDevice
This CL avoids inconsistent disabled client list when sensorservice
is in restricted mode and a restricted sensor event connection is
destroyed.
The inconsistency can cause registerLister error in sensor CTS.
Also removed the additional logging message since they are no longer
necessary.
Bug: 28533594
Test: Running "cts-tradefed run singleCommand cts-dev --module
CtsHardwareTestCases --test android.hardware.cts.SensorBatchingTests"
continuously while keep registering and unregistering sensor listener
in a separate app (e.g. enable BreakIt mode in SensorLogger).
Change-Id: I601aea87c88511f5543a80c4921ee4822cb89dff
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 2930637..99da2c4 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -995,6 +995,9 @@
if (c->needsWakeLock()) {
checkWakeLockStateLocked();
}
+
+ SensorDevice& dev(SensorDevice::getInstance());
+ dev.notifyConnectionDestroyed(c);
}
sp<SensorInterface> SensorService::getSensorInterfaceFromHandle(int handle) const {