History log of /frameworks/native/services/sensorservice/SensorDevice.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e65ab704f9cd445ea8fdbee4c93d84b581be470a 26-Feb-2018 Steven Moreland <smoreland@google.com> Merge "Don't use cutils/Atomic.h" am: 8f4529bbc2 am: 410582488d
am: afbe4eee71

Change-Id: I4df09b7dc90a191a222b7e9a1d5ff3be3dc9bb67
2716e111df2b7cd2490029f4c88bcc6543c93416 23-Feb-2018 Steven Moreland <smoreland@google.com> Don't use cutils/Atomic.h

Test: builds
Change-Id: Idb7a51db4382e1012afe12df3c9fe807922b17fe
/frameworks/native/services/sensorservice/SensorDevice.cpp
d2c0820d84585ad63c54d596b8de87a3fbc863bc 05-Oct-2017 Peng Xu <pengxu@google.com> Merge "Clean up connection to sensor hidl service" am: 7fbbfe2494 am: 05b09af109 am: 9f9cdcf24e
am: 1a95647089

Change-Id: I27d1ff8670e261a62b9c9b1f8e5916a6288ac347
1a95647089d7887a2c43b6070435c34148094b33 05-Oct-2017 Peng Xu <pengxu@google.com> Merge "Clean up connection to sensor hidl service" am: 7fbbfe2494 am: 05b09af109
am: 9f9cdcf24e

Change-Id: I3139d4162d02660a0d163d7a1e9ac3761d731296
1a00e2d5fb819c95ade644146020c83551208af1 28-Sep-2017 Peng Xu <pengxu@google.com> Clean up connection to sensor hidl service

getService() would block until hidl service up and running. Replace
retry delay with service registration listener to speed up.

Moreover, when getService() return nullptr, it means sensor hidl
service does not exist. Remove retry in this case and return failure.

Bug: 66916774
Test: test device boot
Test: adb shell "stop; start"
Test: kill sensor hidl process
Test: mod manifest file to remove sensor entry
Change-Id: I685971425e97e314699de4630d9adf400aba4af2
/frameworks/native/services/sensorservice/SensorDevice.cpp
4cd60011da95e2392dda1eef78aaa6037fb57e19 10-Aug-2017 Peng Xu <pengxu@google.com> Checking exisitence before calling editValueFor in SensorDevice

Bug: 26320541
Test: compiles, test a few sensor and they all works
Change-Id: If0859e7560419f3955f29ae108f9268d0a2bbaa9
Merged-In: If0859e7560419f3955f29ae108f9268d0a2bbaa9
/frameworks/native/services/sensorservice/SensorDevice.cpp
042baecf01205183376c55f734d7623d4ff96e21 10-Aug-2017 Peng Xu <pengxu@google.com> Checking exisitence before calling editValueFor in SensorDevice

Bug: 26320541
Test: compiles, test a few sensor and they all works
Change-Id: If0859e7560419f3955f29ae108f9268d0a2bbaa9
/frameworks/native/services/sensorservice/SensorDevice.cpp
98a3f89115d94d58c8c50e3874fb89b70644cd3b 25-Apr-2017 Ashutosh Joshi <ashutoshj@google.com> Merge "Clamp reported power for each sensor to 1 microAmp." into oc-dev
fea2d26f964f2e8065e462429766fd7dcf227275 20-Apr-2017 Ashutosh Joshi <ashutoshj@google.com> Clamp reported power for each sensor to 1 microAmp.

Avoids sensors reporting zero power !
Bug: 28980713
Test: Ensure thar power reported in greater than or equal to
1 microAmperes for all sensors.

Change-Id: I01b40c8a3701d56ded7dcc82e4c7a85b9a8ddc00
/frameworks/native/services/sensorservice/SensorDevice.cpp
2bec6230661e66ce37d8a074df32e07553e3cb8c 02-Jul-2016 Peng Xu <pengxu@google.com> Calculate batching param in a smarter way

Calculate batching parameter in a better way by lower-bound the
latency specification by sample period.

