diff options
author | Chris Kuiper <ckuiper@google.com> | 2021-08-04 15:06:11 -0700 |
---|---|---|
committer | Chris Kuiper <ckuiper@google.com> | 2021-08-04 15:32:41 -0700 |
commit | c63880a5a946a23ceacb9a8b7bb9c7dcd38d93fa (patch) | |
tree | 9528f796d5e3d11bfaf7e108f1721ddde150b4b5 | |
parent | edec715c764be0e173056d9211fa079cdcb0cb98 (diff) | |
download | native-c63880a5a946a23ceacb9a8b7bb9c7dcd38d93fa.tar.gz |
sensorservice: Fix SensorDevice::isSensorActive().
SensorDevice::isSensorActive() currently returns
"numActiveClients() > 0", but it should return ".isActive".
An "active client" is really one that has some requested batching
parameters stored, which it can do even while the sensor is disabled
but, the isActive bool tracks whether the the sensor is currently
enabled at the HAL, which is what we really want.
Bug: b/194878856
Test: Together with ag/15459770:
1) Reproduced problem and verified mIsProxActive in "dumpsys
display" contains the correct value and no more 60/90Hz
flicker.
2) Adding local debugs, then mixing making phone calls with
additional "sensor_test sample -s8 -n5" commands to create
several Prox clients, and verifying logged flags and
reference counts.
Change-Id: Id4a13ebb5cde8de87ee7547d2989c3c0d1a69a09
-rw-r--r-- | services/sensorservice/SensorDevice.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp index 5d6f8c773c..c233bf06cf 100644 --- a/services/sensorservice/SensorDevice.cpp +++ b/services/sensorservice/SensorDevice.cpp @@ -915,7 +915,7 @@ bool SensorDevice::isSensorActive(int handle) const { if (activationIndex < 0) { return false; } - return mActivationCount.valueAt(activationIndex).numActiveClients() > 0; + return mActivationCount.valueAt(activationIndex).isActive; } void SensorDevice::onMicSensorAccessChanged(void* ident, int handle, nsecs_t samplingPeriodNs) { |