From 94ae13178781a14867071636fded56c907a9db8b Mon Sep 17 00:00:00 2001 From: xiamengsen Date: Fri, 5 Feb 2021 15:35:34 +0800 Subject: Fix sensor activate after SensorEventConnection removed When app idle and register a sensor on existing connection,the method sensor.batch() retrun NO_ERROR but sensor.activate() return INVALID_OPERATION. The sensor will remove from the connecion but unable to remove from the batchParams,this make the sensor active after the app killed. As the client is disabled, keep the sensor in the connection for resume. Bug: 180825144 Test: Debug app in 180825144 Signed-off-by: xiamengsen Change-Id: Icc22862d1a083abba08fb2cbcabd043444b7090f --- services/sensorservice/SensorDevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp index e355594176..4d4cac568c 100644 --- a/services/sensorservice/SensorDevice.cpp +++ b/services/sensorservice/SensorDevice.cpp @@ -689,9 +689,9 @@ status_t SensorDevice::activateLocked(void* ident, int handle, int enabled) { ALOGD_IF(DEBUG_CONNECTIONS, "enable index=%zd", info.batchParams.indexOfKey(ident)); if (isClientDisabledLocked(ident)) { - ALOGE("SensorDevice::activate, isClientDisabledLocked(%p):true, handle:%d", + ALOGW("SensorDevice::activate, isClientDisabledLocked(%p):true, handle:%d", ident, handle); - return INVALID_OPERATION; + return NO_ERROR; } if (info.batchParams.indexOfKey(ident) >= 0) { -- cgit v1.2.3-59-g8ed1b