Bug: 28353456
Test: run sensor cts tests
Change-Id: I13a6a33d3d0dedb246ac602e634656f516dccfc3
/frameworks/native/services/sensorservice/SensorDevice.cpp
a8fad9bd6ca694bb0f86d617c72122d2220ec253 17-Mar-2017 Peng Xu <pengxu@google.com> Checks hidl service and remove hidl call at dump

Two things:
* check for hidl service availability before calling any hidl
functions.
* remove hidl dependency on dump to ensure dump will not cause
crash due to hidl failure.

Bug: 36073404
Test: check sensor running after reboot
Test: check dumpsys sensorservice works normally.
Change-Id: I8626635a143a9f07f263f85d95ab16749ea1e452
/frameworks/native/services/sensorservice/SensorDevice.cpp
96b12d8dedd6bffdc520920d731c5dff82e122df 16-Mar-2017 Ashutosh Joshi <ashutoshj@google.com> Add a retry mechanism to potentially allow recovery from HIDL failures.

Retry a few times to see if HIDL failures persist.
Add some logging to track failures.

Bug: 36088202
Test: Ensure sensors stream normally after change.
Change-Id: I194eaffd455ba782fff041f03ef89da384e3a901
/frameworks/native/services/sensorservice/SensorDevice.cpp
3889e6ea1c321cbaf8a959775da58509672143af 03-Mar-2017 Peng Xu <pengxu@google.com> Double check hidl service at init + meaningful abort when hidl crash

Sensor hidl service will kill itself when it detects
double-connection(*) from framework sensor service in order to avoid
potential deadlock. This cl adds a no-op call to hidl service at
initialization of framework service to allow early detection on hidl
service side. It also adds retry mechanism in this case to avoid
another system server crash.

Log messages is added when hidl call transport failure to help better
identify problem. There is no sane recovery at this point and fatal
log is preferred.

* Double-connection to hidl service happens when framework sensor
service crash but leave a lingering connection in sensor hidl service.
Auto restarted framework service will attempt to connect hidl service
again which result in a double connection.

Test: manually killing sensor hidl service and/or restart runtime,
with and without sensor service in restricted mode, observe
system recover to good state.

Pid of sensor hidl service can be found by lshal
lshal | grep sensor
switch to restrict mode
dumpsys sensorservice restrict a.non-exist.package

Bug: 35727090
Bug: 35843387
Bug: 35702298
Bug: 35919167
Bug: 35848670
Bug: 35903635
Change-Id: Ie5c24300503e125d9de031a70948e2bda1eb6dc6
/frameworks/native/services/sensorservice/SensorDevice.cpp
d15c030f7255ec9db8567a4ee77a56844982586d 20-Dec-2016 Steven Moreland <smoreland@google.com> sensorservice: Start using HIDL sensor HAL.

Framework now use the HIDL sensor HAL only. Loading the legacy
HAL library is removed.

Bug: 32978887
Test: sensors stream data in both passthrough and binderized mode.
Change-Id: I1d700a5a23cd9d209559570439f306aa22c613c1
/frameworks/native/services/sensorservice/SensorDevice.cpp
5cafc1e086db67911f937b68d35f0955e0a37caf 09-Feb-2017 Ashutosh Joshi <ashutoshj@google.com> Revert "sensorservice: Remove ENABLE_TREBLE flag."

This reverts commit d333511e94afbcc6462dd9c81405f4a3e30ecac9.

Change-Id: I6812643a7d0265f3a64a03a35e4d5a2359ba87cf
/frameworks/native/services/sensorservice/SensorDevice.cpp
d333511e94afbcc6462dd9c81405f4a3e30ecac9 20-Dec-2016 Steven Moreland <smoreland@google.com> sensorservice: Remove ENABLE_TREBLE flag.

Only hidl hals should be built/referenced by the framework,
and ENABLE_TREBLE will be deprecated soon.

Bug: 32978887
Test: compiles/wip
Change-Id: Ibb32129e1f30ae5baa15e116d3b13cc72bf27395
/frameworks/native/services/sensorservice/SensorDevice.cpp
5363254ba38b50da95e5bdb15391c139c182627c 24-Jan-2017 Peng Xu <pengxu@google.com> Add function to determine if SensorDevice support direct report

Added a function to SensorDevice to indicate if direct report is
supported. This avoided a crash condition in non-HIDL implementation.

Test: test with demo app on a HAL w/ and w/o direct report support
Change-Id: If68497bb8890b9e6003c2afeec38d16daf81f237
/frameworks/native/services/sensorservice/SensorDevice.cpp
e36e34731cbe77a49aa5e7d687dde041d83d0370 03-Nov-2016 Peng Xu <pengxu@google.com> Direct report mode support in sensor service and client

Added SensorDirectConnection to represent the direct channel.
The life-cycle is similar to that of SensorEventConnection.
Modified SensorDevice and SensorDeviceTreble to support new
HAL API. Added support in SensorManager, SensorService, binder
classes. Also added related helper functions in Sensor and dumpsys
support in SensorList.

Test: manual test with demo app
Bug: 30985702
Change-Id: I8750294b6aab717ed7f525299be642f1f0b85558
/frameworks/native/services/sensorservice/SensorDevice.cpp
f0c68852ffd061f8e41c437806fbfa7b74bc9f57 28-Sep-2016 Peng Xu <pengxu@google.com> [sensorservice] Fix inconsistent states in SensorDevice am: 4f707f8b3d
am: 86b20dcef4

Change-Id: I3112afafc8a912b459e6be5243396e7ca8c7ba93
4f707f8b3da68d3055db895da9ae5216cc4f483a 26-Sep-2016 Peng Xu <pengxu@google.com> [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
/frameworks/native/services/sensorservice/SensorDevice.cpp
966fa88493d782f2ae63f1e4bae2182659ebfe6e 02-Sep-2016 Peng Xu <pengxu@google.com> [sensorservice] Add log to rare CTS failure cause

Add log for catching a hard to reproduce CTS failure.

Bug: 28533594
Change-Id: I50d05985c66f95b889e57f831a2858a6f438757e
/frameworks/native/services/sensorservice/SensorDevice.cpp
fcaedb126d4bfdea4fd969946700fa86779ad8b3 28-Apr-2016 Peng Xu <pengxu@google.com> Merge "Fix sensor uuid, retrofit recent event logger" into nyc-dev am: cf43c26 am: 19a621e
am: cd4deb2

* commit 'cd4deb218b4e328a029e487feaf8eadb52b07161':
Fix sensor uuid, retrofit recent event logger

Change-Id: Id32902e5876cda569f26c1543040c00ab8723d58
6a2d3a06caa337857cf60cfc70a9a78909ad3608 21-Dec-2015 Peng Xu <pengxu@google.com> Fix sensor uuid, retrofit recent event logger

Fix an issue that causes uuid field not being initialzed in
sensorservice.

MostRecentEventLogger in sensorservice is migrated to use RingBuffer
instead of a custom circular buffer. This is expected to improve
readability and maintainability of code.

Dumpsys print format is retouched to offer more information in easier
to read format.

Bug: 28305085

Change-Id: I190e43350b60a22a9fccb92a95d6eab06a471560
/frameworks/native/services/sensorservice/SensorDevice.cpp
ad6cd42e9c7aaf75fd5e4f2f6991b89a925a566c 04-Feb-2016 Ashutosh Joshi <ashutoshj@google.com> Stop supporting old Sensor HAL versions.

Dropping support for Sensor HAL version 1.0.
HAL versions 1.1 and 1.2 were deprecated already.
HAL versions 1.3 and above are now required.

Change-Id: I387ca47d419631b5e882c05464a6e90fb6ec731b
/frameworks/native/services/sensorservice/SensorDevice.cpp
2576cb63b3fe1592f54816625036566b9eb0793a 20-Jan-2016 Peng Xu <pengxu@google.com> Dynamic Sensor Discovery implementation

Defined the dynamic sensor meta data type and UUID of sensor.

Implementation in sensorservice and the native SensorManager to
support Dynamic sensor discovery.

Change-Id: I9df2f2ae51d46cd946a9757393f7a60b52cc4fb8
/frameworks/native/services/sensorservice/SensorDevice.cpp
d4036b6b7f9609fe09efabdbfbb8c8f9428f76f7 28-Jul-2015 Andreas Gampe <agampe@google.com> SensorService: Fix some warnings

For build-system CFLAGS clean-up, remove unused variables.

Also fix some warnings related to format strings, and signed
comparisons.

Bug: 18632512
Change-Id: I5e48dce36678c12069c0e162b920870de81b89f2
/frameworks/native/services/sensorservice/SensorDevice.cpp
18d6d51a00897988e3347b130f533e9ffdd8c365 18-Jun-2015 Aravind Akella <aakella@google.com> More information in sensor bugreports.

i) Log last 20 activations/deactivations of sensors.
ii) Increase logging upto 50 events for accelerometer, step_counter and significant motion.

Change-Id: I3966ed0abda8b705f3d16e94a9370fa1b97baa57
/frameworks/native/services/sensorservice/SensorDevice.cpp
af8ed3f06cf5a0fd37357b438da803f53f33fa56 12-May-2015 Aravind Akella <aakella@google.com> Merge "Improve logging in SensorService dump output." into mnc-dev
444f2675728dde36378beb8e67a94f86ebf1ca46 07-May-2015 Aravind Akella <aakella@google.com> Improve logging in SensorService dump output.

Maintain a per sensor circular buffer of last 10 sensor_events and the wall clock time
at which each event is received.

Change-Id: Ia50c825ab5a7aaf0932ce7dce7ac8b9be7071e77
/frameworks/native/services/sensorservice/SensorDevice.cpp
b412f6e203b38f8047f760261a5e3dc6d0722f08 30-Apr-2015 Svetoslav <svetoslavganov@google.com> Add body sensors app op - framework native

Change-Id: I727a2bb1e28ae9158f2df9c74dd0aee977dfd47f
/frameworks/native/services/sensorservice/SensorDevice.cpp
a9e6cc387072e25706a6d847a97b02a6f25a918b 17-Apr-2015 Aravind Akella <aakella@google.com> Enable data injection mode in SensorService.

Change-Id: I0cd32a017235c31c54816e4a357ce3b988350ed6
/frameworks/native/services/sensorservice/SensorDevice.cpp
4949c50372de4c7fdb57de1dc0c1f5bb3ac463eb 12-Feb-2015 Aravind Akella <aakella@google.com> Support restricted mode in SensorService.

In restricted mode, only CTS tests can register for sensors or call flush() on them. The requests
from other applications will be ignored.

Change-Id: Ieb923df3e0cfe3390fe2d052af776da79589744b
/frameworks/native/services/sensorservice/SensorDevice.cpp
6c2664ae34fd582bc174d3c83e2b18e895ca2496 13-Aug-2014 Aravind Akella <aakella@google.com> SensorService fixes.

1) Flush should only be received by the app calling flush(). Maintain
a queue of all flush() calls and send flush_complete events in that
order.
2) Log warnings for older HALs. Remove batch() calls with DRY_RUN flag.
3) Reallocate event cache when more sensors register and the desired
maxCacheSize increases. Clear NEEDS_ACK flag in the buffer whenever
there is a write() failure.
4) More dump information. Add wake-up flag, maxDelay and timestamps for
sensor events.

Bug: 16874778
Change-Id: I195646191059fd31f75f2f07886c0f98bf9b509a
/frameworks/native/services/sensorservice/SensorDevice.cpp
c46422ed2bf2e452d878a45735f4d37917008843 12-Jun-2014 Mark Salyzyn <salyzyn@google.com> am 20914f0a: am a4e345e1: Merge "sensorservice: 64-bit compile issues"

* commit '20914f0ad3691d977f61f1d4b92b49535e8f6f33':
sensorservice: 64-bit compile issues
db45861ff4b636b9dd833d622dd64e2ad24b0645 10-Jun-2014 Mark Salyzyn <salyzyn@google.com> sensorservice: 64-bit compile issues

Change-Id: Ied7b779f39e71d041791729f7355b052b63903c5
/frameworks/native/services/sensorservice/SensorDevice.cpp
9a844cf78f09953145200b4074d47589257a408c 12-Feb-2014 Aravind Akella <aakella@google.com> Enable wakeup sensors.

SensorService should hold a wakelock till the app reads events from a wakeup sensor. Currently drivers hold a wakelock with a
timeout while delivering events from a wake up sensor like Significant Motion. This hack can be removed now.

Bug: 9774884
Change-Id: If3b5acb99c9cf0cd29012fcfa9d6b04c74133d01
/frameworks/native/services/sensorservice/SensorDevice.cpp
92dc3fc52cf097bd105460cf377779bdcf146d62 12-Mar-2014 Mark Salyzyn <salyzyn@google.com> native frameworks: 64-bit compile issues

- Fix format (print/scanf)
- Suppress unused argument warning messages (bonus)

Change-Id: I05c7724d2aba6da1e82a86000e11f3a8fef4e728
/frameworks/native/services/sensorservice/SensorDevice.cpp
724d91d778e71c8186399f4955de14b54812b3ed 27-Jun-2013 Aravind Akella <aakella@google.com> Sensor batching. Changes to the native code.

Bug: 10109508
Change-Id: I7333f3aac76125a8226a4c99c901fb904588df04
/frameworks/native/services/sensorservice/SensorDevice.cpp
cdd7d8bc145bbbd21a1689ed87a381287aeec229 12-Jul-2013 Mathias Agopian <mathias@google.com> resolved conflicts for merge of 00aea5c5 to master

Change-Id: Ie1769be863ee2d411eae451907a928db57882e14
ac9a96da65f6eae4513654adaad8a457d1c1575c 12-Jul-2013 Mathias Agopian <mathias@google.com> fix a dead-lock in sensorservice

sensorservice would deadlock if for some reason
a sensor failed to enable.

simplifed the code a bit, and made it behave a little
closer to mr1.1 -- I couldn't convince myself that
some changes in how locks were used were correct.

Bug: 9794362
Change-Id: I6110f5dbb67e543f1c71d127de2299232badb36a
/frameworks/native/services/sensorservice/SensorDevice.cpp
ba02cd2f6cc3f59adf66cb2b9176bfe6c9e382d1 04-Jul-2013 Mathias Agopian <mathias@google.com> improve sensorservice's dumpsys

it now displays the reported trigger mode properly, as well as
the number and type of the last received data

Change-Id: I2ff64b32ab71f1332bc2e09671c8c02bb9550490
/frameworks/native/services/sensorservice/SensorDevice.cpp
4c01b1ad80e084f0cd1057f89fdd1fcedf19dd96 17-Apr-2013 Jaikumar Ganesh <jaikumar@google.com> Fix activation issue with auto disabled sensors.

Auto disabled sensors get auto disabled after trigger.
An activation after this wasn't working because the
state was not being reset.

b/8609561

Change-Id: If72c9f27345e91671d7ad0a7a066f6dc3d255b78
/frameworks/native/services/sensorservice/SensorDevice.cpp
4342fdf14ffb792a36c1de25ad14b745df628da2 09-Apr-2013 Jaikumar Ganesh <jaikumar@google.com> Sensor changes.

1. Some sensors can wake up the AP. Add wakelocks.
2. Handle backward compatibility for rotation vector
heading accuracy.
3. Cleanup auto disabled sensors.
4. Fix race condition between enable and dispatch.

Change-Id: I39dddf12e208d83cd288201986ee994312555820
/frameworks/native/services/sensorservice/SensorDevice.cpp
787ac1b388f144f5e6dd38f8b807866a5256dafc 19-Sep-2012 Mathias Agopian <mathias@google.com> improve sensor battery usage tracking

until now we were tracking when a sensors was
physically enabled or disabled and we were reporting
that to the BattaryService.

this wasn incorrect because we could have several different
apps enabling the same sensor, so the accounting by the
battery service would be incorrect in that case (depending
on the order in which these apps disabled said sensor).

BatteryService tracks sensors per uid, however SensorService
does this per binder connection, so we could have several
binder connections for the same uid, to solve this we keep
a list of sensor/uid -> count, which is the bulk of this
change.

Bug: 6661604
Change-Id: I561c198c42ba1736a8671bdacda4c76d72b9dd6f
/frameworks/native/services/sensorservice/SensorDevice.cpp
f5a1230d322c14c42331d0a1536b50c87742973b 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
/frameworks/native/services/sensorservice/SensorDevice.cpp
a551237de142549fb8a6608ee9d2fbf4b7ca2ebf 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
/frameworks/native/services/sensorservice/SensorDevice.cpp
1a62301fc58cd2af18239b0415813461bf5fc41b 10-Nov-2011 Mathias Agopian <mathias@google.com> handle EINTR when calling sensor HAL's poll function

some sensor HALs don't handle EINTR, make sure to catch it in the
sensorservice.

also if we ever encounter an error that we can't handle, we abort
which will restart us (or the whole system process if we're running
in it)

Bug: 5511741
Change-Id: I7051882b06980f778736b53d6cd021a99b5ca8d2
/frameworks/native/services/sensorservice/SensorDevice.cpp
667102f6b072582fe497599e0b760f9fc94ceffa 15-Sep-2011 Mathias Agopian <mathias@google.com> improve sensorservice dumpsys

Change-Id: I8b53d5cab884c3aca16d95df5fbf288368d52e8b
/frameworks/native/services/sensorservice/SensorDevice.cpp
984826cc158193e61e3a00359ef4f6699c7d748a 18-May-2011 Mathias Agopian <mathias@google.com> 9-axis sensor fusion with Kalman filter

Add support for 9-axis gravity and linear-acceleration sensors
virtual orientation sensor using 9-axis fusion

Change-Id: I6717539373fce781c10e97b6fa59f68a831a592f
/frameworks/native/services/sensorservice/SensorDevice.cpp
a1b7db95b6ccf5be9d8dfaac1b8f45494813edc0 28-May-2011 Mathias Agopian <mathias@google.com> Fix a few issues with sensors reference-counting
/frameworks/native/services/sensorservice/SensorDevice.cpp
50b66767f6c5635430483393e17d15969dfe2f05 30-Nov-2010 Mathias Agopian <mathias@google.com> fix [3237242] sensormanager sensor active count gets out of sync

whether a physical sensor needed to be active or not was managed by
a simpe reference counter; unfortunatelly nothing prevented it to
get out of sync if a sensor was disabled more than once.

sensorservice already maintainted a list of all the "clients"
connected to a physical sensor; we now use that list to determine if
a sensor should be enabled. This can never be "out-of-sync" since
this is the only data structure linking a sensor to a user of that
sensor.

also removed the isEnabled() method, which was never used and
implemented wrongly (since it didn't take into account that a sensor
could be disabled for a client but not of another).

Change-Id: I789affb877728ca957e99f7ba749def37c4db1c7
/frameworks/native/services/sensorservice/SensorDevice.cpp
f001c92436b4a66eb7687286325ced7f10c9f917 12-Nov-2010 Mathias Agopian <mathias@google.com> Add support for virtual sensors.

Rework sensorservice to allow "virtual sensors", that is
sensors that report a synthetized value based on real sensors.

the main change to sensorservice is around managing which real
sensor need to be activated and which rate to use.

The logic for all this has been moved into SensorDevice, which
essentially wraps the sensor HAL but adds two features to it:
- it keeps track of which sensors need to be activated
- it keeps track of what rate needs to be used

For this purpose an "identity" is associated with each real sensor
activation, so we can track them.

On start-up we check for gravity, linear-acceleration and
rotation-vector sensors, if they're not present in the HAL, we
synthetize them in sensor-service.

Change-Id: I841db2c1b37ef127ed571efa21732ecc5adf1800
/frameworks/native/services/sensorservice/SensorDevice.cpp