• Home
  • History
  • Annotate
  • only in /frameworks/native/services/sensorservice/
History log of /frameworks/native/services/sensorservice/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
80d87ee386be7065817d4d40f2151dec9e0c557c 14-Jun-2017 Yifan Hong <elsk@google.com> Fix race condition for SensorManager looper.

Before the fix there could be two background threads started for two
loopers. Add a guard to prevent this from happening.

Test: pass
Bug: 62404135
Change-Id: I8230addaaa6b83670d7b83c96809b00fca95d352
idl/SensorManager.cpp
09034f076e7897732479c8aef6284938aafbfbfe 14-Jun-2017 Yifan Hong <elsk@google.com> SensorManager: attach background thread to JavaVM

Test: pass
Bug: 62404135

Change-Id: I63a128c3c933904211f5ff2483492674eaba93ed
idl/SensorManager.cpp
idl/include/sensorservicehidl/SensorManager.h
542eace6bf9aa9cc4a2fff4886ff023b973232e2 10-May-2017 Yifan Hong <elsk@google.com> Framework sensor manager init not depends on ::android::SensorManager.

Test: photo sphere
Change-Id: Ice37a758421827757226a9898bcf3e00857443ff
Merged-In: Ice37a758421827757226a9898bcf3e00857443ff
Fixes: 36448245
idl/SensorManager.cpp
idl/include/sensorservicehidl/SensorManager.h
2d2b46841bf2e22e58d80d3ec547e86b2f1e250b 17-May-2017 Peng Xu <pengxu@google.com> No more ashmem equivalent checker false alarm

The checker for ashmem file descriptor equivalency is
too strict and false alarms. This CL fix the issue.

Bug: 38352409
Test: successfully register multiple ashmem sensor direct channels
without "Duplicate create channel request for the
same share memory"

Change-Id: Ib80b47944940ce708953632855174d2f90c41b49
ensorDirectConnection.cpp
663720b29f412756b8599897df9f8e32eb930be2 08-May-2017 Jim Kaye <jameskaye@google.com> Fix enforcement of sensor's slowest rate

This code calculates a sensor's maximum sample
period in nanoseconds. This is stored as a 64-bit
value, as required for periods greater than ~2.1
seconds.

The calculation was done with 32-bit arithmetic,
sometimes resulting in overflow. This caused the
sensor to run at its maximum rate.

(The requested period is first clipped to the maximum
period. When the maximum period appears negative, it
is always used. The now-negative period is then clipped
to the minimum period, resulting in the sensor's maximum
supported rate.)

Bug: 37465457

Test: Verified correct operation with Goldfish accelerometer,
which has a 60-second maximum period.

Change-Id: Ic75a9dc7c4e7c9ca690eafbfa51ee50540ca5aaf
ensorService.cpp
380b8ba38aacc53cbe29219fd7c41a5b0e22081f 02-May-2017 Peng Xu <pengxu@google.com> Correct sensor handle for operation parameter

Sensor handle 0 is a valid sensor handle. Use SENSORS_HANDLE_BASE - 1
instead in inject_sensor_data for operation parameter.

Test: sensor cts passes
Bug: 37956047
Change-Id: I138c2e21d74f532526a53a76be857866764a3d53
ensorService.cpp
35c1e6960b3ff8d9634e2290e14f2e3adabb93fa 26-Apr-2017 Peng Xu <pengxu@google.com> Merge "Sensor: Limit delay to maximum possible value before sending to HAL" into oc-dev
98a3f89115d94d58c8c50e3874fb89b70644cd3b 25-Apr-2017 Ashutosh Joshi <ashutoshj@google.com> Merge "Clamp reported power for each sensor to 1 microAmp." into oc-dev
d8a5ce39101f569f6bdab696ed02623e5aff7451 01-Jun-2016 Aniroop Mathur <a.mathur@samsung.com> Sensor: Limit delay to maximum possible value before sending to HAL

Currently, all hals/drivers of different manufacturers/vendors have to add check
to modify delay value to maximum possible value if application requests for
delay greater than maximum possible value. Instead of putting this common check
in all different types of drivers/hals, it is best to put it in framework layer only.

For example:
If a sensor has maximum delay capability of 200 ms and application requests for
delay of 1 second then sensor should run at 200 ms and not 1 second. This is
checked by cts application too like in testAccelerometer_1Hz test case.

Test: compile
Bug: 37543280
Change-Id: Ib921056659ea442ed854b69321d8b2ba0e319302
Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
ensorService.cpp
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
ensorDevice.cpp
e382c1883157cd622354f839ab9ac95fc580fc06 20-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix reference loop in IEventQueue implementation." into oc-dev
20c35e424ebc8647f807024f12bb7ebfd54136fc 20-Apr-2017 Peng Xu <pengxu@google.com> Merge "Calculate batching param in a smarter way" into oc-dev
06d46fda66f7e6cc144a195ac6dc065bca2e3616 20-Apr-2017 Yifan Hong <elsk@google.com> Fix reference loop in IEventQueue implementation.

EventQueue's destructor is never called because
EventQueueLooperCallback has a strong reference to it,
and EventQueueLooperCallback is never destroyed because
the file descriptor is never removed from the looper.

Bug: 37280081
Test: camera works
Test: event queue is destroyed when client removes
its reference (from logcat)

Change-Id: I12347b6d1cca354288382555d2d9a20acfa59233
idl/EventQueue.cpp
idl/EventQueue.h
1742ede041fa9f72f4b2072f1000c72c5d65e81b 14-Apr-2017 Peng Xu <pengxu@google.com> Merge "Fix gralloc direct channel bug and polish log messages" into oc-dev
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
ensorDevice.cpp
ensorDevice.h
d111a91cd1df9be4680f4c4f9a47b41ab9dff1ee 13-Apr-2017 Yifan Hong <elsk@google.com> Merge "Add PERMISSION_DENIED to convertResult." into oc-dev
c7cbda64bea65f1675b7c681f07b438fdf88e6b5 10-Apr-2017 Yifan Hong <elsk@google.com> IDirectReport.configure returns token

Test: pass
Test: VtsHalSensorManagerV1_0TargetTest

Bug: 37244013

Change-Id: I104a33420089c13cc85973b470f8179292d8094d
idl/DirectReportChannel.cpp
idl/DirectReportChannel.h
6d62c84b1cd7774321c00606fb786f91371cc1d1 11-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "android.frameworks.sensorservice@1.0: Looper thread SCHED_FIFO" into oc-dev
71906aac8532b80b43a04582eb3ad1e92acdaa7a 10-Apr-2017 Yifan Hong <elsk@google.com> android.frameworks.sensorservice@1.0: Looper thread SCHED_FIFO

Looper thread uses SCHED_FIFO with a priority 10.

Test: sensor works (sanity checks with camera app), logcat
doesn't show SCHED_FIFO could not be used

b/34386025 [Treble] Identify and fix Binder usage by camera HALs that isn't NDK-based
b/35219747 [Treble] Figure out the new interface between camera and sensor
b/36651814 [QCOM Treble] [REDACTED] Camera HAL uses Binder
b/36651420 [QCOM Treble] [REDACTED] location daemon uses Binder

Change-Id: I0f236a77cccdc8d67a933daf7d5046947c82a3cf
idl/SensorManager.cpp
957aa852bb9bd7a70cc4f7f553d4945f3f8da23c 07-Apr-2017 Andreas Huber <andih@google.com> Prevent runtime restart for crashed clients to framework sensorservice.

This only happens when the client dies, in which case the event queue
reference will be dropped on the client side, so the call to handleEvent
won't even be fired, except for a race condition.

The race condition is, if handleEvent is already fired,
then client dies and the event queue is going to be destroyed and the
fd is going to be removed, but before that the call onEvent fails.

Test: clients of SensorManager that uses event queue no longer
crashes.
Bug: 35219747

Change-Id: Ibdf062528a219fae65ee6263ed742229ec3cd0d6
idl/EventQueue.cpp
ecf108002757b0207d3bff47a73fcac1df58c8ec 10-Apr-2017 Yifan Hong <elsk@google.com> Add PERMISSION_DENIED to convertResult.

Test: pass
Change-Id: Idb0316a21ec22fca07168a25e15acc18652ff0ff
idl/utils.cpp
f88e2b95b2cd6238f6758ef6a180fbd277f06ff2 11-Apr-2017 Peng Xu <pengxu@google.com> Fix gralloc direct channel bug and polish log messages

1) Remove obsoleted stub code so that second gralloc direct channel
can be successfully registered.

2) Remove obsoleted misleading log messages.
3) Add missing log messages at failure to help debugging.

Bug: 36900495
Test: SensorDirectReportTest
Change-Id: I1d6941c4179338f6db8f84079844dce515b80516
ensorDirectConnection.cpp
ensorService.cpp
dd5c5cb3b8f3df9b458dff74e247b9a542befee7 17-Mar-2017 Peng Xu <pengxu@google.com> Set sensor operation parameter implementation

Set operation parameter to sensor HAL. Possible paramters include
local geomagnetic field, local gravity acceleration, device dock
state, whether device should run in high performance mode, and
if a magnetic field calibration guide is in progress.

Bug: 30958130
Test: Tested with marlin. Modified hal implementation can get local
geomagnetic field.

Change-Id: Idaedd9e616d01383ba244cc64cf3e319ce02191f
ensorService.cpp
ensorService.h
a07b3eec338a4c528892315da61b39fa5271cb8f 04-Apr-2017 Yifan Hong <elsk@google.com> android.frameworks.sensorservice@1.0: make classes final

Make SensorManager and DirectReportChannel final.

Test: pass
Change-Id: Idc7f7fcacf1ad1ad6282a603538529ff99f88184
idl/DirectReportChannel.h
idl/include/sensorservicehidl/SensorManager.h
8a420ed627c1db832ef33663e8abaedb214368f7 03-Apr-2017 Yifan Hong <elsk@google.com> android.frameworks.sensorservice@1.0: ashmem direct channel check sizes.

Test: VtsHalSensorManagerV1_0TargetTest
Change-Id: I18b87128da2607f82ffddb260bf440786c378010
idl/SensorManager.cpp
05fc8afc081722606aa815f5a6cb8f8f640d3e28 03-Apr-2017 Yifan Hong <elsk@google.com> android.frameworks.sensorservice@1.0: fix configureDirectChannel return positive integer.

SensorManager::configureDirectChannel can return a positive integer
as the token to indicate success. android.frameworks.sensorservice@1.0
doesn't care about the token.

Test: VtsHalSensorManagerV1_0TargetTest
Change-Id: I6bcbbe5dc747a0d93d2a0fd37f0b7187cb681101
idl/DirectReportChannel.cpp
95c7a0636763c0861d46425709befe90a3919c04 29-Mar-2017 Yifan Hong <elsk@google.com> Implement android.frameworks.sensorservice@1.0::IEventQueue.

Test: pass
Bug: 35219747
Change-Id: I52ddd64db500c23db22768fc0603bce0cc14f8c6
idl/Android.bp
idl/EventQueue.cpp
idl/EventQueue.h
idl/SensorManager.cpp
idl/include/sensorservicehidl/SensorManager.h
idl/utils.cpp
idl/utils.h
57d427735f025eb8835d3c55124f6a2215af2166 29-Mar-2017 Yifan Hong <elsk@google.com> Renamed HIDL SensorManager::mManager -> mInternalManager.

Use "Internal" to represent objects of the wrapped type.

Test: pass
Change-Id: I4f86bc2c7c272c9abb0c5b4c2837baccfdc2a748
idl/SensorManager.cpp
idl/include/sensorservicehidl/SensorManager.h
e90eac6a5884ee7212ae03b753113e438cf01e41 28-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add stub for SensorManager::createEventQueue"
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
ensorDevice.cpp
ensorDevice.h
8358c6b5d4f30292f25ffbed16ddd23cec333a61 24-Mar-2017 Yifan Hong <elsk@google.com> Add stub for SensorManager::createEventQueue

It is not yet implemented.

Test: pass
Bug: 35219747
Change-Id: I8ef1627376ac88f552c20a2809416115ba342b82
idl/SensorManager.cpp
idl/include/sensorservicehidl/SensorManager.h
408bd9f1a7c8612151f836e09d5375223c50a739 17-Mar-2017 Yifan Hong <elsk@google.com> Merge "Add implementation for android.frameworks.sensorservice@1.0"
c34f57fed0ad09c6d7361a39580da20b466d46d1 10-Mar-2017 Yifan Hong <elsk@google.com> Add implementation for android.frameworks.sensorservice@1.0

Test: marlin boots
Test: lshal -ipm | grep android.frameworks.sensorservice@1.0
Bug: 35219747
Change-Id: Idc2823c674ef452102766a1331c962d3f3f66c53
ndroid.bp
idl/Android.bp
idl/DirectReportChannel.cpp
idl/DirectReportChannel.h
idl/SensorManager.cpp
idl/include/sensorservicehidl/SensorManager.h
idl/utils.cpp
idl/utils.h
3680cbc7e3dccaf4b46a4a4a55c937e6c0139ed1 16-Mar-2017 Ashutosh Joshi <ashutoshj@google.com> Merge "Add a retry mechanism to potentially allow recovery from HIDL failures."
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
ensorDevice.cpp
ensorDevice.h
51224681c9a80ff714d40c26d8f465fb1bae17e2 11-Mar-2017 Peng Xu <pengxu@google.com> Add uid and pid information into recent sensor registeration log

Some legacy native client do not specify a package name. Making
tracking of sensor request difficult. This cl adds uid and pid
into the dumpsys print to help alleviate this issue.

Test: adb shell dumpsys sensorservice
Change-Id: I26c778a50927cc6c4f14284c3c6a09d38b2e4dd5
ensorRegistrationInfo.h
ensorService.cpp
ensorService.h
d9c8a864e193d7ae3d0a04c1aa7ff15da955fb0f 05-Mar-2017 Peng Xu <pengxu@google.com> Sensor direct report with HardwareBuffer channel

Implement creation of sensor direct channel in sensor
service for sensor direct report feature.

Bug: 30985702
Test: cts-tradefed run cts --module CtsSensorTestCases
--test android.hardware.cts.SensorDirectReportTest
Test: cts-tradefed run cts --module CtsSensorTestCases
--test android.hardware.cts.SensorNativeTest

Change-Id: I52350811df538986cea7f5e1fb336fad53234c86
ensorList.cpp
56a8f942731ad34a8e85a9a0fb84f1be2ead5541 07-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "split libsensor our of libgui "
801ea093b0e923a61b832f2adba698a273479880 07-Mar-2017 Mathias Agopian <mathias@google.com> split libsensor our of libgui

Test: compile & run
Bug: treble cleanup
Change-Id: I5b2c2a14f7d3b364d25695cf0901c5b08cfb0fc9
ndroid.mk
orrectedGyroSensor.h
ravitySensor.h
inearAccelerationSensor.h
rientationSensor.h
otationVectorSensor.h
ensorDevice.h
ensorDirectConnection.h
ensorEventConnection.cpp
ensorEventConnection.h
ensorFusion.h
ensorInterface.h
ensorList.h
ensorService.cpp
ensorService.h
ests/Android.mk
ests/sensorservicetest.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
ensorDevice.cpp
ensorDevice.h
0f10dd60609fd490a6ed5651e5e3cc7bb8981eb6 15-Feb-2017 Ashutosh Joshi <ashutoshj@google.com> Merge "sensorservice: Start using HIDL sensor HAL."
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
ndroid.mk
ensorDevice.cpp
ensorDevice.h
ensorDeviceTreble.cpp
4b62d90346b53bf9d2eee038799ec75300283ba6 14-Feb-2017 Nick Vaccaro <nvaccaro@google.com> Merge "Sensors: Add LOW_LATENCY_OFFBODY_DETECT sensor API"
f188cb578533215453322ced46b833497d3b43a7 09-Feb-2017 Ashutosh Joshi <ashutoshj@google.com> Merge "Revert "sensorservice: Remove ENABLE_TREBLE flag.""
5cafc1e086db67911f937b68d35f0955e0a37caf 09-Feb-2017 Ashutosh Joshi <ashutoshj@google.com> Revert "sensorservice: Remove ENABLE_TREBLE flag."

This reverts commit d333511e94afbcc6462dd9c81405f4a3e30ecac9.

Change-Id: I6812643a7d0265f3a64a03a35e4d5a2359ba87cf
ndroid.mk
ensorDevice.cpp
ensorDevice.h
ensorDeviceTreble.cpp
f149b40b3385ee09b45aaf5581c31dcf66f4cb23 09-Feb-2017 Peng Xu <pengxu@google.com> Fix bug in isEquivalent()

Fix a bug in SensorService::SensorDirectConnection::isEquivalent()
that causes the check to unfairly judge two shared memory buffers.

Test: compiles
Change-Id: I8274b01f331dc958c8b0183aab32119f21a8c4ff
ensorDirectConnection.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
ndroid.mk
ensorDevice.cpp
ensorDevice.h
ensorDeviceTreble.cpp
4998c16c927003f5bd98427db5f58853b170aa8a 01-Nov-2016 Grigory Dzhavadyan <grigoryj@google.com> Fix min delay for virtual geomag vector sensor

bug: 31808374

N-CTS requires this to be <= 10 ms

Change-Id: I0959fa2cb9ae40bc832726fedccc77366aba1520
(cherry picked from commit f1a9141f72fc73af0485d12f5e4b5b176dbe9f34)
ensorFusion.cpp
563322e64138a3107f20231f57202d7680b515c2 25-Jan-2017 Peng Xu <pengxu@google.com> Merge "Add function to determine if SensorDevice support direct report"
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
ensorDevice.cpp
ensorDevice.h
ensorDeviceTreble.cpp
ee3c7bc5ee21f8489b833e6d979b46d6a56a9b95 21-Jan-2017 Chris Phoenix <cphoenix@google.com> sensors HAL uses "default" service name

The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.

Test: builds; verify HAL still works

Bug: 33844934
Change-Id: I83295febf0fd9e63cbbbc0b3c57962ec5961cee5
ensorDeviceTreble.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
ndroid.mk
ensorDevice.cpp
ensorDevice.h
ensorDeviceTreble.cpp
ensorDirectConnection.cpp
ensorDirectConnection.h
ensorEventConnection.cpp
ensorEventConnection.h
ensorList.cpp
ensorService.cpp
ensorService.h
2e990eb59e927187b11c7b5f0abe6dbdb0123d1d 13-Jan-2017 Nick Vaccaro <nvaccaro@google.com> Sensors: Add LOW_LATENCY_OFFBODY_DETECT sensor API

Test: none
Bug: 34234089
Change-Id: I7680ef1523cec0212e2817368f8d62891edc92cf
ensorServiceUtils.cpp
d08d30ca2cd60770127ef7d80fba4cd5724b5230 13-Jan-2017 Peng Xu <pengxu@google.com> Adapt change in HIDL hal and remove old hal version logic

Adapt Sensors HIDL changes
* remove unused parameter (always 0) in batch function.
* remove legacy/duplicated functionality setDelay

The new HIDL interface based SensorDeviceTreble does not
depend on old HAL version logic.

Test: tested with SensorLogger app, all sensor works.

Change-Id: I24ccb6a4ebe1ed5ed84882d46e77909c835a2f34
ensorDeviceTreble.cpp
b41a3853ca371111d72715cd6288a2bdefc2fa1f 11-Jan-2017 Martijn Coenen <maco@google.com> Fix _treble build targets breakage.

Test: ENABLE_TREBLE=true builds again.
Change-Id: I4ec504e392cf99b9b3345d90a974bd9147fd2037
ensorDeviceTreble.cpp
2c588c536090ea3e7e80db0e5031935b6026814c 23-Nov-2016 Nick Vaccaro <nvaccaro@google.com> Fix sensor permission

All sensor will show up when app ask for sensor list regardless of
permission. Operation of sensors, such as registering listener,
is permission checked so that apps without permission cannot obtain
sensor data.

Bug: 33094188
Change-Id: I1d91e855163954666a18b2f8daadb2639b946b24
(cherry picked from commit 1f24f0f597ef318efb7db579563e4c06c60242df)
ensorService.cpp
0a031596e12ce0f081b9ee116f48f4f4635d516e 30-Nov-2016 Peng Xu <pengxu@google.com> [sensorservice] Init batterystats service when needed

This avoid race condition at parallel services start up that
may results in sensor power usage not being properly recorded.

Test: check all sensors, they still work
Bug: 33199244

Change-Id: I48946667db54fc72d9be6c13b981b44d1bab88c2
atteryService.cpp
atteryService.h
67a4762ed3ece97c4d3a7329a8733a77a73f7584 17-Nov-2016 Yifan Hong <elsk@google.com> Split libhidl into base and transport.

Bug: 32756130

Test: mma
Change-Id: I878e0e8f94e01695f633bc80ef163dbe18c8f622
ndroid.mk
bc9cb44d3fa479fc2d699d2b27e688526b2ebda6 08-Nov-2016 Steven Moreland <smoreland@google.com> Fix include dir for sensorservice.

Breaking angler_treble build currently.

Test: compiles
Change-Id: I3ef965d3cac798e0f8c9118c2c7095ce1abfd307
ensorDeviceTreble.cpp
a14ed29bcd6ab04464dd40756f7a56b0b9764459 03-Nov-2016 Steven Moreland <smoreland@google.com> SensorService: delete unused include.

Test: compiles
Change-Id: I2b44e3734c9919ea156124f5a0306d7f52996f5e
ensorDeviceTreble.cpp
1547e801cd733f44cc332559aee1c712e396f99c 03-Nov-2016 Janis Danisevskis <jdanis@google.com> Fix build error when building with ENABLE_TREBLE=true

Fixes use of renamed header file hidl/IServiceManager.h

Test: builds with ENALBE_TREBLE=true
Change-Id: I519e081a003bfd5b909522660df84a1f3450d2ef
ensorDeviceTreble.cpp
99fdbb5fdc6a2ab4cc1fdf99872a3b30cbbc6f0e 10-Oct-2016 Andreas Huber <andih@google.com> sensor HAL v3

Bug: 32021636
Test: no
Change-Id: If5f082db4f22c3aa4aa1eedb2948df767bb074aa
ndroid.mk
ensorDevice.h
ensorDeviceTreble.cpp
f0c68852ffd061f8e41c437806fbfa7b74bc9f57 28-Sep-2016 Peng Xu <pengxu@google.com> [sensorservice] Fix inconsistent states in SensorDevice am: 4f707f8b3d
am: 86b20dcef4

Change-Id: I3112afafc8a912b459e6be5243396e7ca8c7ba93
86b20dcef4b91298efee59f4bed24d6ab2be3ad1 28-Sep-2016 Peng Xu <pengxu@google.com> [sensorservice] Fix inconsistent states in SensorDevice
am: 4f707f8b3d

Change-Id: I1090cee6b4b81e10d0b5bc31ab879b1a3788d407
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
ensorDevice.cpp
ensorDevice.h
ensorService.cpp
08f1b67b54c962da21f7040bff5ed8dbd8ac7b5f 21-Sep-2016 Peng Xu <pengxu@google.com> Show masked value for sensor with permission
am: fba3c11b5e

Change-Id: If4b9fd323d0f8333cd1d1dea8c1d801b43c7e157
ee36adbde7ff84db0d3c3fcd7aaa60e3f60c08d7 21-Sep-2016 Ashutosh Joshi <ashutoshj@google.com> Merge "Show masked value for sensor with permission" into cw-f-dev
3da94c437038e528e9f826e8d5b76085ae28c636 14-Sep-2016 Peng Xu <pengxu@google.com> Merge "Sensor: Make switching from data injection mode to normal mode more productive" am: e6a4e9b04e am: 33685d3a84 am: 0674efdbfa
am: 85171c016e

Change-Id: I4db1bfa247779e46ca57117df8fc1ee5240c95e3
85171c016e61e5c19abb836ca9ec669153387162 13-Sep-2016 Peng Xu <pengxu@google.com> Merge "Sensor: Make switching from data injection mode to normal mode more productive" am: e6a4e9b04e am: 33685d3a84
am: 0674efdbfa

Change-Id: I056c8fbdf6d4392fc34b9e5b318d2e79afe499d9
e6a4e9b04ed5cabf028f5094b2f5881739f78882 13-Sep-2016 Peng Xu <pengxu@google.com> Merge "Sensor: Make switching from data injection mode to normal mode more productive"
077380cc6ca69f48a930bfb43d6c74370fed846e 12-Sep-2016 Peng Xu <pengxu@google.com> Merge "[sensorservice] Add log to rare CTS failure cause"
bc36f97776d457e923926ce1d00d957513a251d6 10-Sep-2016 Peng Xu <pengxu@google.com> Fix dangerous unsafe_get() in SensorRecord am: eb05947ae2
am: 8781d839de

Change-Id: I9cbddcdc0c7e0bc549d476dbb85fe3da67cc69d5
fba3c11b5ebf947827d7578373feef48ac12bd8c 08-Sep-2016 Peng Xu <pengxu@google.com> Show masked value for sensor with permission

Show masked values in sensor event log in dump even if sensor
requires permission. Information about number of event and timestamp
will aid debugging.

Bug: 31065418

Change-Id: If038d2884a7b13b853183df037a9d2dcacfb5284
(cherry picked from commit 2c238fc281da578d382f64443a7c9d7df89b2f39)
ecentEventLogger.cpp
ecentEventLogger.h
ensorService.cpp
68ff807e863139de0e1eb1c7de8287daef141cc7 08-Sep-2016 Peng Xu <pengxu@google.com> Merge "Fix google-explicit-constructor warnings in sensorservice." am: 215d7ab7d8 am: 341d12b107 am: b6365afdea
am: a051429882

Change-Id: I0f4f1858236a253fb9f91304eda89f74c789bae8
a0514298820fdd5fe70105e9dc88dbccdf073be0 08-Sep-2016 Peng Xu <pengxu@google.com> Merge "Fix google-explicit-constructor warnings in sensorservice." am: 215d7ab7d8 am: 341d12b107
am: b6365afdea

Change-Id: I27abfe181b514252dc42341100c1b4e45d04190c
2c238fc281da578d382f64443a7c9d7df89b2f39 08-Sep-2016 Peng Xu <pengxu@google.com> Show masked value for sensor with permission

Show masked values in sensor event log in dump even if sensor
requires permission. Information about number of event and timestamp
will aid debugging.

Bug: 31065418

Change-Id: If038d2884a7b13b853183df037a9d2dcacfb5284
ecentEventLogger.cpp
ecentEventLogger.h
ensorService.cpp
bfac17eed90d410de51413ef2484f79fb0e241e2 31-Aug-2016 Aniroop Mathur <a.mathur@samsung.com> Sensor: Make switching from data injection mode to normal mode more productive

Currently, when sensor service mode is switched back to normal mode from data
injection mode, request to enable the sensors is passed first to HAL and then
request to change mode is passed. With this, request to enable the sensors is
actually non-effective because sensor service is still in data injection mode
so HAL could not pass the request further to driver as otherwise real and
recorded data gets mixed up.
Therefore, lets first make request to set mode and then make request to enable
the earlier enabled sensors.

For example: Testing Auto Rotation algorithm,
- Auto Rotation enabled --> real data production
- Sensor service mode changed to data injection --> real data stopped
- Played recorded data --> AR algorithm tested with recorded data
- Sensor service mode changed to normal --> mode changed succesffuly,
but auto rotation not working again although expected to work in normal mode.

Change-Id: Id01b73e2aed85ed44314b8d632c096b21b62423f
Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
ensorService.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
ensorDevice.cpp
38fc101331d15dde716f80f2f64b4317ea1e22f1 01-Sep-2016 Chih-Hung Hsieh <chh@google.com> Fix google-explicit-constructor warnings in sensorservice.

* Add explicit keyword to conversion constructors,
or use NOLINT for implicit converters.
Bug: 28341362
Test: build with WITH_TIDY=1

Change-Id: Ie7c4dfcdbd069809e103f0dd008ae2fb4b0502f4
ecentEventLogger.h
ingBuffer.h
otationVectorSensor.h
ensorEventAckReceiver.h
ensorInterface.h
at.h
ec.h
eb05947ae2c4ac3a80712fed9382d82cb9aedad5 13-Aug-2016 Peng Xu <pengxu@google.com> Fix dangerous unsafe_get() in SensorRecord

Change raw pointers to wp<> and constify relevant lines in
SensorRecord.

Bug: 30261110

Change-Id: I7f28c593366af44192991061fa5f71cf925b22a8
(cherry picked from commit ded526e8c3539b5986b46dffc1ff8ab15d7da570)
ensorEventConnection.cpp
ensorEventConnection.h
ensorRecord.cpp
ensorRecord.h
ensorService.cpp
ensorService.h
ded526e8c3539b5986b46dffc1ff8ab15d7da570 13-Aug-2016 Peng Xu <pengxu@google.com> Fix dangerous unsafe_get() in SensorRecord

Change raw pointers to wp<> and constify relevant lines in
SensorRecord.

Bug: 30261110

Change-Id: I7f28c593366af44192991061fa5f71cf925b22a8
ensorEventConnection.cpp
ensorEventConnection.h
ensorRecord.cpp
ensorRecord.h
ensorService.cpp
ensorService.h
49ac80e65c7de2459023f16cd73f5c6dc0942b21 05-Aug-2016 Peng Xu <pengxu@google.com> Tune SensorService thread priority, lower sensor event latency am: 98d30f627e am: f71fcf9603
am: 302f404595

Change-Id: I6299bb49fee5b7ebad230b84055a0092bc6045db
302f40459526af3598f8427ef321d5e3dac0e0ba 05-Aug-2016 Peng Xu <pengxu@google.com> Tune SensorService thread priority, lower sensor event latency am: 98d30f627e
am: f71fcf9603

Change-Id: I8e9919fef007b18272f2910edc106da1710b93ed
98d30f627ef96ca6e47c9cbcbdcfb63adbeda424 02-Aug-2016 Peng Xu <pengxu@google.com> Tune SensorService thread priority, lower sensor event latency

Change SensorService priority to SCHED_FIFO 10 to ensure
sensor events to be delivered to apps in consistent short time even
if system is under load.

Bug: 30105910

Change-Id: I5ddf7061b75cf46b54e16476d20bbc888024aa43
ensorService.cpp
ensorService.h
e8be6625464f53fdf6d58c2991e160c1b5bde790 08-Jul-2016 Peng Xu <pengxu@google.com> Merge \\"Increase sensor registration log size\\" into nyc-mr1-dev am: 6118fb85d7
am: 26af1e0419

Change-Id: I17f8653afdc18ef0690f8b7a129b474fbed4ecfe
26af1e0419b8c5fe88306f47e7d43ab24f0b399d 08-Jul-2016 Peng Xu <pengxu@google.com> Merge \"Increase sensor registration log size\" into nyc-mr1-dev
am: 6118fb85d7

Change-Id: I74fae8dc3458adbc421d2589510bc858b1d2d79b
363b3fde1499521aafdc78d9d28380cc643ec6b5 08-Jul-2016 Peng Xu <pengxu@google.com> Increase sensor registration log size

This is for aiding debugging of b/29625330. The size is increased
so that we have a better chance to know what happened before the
failure happens.

Bug: 29625330
Change-Id: I8b741cb5981d8e91b9ef53a00e65c0bbe34ed55e
ensorService.cpp
ensorService.h
9a872a50d80edc319b5f4a01649422093060352b 23-Jun-2016 Greg Kaiser <gkaiser@google.com> Merge \\\"Sensor: Make getId() more varied\\\" into nyc-dev am: c0ca0ceaa5 am: 2bee6c5651
am: 0da71178c1

Change-Id: I08b78668396ec6262ad241bda3499ec7e08511d6
2bee6c565136c291bba0c9310f6975c6cc196728 23-Jun-2016 Greg Kaiser <gkaiser@google.com> Merge \"Sensor: Make getId() more varied\" into nyc-dev
am: c0ca0ceaa5

Change-Id: Ifa6208fea63d830d07447d5232b39f9e3ccf870b
53ca2e00c6f2a71b93c8e3c8e85aeeb03c5bd06d 22-Jun-2016 Greg Kaiser <gkaiser@google.com> Sensor: Make getId() more varied

Apps from different developers will now receive a different
ID for the same dynamic sensor. Additionally, all apps
will now receive a different/new ID for the same dynamic
sensor after a factory reset.

Bug: 28775590, 29547335
Change-Id: I368655b0e4bdc16736a7fd163ea3f7dad2886b3b
ndroid.mk
ensorService.cpp
ensorService.h
a24d7a95d9ae3acfd7c1349dddcc0c2343d928a2 20-Jun-2016 Greg Kaiser <gkaiser@google.com> Merge \\\"SensorList: Don\\\'t output UUIDs\\\" into nyc-dev am: a0c08e2f8f am: 86290abb3c
am: 89ef3a8ee0

Change-Id: I69b6954043882bd2486bb5cb81d74334a91842ed
86290abb3cceff9cec276d2c1247ef23b638fdce 20-Jun-2016 Greg Kaiser <gkaiser@google.com> Merge \"SensorList: Don\'t output UUIDs\" into nyc-dev
am: a0c08e2f8f

Change-Id: Ia791bb67a2351f68da06e0ddc35c224677e4cead
abce9cf0ae448b1dd8782bece2843852e701a081 18-Jun-2016 Greg Kaiser <gkaiser@google.com> SensorList: Don't output UUIDs

We don't want the UUIDs of dynamic sensors to be in the logs.

Bug:28775590
Change-Id: I85ca83e0ad1a0a8ed6618999bd22d86d7ef972f9
ensorList.cpp
3dcefe386c4e4c2a2fcf96f8b78af0dec2c8c631 20-May-2016 Chih-hung Hsieh <chh@google.com> Merge "Fix misc-macro-parentheses warnings in sensorservice and CHECK_INTERFACE." am: bb261bf41a am: dea1b6820d am: 22c661db12
am: 40063530eb

* commit '40063530eb9ac8a6e87bc17d617586c45e89b9bb':
Fix misc-macro-parentheses warnings in sensorservice and CHECK_INTERFACE.

Change-Id: Id2a32c37264ea6dd879e852f0b6df737852fb3e2
22c661db1291af40928a691f5bf5dad4d077e573 20-May-2016 Chih-hung Hsieh <chh@google.com> Merge "Fix misc-macro-parentheses warnings in sensorservice and CHECK_INTERFACE." am: bb261bf41a
am: dea1b6820d

* commit 'dea1b6820d0370914061ee6d147c2fab0c1bfd6c':
Fix misc-macro-parentheses warnings in sensorservice and CHECK_INTERFACE.

Change-Id: Icf533c544905be12e7a28fce4523f32a0b3bedb0
a389c7a87c1ae31e177153f1eb0b0159b9effaea 20-May-2016 Chih-Hung Hsieh <chh@google.com> Fix misc-macro-parentheses warnings in sensorservice and CHECK_INTERFACE.

Bug: 28705665
Change-Id: I53ed01b67054327ad55a7e83143cc82283573fe1
ensorService.h
76290b3348381a195e2ecff611bb2d9ab128d844 03-May-2016 Peng Xu <pengxu@google.com> Merge "[sensorservice] Fix on-change sensor send latest value on enable" into nyc-dev am: f6fc321644 am: 5a4928a34e
am: a615dc8a51

* commit 'a615dc8a5109976eaf3d90ad5c2300d953194fae':
[sensorservice] Fix on-change sensor send latest value on enable

Change-Id: I9ea429cc4380e3fb668d35097a0a313093e40b62
45ca9f58a0f7808169199fba1cc067c51e2d437b 02-May-2016 Peng Xu <pengxu@google.com> [sensorservice] Fix on-change sensor send latest value on enable

This CL correct the behavior of sensorservice so that the latest
value of on-change sensor is send to client when enabling sensor.

The errornous behavior before is that sensorservice send the oldest
value in local cache.

Bug: 28480791
Change-Id: I7e0b8e52fa0be62ba95910789cff1fe0d4fbb03f
ecentEventLogger.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
ndroid.mk
ostRecentEventLogger.cpp
ostRecentEventLogger.h
ecentEventLogger.cpp
ecentEventLogger.h
ingBuffer.h
ensorDevice.cpp
ensorDevice.h
ensorInterface.cpp
ensorInterface.h
ensorList.cpp
ensorList.h
ensorService.cpp
ensorService.h
ensorServiceUtils.cpp
ensorServiceUtils.h
ests/sensorservicetest.cpp
f9ba59e8481a120c8056ebee1652bc0cda962e73 16-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "sensorservice: switch to use sp<> in sensor list" into nyc-dev am: 47babb8
am: 9c0f518

* commit '9c0f518fddb935ea8bbee295d6061176ffbdfbad':
sensorservice: switch to use sp<> in sensor list

Change-Id: I23a1abc7f6908c7b064eb56dd8198b89026d3412
755c451c7861a029e26e5f16e319b629169e656d 08-Apr-2016 Peng Xu <pengxu@google.com> sensorservice: switch to use sp<> in sensor list

* Switch to use smart pointer in SensorList to avoid object
life cycle issue.
* Refactor HardwareSensor and various virtual sensor class.
* Change active virtual sensor map into a set of handles.

Change-Id: I674d5eb5c0038179f9ef1b6f0d576b8b605649ec
orrectedGyroSensor.cpp
orrectedGyroSensor.h
ravitySensor.cpp
ravitySensor.h
inearAccelerationSensor.cpp
inearAccelerationSensor.h
rientationSensor.cpp
rientationSensor.h
otationVectorSensor.cpp
otationVectorSensor.h
ensorEventConnection.cpp
ensorInterface.cpp
ensorInterface.h
ensorList.cpp
ensorList.h
ensorService.cpp
ensorService.h
7e744f76c8202683a32943fbe61a927812b60819 11-Apr-2016 Peng Xu <pengxu@google.com> Merge "Refactor sensor list in SensorService" into nyc-dev am: df4f17e
am: 5e5a6f3

* commit '5e5a6f3ebf4284858bf4c41c58103fed9ed46c50':
Refactor sensor list in SensorService

Change-Id: I887afc87b46742b9651fc8c9b47622539e16e322
0cc8f809924706c7d683da30605f432635dd5bb6 06-Apr-2016 Peng Xu <pengxu@google.com> Refactor sensor list in SensorService

Refactor sensor lists management logic in sensorservice:
* Factor all sensor list management code into a separate class.
* Remove error-prone repeated sensor lists.
* Solve synchronization issue when sensor is added or removed during runtime.
* Switch to STL containers.

Bug: b/27911774

Change-Id: I94d5571e1fa3166dbe893ffac2a2a7584be6349c
ndroid.mk
orrectedGyroSensor.cpp
orrectedGyroSensor.h
ravitySensor.cpp
ravitySensor.h
inearAccelerationSensor.cpp
inearAccelerationSensor.h
rientationSensor.cpp
rientationSensor.h
otationVectorSensor.cpp
otationVectorSensor.h
ensorInterface.cpp
ensorInterface.h
ensorList.cpp
ensorList.h
ensorService.cpp
ensorService.h
84174fb034d4b1e9117428ed4c7a9cdace0c292b 06-Apr-2016 Greg Kaiser <gkaiser@google.com> Merge "SensorService: Remove unused function" into nyc-dev am: 10a91a5
am: 8782cd4

* commit '8782cd4295242983f5258295a205ab678afba428':
SensorService: Remove unused function

Change-Id: Ied1f820e089fc9059432b55790df3509e3fb3910
c130d7ad6ca88abe443a435fdb025a9a0886ea6e 05-Apr-2016 Greg Kaiser <gkaiser@google.com> SensorService: Remove unused function

We remove the unused getSensorRecord function. This function
was accessing the mActiveSensors field without obtaining a lock.
We're looking to simplify this code, so we just remove this instead
of trying to fix it.

Change-Id: I8c4ed3cc7ed17d90aa9a5d7f33f9ab9238f9403f
ensorService.cpp
ensorService.h
19858ee5f3b42aea0c8cd9649d0944cbba3a59be 05-Apr-2016 Peng Xu <pengxu@google.com> Merge "[sensorservice] temporarily remove Autolock mSensorsLock" into nyc-dev am: 90b745d
am: e597405

* commit 'e597405a6e4e9eac587dbda10c540cc33593915a':
[sensorservice] temporarily remove Autolock mSensorsLock

Change-Id: I2a61e6068a27ebbc8fe6f1a6f130d74a5297a37f
e51c25724d0da28a84e13ceffa40542d18ff4258 04-Apr-2016 Peng Xu <pengxu@google.com> [sensorservice] temporarily remove Autolock mSensorsLock

Bug: b/27992752

Change-Id: I3d139c988d1a3522b75374423dcda74c5bd510a3
ensorService.cpp
ensorService.h
18a93767b691189bb147497ed14628e01110f54f 01-Apr-2016 Peng Xu <pengxu@google.com> Merge "Fix a few known issues in SensorService" into nyc-dev am: d5194bd
am: 7d57070

* commit '7d57070ee8813cb74a23d6f85e9116d844542eb9':
Fix a few known issues in SensorService

Change-Id: Ifc6624a386344e7b69ab4fc4322cbefff4de1224
47e96014fe6576a0ae7b02e7a2cb2275e549bbc9 29-Mar-2016 Peng Xu <pengxu@google.com> Fix a few known issues in SensorService

This CL fixes a few known issues in sensorservice which is related
to newly added dynamic sensor discovery API.

* check and ensure handle uniqueness for dynamically discovered
sensor.
* add mutex for synchronizing r/w of various sensor lists.
* ensure dynamic sensor list is reported sorted by handle.
* code format fix

Bug:
b/27911774

Change-Id: Iec6df90ae150321ea9e4309b2ac1200b8dc37f05
ensorService.cpp
ensorService.h
7b6f6c18baab41d9d90403f717ff7c321a7a72d5 23-Mar-2016 Greg Kaiser <gkaiser@google.com> Merge "sensorservice: Strengthen compiler warnings." into nyc-dev am: 2376b4e
am: 4bf4ffd

* commit '4bf4ffd02d17b7bf7481e07082ee6ab54393c57f':
sensorservice: Strengthen compiler warnings.
be6dd4e765d8276ab5de17dabfc0a7d0a9c0e338 22-Mar-2016 Greg Kaiser <gkaiser@google.com> sensorservice: Strengthen compiler warnings.

We turn on Wall and Werror for our sensorservice module, and
turn on Wextra for sensorservice and libsensorservice.

This doesn't trigger any new warnings, so this is just a
future-proofing move.

Change-Id: I6574632cd83866e2925697664c33ab9537a4993b
ndroid.mk
ded6b52f66d375b89089a168092edcba5bfa0566 11-Mar-2016 Nick Vaccaro <nvaccaro@google.com> Return 16 values when sending on-change sensor\'s last event am: 95f13901ed am: e4be205b7b am: 8fb2b0233e
am: 608766c325

* commit '608766c325725be110715aa059eb0193fb4b3ae7':
Return 16 values when sending on-change sensor's last event
8fb2b0233ef59527d74c614532631187713fa653 11-Mar-2016 Nick Vaccaro <nvaccaro@google.com> Return 16 values when sending on-change sensor\'s last event am: 95f13901ed
am: e4be205b7b

* commit 'e4be205b7b64be5d183b3a0f9724ec28a2d7e7cf':
Return 16 values when sending on-change sensor's last event
e4be205b7b64be5d183b3a0f9724ec28a2d7e7cf 11-Mar-2016 Nick Vaccaro <nvaccaro@google.com> Return 16 values when sending on-change sensor\'s last event
am: 95f13901ed

* commit '95f13901edc77650f4bb8d727169e553af28a9d1':
Return 16 values when sending on-change sensor's last event
95f13901edc77650f4bb8d727169e553af28a9d1 02-Mar-2016 Nick Vaccaro <nvaccaro@google.com> Return 16 values when sending on-change sensor's last event

Sensor Services now sends 16 values when sending out the last
event for a vendor defined on-change sensor type.

Bug: 26962513
Change-Id: I238b945c9dc9186b621544aef7d0244f63d4b2e8
ensorService.cpp
9edb76331fcb2592919b79f49fffd0a5f81c1921 25-Feb-2016 Ashutosh Joshi <ashutoshj@google.com> Merge "Stop supporting old Sensor HAL versions."
6f7854b31a7d58e1319f3c00c2562f2dfb87a0cc 19-Feb-2016 Aurimas Liutikas <aurimas@google.com> Fix compiler warnings in sensorservice.

Bug: 26936282
Change-Id: Ibd43b3c2aaa32cb77b610ca9e1537e5db8827c87
ndroid.mk
usion.cpp
ostRecentEventLogger.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
ensorDevice.cpp
9e72046f399f13dfeb5ed0cb32343ca6697f52f5 27-Jan-2016 Peng Xu <pengxu@google.com> Implementation of sensor additional info report

This implements a mechanism for sensor hardware/HAL to deliver additional information beside sensor
readings to application. It includes internal temperature reading, untracked delay of sample,
location and pose of sensor device placement in phone frame, etc. This is also a very expandable
frame to account for future need.

Change-Id: Ib7780ac765f24d14eaed72b9862cd84b76054d74
ensorService.cpp
b7beb52d622f901d2c2efd3b8ebd1879514d3e88 22-Jan-2016 Peng Xu <pengxu@google.com> [DO NOT MERGE ANYWHERE] Fix bodysensor permission

Bug: 26481493
Bug: 26447970

Change-Id: Iaadf64814c03ae8098c8553ac98d19b77c1eabcd
ensorService.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
ensorDevice.cpp
ensorDevice.h
ensorService.cpp
ensorService.h
eb4d628b69831d533f14c09fd63400f75e69ba76 11-Dec-2015 Peng Xu <pengxu@google.com> Divide huge SensorService files into managable pieces

Splitted SensorService.cpp and SensorService.h into smaller more
manageable pieces with the embedded classes/structs now in individual
files.

Change-Id: I5e75c41b9e0e5c9aff102fe4b0f142c61d1203e2
ndroid.mk
ostRecentEventLogger.cpp
ostRecentEventLogger.h
ensorEventAckReceiver.h
ensorEventConnection.cpp
ensorEventConnection.h
ensorRecord.cpp
ensorRecord.h
ensorRegistrationInfo.h
ensorService.cpp
ensorService.h
8c3e55f4149deda3ec7c7a67fda81216d5f9af25 02-Dec-2015 Ben Fennema <fennema@google.com> Revert "DO NOT MERGE ANYWHERE Add new interface for sensor physical data"

This reverts commit d4db70a7b8b2d136c46c50f89b276f8150be5fc2.

Change-Id: Ifb52d5595970a5178e12c2a90da4aac0e38f5942
ensorDevice.cpp
ensorDevice.h
ensorService.cpp
ensorService.h
d4db70a7b8b2d136c46c50f89b276f8150be5fc2 09-Oct-2015 Jani Suonpera <jasuonpe@gmail.com> DO NOT MERGE ANYWHERE Add new interface for sensor physical data

This is special solution only for emerald branch.

Changes including new const char* value/interface for sensor physical data. Sensor service and manager does not take care of content, structure or other
details of string. Sensor HAL is taking care of parsing data from string and setting values to Sensor HW.

Change-Id: I3abc3ddc7c6adc4b32a40b9a43f2a94c5af7b2b0
Signed-off-by: Ben Fennema <fennema@google.com>
ensorDevice.cpp
ensorDevice.h
ensorService.cpp
ensorService.h
c899c322ab49639c1e1b012bb5a8b7d52f8497f4 30-Oct-2015 Peng Xu <pengxu@google.com> Merge "Avoiding flush on-change sensors at subscription" into mnc-dr-dev am: a78c2e65e1 am: ffb07f645e am: e4db21f4b8
am: cca37b0d39

* commit 'cca37b0d39137ccb5ad6843fffd1ff34b5961f06':
Avoiding flush on-change sensors at subscription
cca37b0d39137ccb5ad6843fffd1ff34b5961f06 29-Oct-2015 Peng Xu <pengxu@google.com> Merge "Avoiding flush on-change sensors at subscription" into mnc-dr-dev am: a78c2e65e1 am: ffb07f645e
am: e4db21f4b8

* commit 'e4db21f4b8bd12000e8052a6d5a6e1b1e4349a5a':
Avoiding flush on-change sensors at subscription
20483c49377fdb0330d9dfbbb2168b470c0b29d3 26-Oct-2015 Peng Xu <pengxu@google.com> Avoiding flush on-change sensors at subscription

Initial sensor flush at subscription is a mechanism to avoid sensors
to get stale samples before subscription happens. However, there is a
slight chance that a most recent sample will be lost during the flush
process. This is OK for continuous sensors but problematic in
on-change sensor as on-change event does not come continuously and
a lost event can cause inconsistent state in client. Flush at
subscription of on-change sensor is disabled in this CL to avoid new
important on-change event to be discarded during the initial flush
process.

Bugs: b/24647069
b/25241873
b/24804819

Change-Id: Ibda099c6b9f5fb6e200f13cf13a850b0026e9e7c
ensorService.cpp
a4820004000d41e8a9680db27013856cc18badf2 29-Aug-2015 Elliott Hughes <enh@google.com> am 2fcd675b: am e9a779bf: am 1159b181: Merge "ignore SIGPIPE signal in native services"

* commit '2fcd675b40ad9c94c1ff9506cdea63a48a81c9d6':
ignore SIGPIPE signal in native services
e9a779bf5367ead7ddbd532828d8027a34b4748c 29-Aug-2015 Elliott Hughes <enh@google.com> am 1159b181: Merge "ignore SIGPIPE signal in native services"

* commit '1159b18177c7247884d7c90c11abfe5aae39cb34':
ignore SIGPIPE signal in native services
0944691d68089c17d71641a55192fb2fe755ec92 28-Aug-2015 Young-Ho Cha <ganadist@gmail.com> ignore SIGPIPE signal in native services

When run dump method via dumpsys command with invalid pipe fd, native
services can crash with SIGPIPE.
So ignore SIGPIPE signal.

Bug: https://code.google.com/p/android/issues/detail?id=184099
Change-Id: Icb15e0dff34a245c08c1b4c4bed51992ae382da4
Signed-off-by: Young-Ho Cha <ganadist@gmail.com>
ain_sensorservice.cpp
f66684a6fb2a2991e84a085673629db2a0494fc6 23-Jul-2015 Peng Xu <pengxu@google.com> Add AOSP Geomag and Game Rotation, and Gravity

Providing AOSP software implementation of Geomag Rotation Vector, Game
Rotation Vector and Gravity sensors for platforms that does not have
hardware implementation of these sensors but do have primitive sensors
(accelerometers, gyrometers and magnetometers).

Previously, AOSP Gravity sensor is enabled only when all primitive sensors are
available. This is changed so that AOSP Gravity will be available even
no magnetometer is in the device.

Related bug/feature request:
* b/17508800
* b/22610016

Change-Id: I4e2d3e544884047d66e7fdbce2282f1f8234eae9
orrectedGyroSensor.cpp
usion.cpp
usion.h
ravitySensor.cpp
rientationSensor.cpp
otationVectorSensor.cpp
otationVectorSensor.h
ensorFusion.cpp
ensorFusion.h
ensorService.cpp
ensorService.h
18343a2fd11583b884d1566a232a75b004fb3813 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

(cherry picked from commit d4036b6b7f9609fe09efabdbfbb8c8f9428f76f7)

Change-Id: I5e48dce36678c12069c0e162b920870de81b89f2
atteryService.cpp
ravitySensor.cpp
ensorDevice.cpp
ensorService.cpp
ec.h
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
atteryService.cpp
ravitySensor.cpp
ensorDevice.cpp
ensorService.cpp
ec.h
f504789dd3b3073de176fd2fa09dd9fc9de5bc1f 21-Jul-2015 Aravind Akella <aakella@google.com> Check for the presence of accel and magnetometer sensors before adding AOSP fusion sensors.

Bug: 22502485
Change-Id: I3d9018649302b98004e4e216b2173e8411a08501
ensorService.cpp
8ef3c89eb2030395f8a342bd16dbb344957ab275 10-Jul-2015 Aravind Akella <aakella@google.com> Rename wakelock held internally by SensorService.

Bug: 22076400
Change-Id: I62129549b0681f200f40da01f53140245309ed88
ensorService.cpp
841a5926fc9b3f9f0e654ba3aab8e43bea7de7f1 29-Jun-2015 Aravind Akella <aakella@google.com> Enable sensor data injection mode through adb.

Change-Id: I415cf8ff0871fa74babaf9b879c68f210298b472
ensorService.cpp
ensorService.h
7a1b5d5dec10f05ec29e7251ada440b47a34c6aa 24-Jun-2015 Aravind Akella <aakella@google.com> Merge "Fix crash in SensorService. Ignore devices with no sensors." into mnc-dev
ee155cadb23e84542cbf445c2aac89ae63df4cc7 24-Jun-2015 Aravind Akella <aakella@google.com> Fix crash in SensorService. Ignore devices with no sensors.

Change-Id: I1491740baa6348f97c336b6883b11ad2ab93cf73
ensorService.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
ensorDevice.cpp
ensorService.cpp
ensorService.h
a8814ce4780590675de6335de92e9b313f0e823b 11-Jun-2015 Aravind Akella <aakella@google.com> Use LOCATION_HARDWARE permission for data injection.

Change-Id: Ie81cb0d5f537d5431f2127891cca1d39c969ee7b
ensorService.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
ensorDevice.cpp
ensorService.cpp
ensorService.h
be451b57b97c21747c637f4af06743318d42c36c 09-May-2015 Aravind Akella <aakella@google.com> Merge "Fix the arguments to memcpy." into mnc-dev
08f04bf36c3f5d2e91de5525dfce778e56464fc2 09-May-2015 Aravind Akella <aakella@google.com> Fix the arguments to memcpy.

Change-Id: Ieaee26f46f43a9d412537047566178985370198b
ensorService.cpp
b0474e78df2a778c42c6746da815f397bb2df374 03-May-2015 Sasha Levitskiy <sanek@google.com> SensorServiceTest: Fix build, warnings.

Change-Id: I3ed5247d3eb6c43d185049cf9011c2ee01b5662e
Signed-off-by: Sasha Levitskiy <sanek@google.com>
ests/sensorservicetest.cpp
b412f6e203b38f8047f760261a5e3dc6d0722f08 30-Apr-2015 Svetoslav <svetoslavganov@google.com> Add body sensors app op - framework native

Change-Id: I727a2bb1e28ae9158f2df9c74dd0aee977dfd47f
ensorDevice.cpp
ensorDevice.h
ensorService.cpp
ensorService.h
a9e6cc387072e25706a6d847a97b02a6f25a918b 17-Apr-2015 Aravind Akella <aakella@google.com> Enable data injection mode in SensorService.

Change-Id: I0cd32a017235c31c54816e4a357ce3b988350ed6
ensorDevice.cpp
ensorDevice.h
ensorService.cpp
ensorService.h
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
ensorDevice.cpp
ensorDevice.h
ensorService.cpp
ensorService.h
7d831769fce188251afb02e6b933be7bdfe504b4 26-Nov-2014 Chih-hung Hsieh <chh@google.com> am 46ca041f: Merge "Don\'t error out because SensorEventConnection::dump overloads BBinder::dump"

* commit '46ca041f43e3d80029782b12c994b232dc01b5d5':
Don't error out because SensorEventConnection::dump overloads BBinder::dump
72952efe5ce8ee10e3c591cc6d2a3475b7b91690 17-Nov-2014 Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> Don't error out because SensorEventConnection::dump overloads BBinder::dump

clang warns about SensorEventConnection::dump overloading BBinder::dump
in some conditions.

Since the cause isn't fixable without changing the API, tell clang not
to error out on it.

Change-Id: I15659de7c5499d937019599cfefb01305039e6b5
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
ensorService.h
22b99e3a9a5797deada897102e71e9a88ae46d24 25-Nov-2014 chh <chh@google.com> am 45aa0227: Merge "Fix potential format string vulnerability"

* commit '45aa022710165c321cdec9a475f269d6932fe1f3':
Fix potential format string vulnerability
5f6199373dc1e07d2ee5edbae7ecfa08a065492e 17-Nov-2014 Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> Fix potential format string vulnerability

A sensor name containing a format string could have interesting side
effects...

Change-Id: If7f1378aa68572d9716c339728eab18faa6b9f2a
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
ensorService.cpp
b4373ac9f53e3a6edee915715101d535e1a851a1 30-Oct-2014 Aravind Akella <aakella@google.com> Add a timeout for releasing SensorService wake_lock.

If SensorService is holding a wake_lock and there are no acknowledgements
from ANY app within 5 seconds, release the wake_lock and reset the wake_lock
refcounts for all connections.

Bug: 16874240
Change-Id: I5e950dd393c20173c439cbd5a4ba614ee09d61f4
ensorService.cpp
ensorService.h
0b6acb2231baed861488f2d181621272d0658d25 19-Oct-2014 Aravind Akella <aakella@google.com> Add version number to SensorService dump output.

Change-Id: I64f9482ade523ec3fafe14bff14db7196e32413f
ensorService.cpp
7830ef3dd0ff3749d974c2dd85a8fa59dc47aeca 07-Oct-2014 Aravind Akella <aakella@google.com> Change ordering of memory allocation and calling Thread::run().

In some cases this is causing a crash as device.poll is called with
NULL.

Bug: 17896339
Change-Id: Id431599f2c661338c355c7081b6602f8449a9198
ensorService.cpp
8a96955c8e14db40b16164236830fc9506a00872 29-Sep-2014 Aravind Akella <aakella@google.com> Fix sockfd leakage in SensorService.

i) Call removeFd() only if the fd in the BitTube has been
previously added to the Looper. Use a flag to determine whether the fd
has been previously added or not.
ii) Increment mPendingFlushEventsToSend after holding a connectionLock.
iii) Store the number of acks that are pending in SensorEventQueue
and send them all at once.

Bug: 17472228
Change-Id: I1ec834fea1112a9cfbd9cddd2198438793698502
ensorService.cpp
ensorService.h
deb71b2812702318900c36b7bcfa9759525ea7cc 29-Sep-2014 Aravind Akella <aakella@google.com> Merge "Fix a possible SensorService deadlock." into lmp-dev
e148bc29c27ae7a346fa686fdda6425ba202d97a 25-Sep-2014 Aravind Akella <aakella@google.com> Fix a possible SensorService deadlock.

If the destructor of SensorEventConnection gets called when the main
sendEvents loop of SensorService is executing it may result in a deadlock.
The loop promotes each connection to a strong_pointer, calls sendEvents
and cleans up the connection if necessary. It is possible that the sp's
destructor may delete SensorEventConnection which will call the dtor
~SensorEventConnection(). This dtor again needs SensorService mLock to
execute which may result in a deadlock.

Bug: 17617897
Change-Id: I76c244dbe85fadb591c0bd1a9a5eb01d93f56505
ensorService.cpp
678f4fce90b5ed2794007cc8c63fce0c1b962404 27-Sep-2014 Aravind Akella <aakella@google.com> Revert "Fix sockfd leakage in SensorService. Remove sockfd from Looper when the connection is removed from mActiveConnections."

This reverts commit 5105960d49bfa86efeeea8f87c87aa96b5771c37.

Change-Id: I4d39ded2e50ef8a8e0aac27e438876203385a1f0
ensorService.cpp
5105960d49bfa86efeeea8f87c87aa96b5771c37 24-Sep-2014 Aravind Akella <aakella@google.com> Fix sockfd leakage in SensorService. Remove sockfd from Looper
when the connection is removed from mActiveConnections.

Bug: 17472228
Change-Id: Iaabe0968bd2104ef961ff5e8659bf91712e2e1db
ensorService.cpp
0ec2066e4774b851c66176b99b0a5aa5abe6ad00 15-Sep-2014 Aravind Akella <aakella@google.com> SensorService fixes.

i) Initialize sensor_event.flags to zero or wake_up flag before sending dropped flush_complete_events. This will avoid unnecessary acks.
Currently it is not set to anything which may result in garbage values for flags field.
ii) Change the dump format of SensorEventConnection.
iii) Add const to method signatures wherever applicable.

Bug id: https://b2.corp.google.com/issues/17498626

Change-Id: Ia736ffb01c366540aab73cdcf596ce852c052593
ensorService.cpp
ensorService.h
8493b79e1cff92450076ca7450c4bf4e434a6816 09-Sep-2014 Aravind Akella <aakella@google.com> SensorService fixes

i) Significant Motion multiple clients fix. Make a copy of
mActiveConnections vector before cleaning up SensorEventConnections
when one-shot sensors trigger.
ii) Maintain a mapping between flush_complete_events and
SensorEventConnections to accurately map flush() API calls and
corresponding flush_complete_events
iii) Remove all references to 1_1 and 1_2 HALs.
iv) Dynamically allocate sensor_event buffers in SensorService main
threadLoop.

Bug: 17412359
Change-Id: If3c3986197660cafef2d2e0b4dc7582e229cf1c4
ensorService.cpp
ensorService.h
9e3adfcebf28c5c76085108dffe98c74df56857d 04-Sep-2014 Aravind Akella <aakella@google.com> SensorService flush fixes.

i) Fix a possible race condition when adding a pending flush connection
to mActiveSensors data structure.
ii) Invalidate flush_complete_events as soon as they are consumed by a
connection so that they are not used by other connections which are
registered for the same sensor.

Change-Id: I1491bea8c2081c4aab1feacc60add13b7aa26bb7
ensorService.cpp
ensorService.h
5466c3d20d03d4ae4b0fd0e0a93175091e3b0bb2 23-Aug-2014 Aravind Akella <aakella@google.com> SensorService fixes

1) Limit maxEventsToWrite depending on the size of the socket
buffer allocated (Fix for write failure on manta).
2) Do not call flush() if the sensor is not activated (OEM issue).

Change-Id: I81ea78dbdef3a3773af505ca1c9a5e39492c0b48
ensorService.cpp
ensorService.h
e74baf6ca7d57375f38540b6b7ac5e4af019951b 21-Aug-2014 Aravind Akella <aakella@google.com> SensorService fixes.

i) Add more debug stats (acks needed, acks received)
ii) Comment out write failure message.

Change-Id: Iac892a66530849a2dd023d6f5628cd070a79537d
ensorService.cpp
ensorService.h
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
ensorDevice.cpp
ensorService.cpp
ensorService.h
56ae42613c91f6a6fb0dc3f626daa24666fd18c2 11-Jul-2014 Aravind Akella <aakella@google.com> SensorService performance improvements.

i) Send ack for wake_up sensors on the socket connection instead of using Binder RPC.
ii) Cache events per connection in case there are write failures. Compute cache size
from FIFO counts of sensors.
iii) Send FlushCompleteEvent only for apps that explicitly called flush().

Change-Id: I018969736b7794b1b930529586f2294a03ee8667
ensorService.cpp
ensorService.h
7869e224aaaf717b5ab86df00b60fd5be5a0996c 15-Jul-2014 Sean Wan <swan@google.com> CW on L: Fix a SIGSEGV crash in sensor service.

This is to fix b/16189080.

BUG: 16189080
Change-Id: I78d44e82f797c0808891acde609040c46745a0bb
ensorService.cpp
adb65d9add2b7350b563d4583c5efbe3f0f0aca1 13-Jun-2014 Aravind Akella <aakella@google.com> Merge "Surface reportingMode for Sensors."
0e025c5af365e45e02cb75c1d46b46c7f4cd44cb 04-Jun-2014 Aravind Akella <aakella@google.com> Surface reportingMode for Sensors.

Change-Id: Iac8dd3408c90eb7d285a2e8043131fab3a7e58fa
ensorService.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
20914f0ad3691d977f61f1d4b92b49535e8f6f33 12-Jun-2014 Mark Salyzyn <salyzyn@google.com> am a4e345e1: Merge "sensorservice: 64-bit compile issues"

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

Change-Id: Ied7b779f39e71d041791729f7355b052b63903c5
ensorDevice.cpp
ensorService.cpp
d9441e4c27bb7d0b1dfe2a8b5c1ee1714442648d 14-May-2014 Aravind Akella <aakella@google.com> Surface maxDelay and isWakeUpSensor flag in Sensor.java.

Change-Id: Idd1e9045190beeca87b086b272e8cbf0bed05bae
ensorInterface.cpp
ensorService.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
ensorDevice.cpp
ensorService.cpp
ensorService.h
93b84e39e6cbb9f2ba37125465c4040e03b56048 11-Apr-2014 Aravind Akella <aakella@google.com> am ef89f763: am cf818ebb: Merge "Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors" into klp-modular-dev

* commit 'ef89f7638c43ce5f73e32d487bf65c3375995e3b':
Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors
ef89f7638c43ce5f73e32d487bf65c3375995e3b 11-Apr-2014 Aravind Akella <aakella@google.com> am cf818ebb: Merge "Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors" into klp-modular-dev

* commit 'cf818ebbf07c6a20ef48d71bf82f8d4bdf3a398c':
Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors
700180487ffec09d9df1657b018a7caadac24b75 08-Apr-2014 Aravind Akella <aakella@google.com> Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors

This reverts commit 4369a4ebd5ae7567e7075bc82830b83178099ed5.

Change-Id: Ifa8619cc6873470a07a987763d818d78d4232610
ensorService.cpp
ensorService.h
75b332037f6197acb239bfbbf2ac09adb31e9971 05-Apr-2014 Etienne Le Grand <etn@google.com> am 4369a4eb: Revert "Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors"

* commit '4369a4ebd5ae7567e7075bc82830b83178099ed5':
Revert "Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors"
30d6fd6b28aeacfe06ddc7adaac34e8a0032df40 05-Apr-2014 Etienne Le Grand <etn@google.com> Revert "Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors"

This reverts commit c57a019e117117c5a76c772970b26cd0f5db8c6a.

Change-Id: I3540565bc3e56a32cf3b176a29216cf68bb763b2
(cherry picked from commit 4369a4ebd5ae7567e7075bc82830b83178099ed5)
ensorService.cpp
ensorService.h
4369a4ebd5ae7567e7075bc82830b83178099ed5 05-Apr-2014 Etienne Le Grand <etn@google.com> Revert "Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors"

This reverts commit c57a019e117117c5a76c772970b26cd0f5db8c6a.

Change-Id: I3540565bc3e56a32cf3b176a29216cf68bb763b2
ensorService.cpp
ensorService.h
33458f72e17be8e71f50e1f8843f7821d90934f5 05-Apr-2014 Etienne Le Grand <etn@google.com> am 00f4dde1: am c57a019e: Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors

* commit '00f4dde1aa88576811bca79bc8242e1fc1edb333':
Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors
00f4dde1aa88576811bca79bc8242e1fc1edb333 05-Apr-2014 Etienne Le Grand <etn@google.com> am c57a019e: Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors

* commit 'c57a019e117117c5a76c772970b26cd0f5db8c6a':
Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors
c57a019e117117c5a76c772970b26cd0f5db8c6a 25-Mar-2014 Etienne Le Grand <etn@google.com> Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors

Change-Id: If0f3dbdb5d2e9378e1fed4614baee4e750d0c850
ensorService.cpp
ensorService.h
c45011f27209d5d548be3f96f2a23f7ff7f48c4c 14-Mar-2014 Mark Salyzyn <salyzyn@google.com> am cdbf28b3: Merge "native frameworks: 64-bit compile issues"

* commit 'cdbf28b3f7f5327f4cb0eb95b8326bf4c24c87ba':
native frameworks: 64-bit compile issues
993146092f8205d9747f082ccd63c09b536caa4e 14-Mar-2014 Mark Salyzyn <salyzyn@google.com> am d4dabf87: am cdbf28b3: Merge "native frameworks: 64-bit compile issues"

* commit 'd4dabf872ac0a12e12aebae9032f7d62762c2aeb':
native frameworks: 64-bit compile issues
d4dabf872ac0a12e12aebae9032f7d62762c2aeb 13-Mar-2014 Mark Salyzyn <salyzyn@google.com> am cdbf28b3: Merge "native frameworks: 64-bit compile issues"

* commit 'cdbf28b3f7f5327f4cb0eb95b8326bf4c24c87ba':
native frameworks: 64-bit compile issues
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
orrectedGyroSensor.cpp
ravitySensor.cpp
rientationSensor.cpp
otationVectorSensor.cpp
ensorDevice.cpp
ensorFusion.cpp
ensorInterface.cpp
ensorInterface.h
ensorService.cpp
ain_sensorservice.cpp
19d648195673b106152610e3787c95886946460f 06-Dec-2013 Aravind Akella <aakella@google.com> Bug fix for SensorFusion data rate.

SensorFusion is always returning data at the slowest possible sampling rate (5 Hz). batch() is getting called twice, first time with the requested rate and second time with the slowest rate (which overwrites the requested rate). Fix batch call in SensorFusion::activate()

Bug: 12064319
Change-Id: If62f3e514233f69810336fd22b136b4395b667d3
(cherry picked from commit 88509090387eeb400771a786171866710cca230c)
ensorFusion.cpp
ensorFusion.h
35348dc712f096a5b8be60d72a3d8f19a4985840 06-Mar-2014 Aravind Akella <aakella@google.com> am e7643e43: am 8ae7c02e: am ffac23b2: am 4b84704b: Ignore flush complete events when recording last value for a sensor.

* commit 'e7643e431abc2d1b42ab1d68913ec22d0b180554':
Ignore flush complete events when recording last value for a sensor.
8ae7c02e6ffb5533958d04ac0d8f4a8d77fdb734 06-Mar-2014 Aravind Akella <aakella@google.com> am ffac23b2: am 4b84704b: Ignore flush complete events when recording last value for a sensor.

* commit 'ffac23b210a96e769fd79ae912b44a185e7d69bd':
Ignore flush complete events when recording last value for a sensor.
4b84704b97300eff3ebfab85652e64d54149d205 04-Mar-2014 Aravind Akella <aakella@google.com> Ignore flush complete events when recording last value for a sensor.

Bug: 11822806
Change-Id: I1402d6684ed71ed413aef6a7be3aad945b331ec2
ensorService.cpp
ensorService.h
eefced119bc568d773b86c34cd8bc9d9574638f6 06-Feb-2014 Patrick Tjin <pattjin@google.com> Add uid to sensorservice's dump of active connections

Change-Id: I1c365157bcd28a93635dbde4a8d91c79750e03ae
ensorService.cpp
ebff73c37d5f1581702430f4a0348c160b99b57e 06-Dec-2013 Aravind Akella <aakella@google.com> Bug fix for SensorFusion data rate.

SensorFusion is always returning data at the slowest possible sampling rate (5 Hz). batch() is getting called twice, first time with the requested rate and second time with the slowest rate (which overwrites the requested rate). Fix batch call in SensorFusion::activate()

Bug: 12064319
Change-Id: If62f3e514233f69810336fd22b136b4395b667d3
ensorFusion.cpp
ensorFusion.h
88509090387eeb400771a786171866710cca230c 06-Dec-2013 Aravind Akella <aakella@google.com> Bug fix for SensorFusion data rate.

SensorFusion is always returning data at the slowest possible sampling rate (5 Hz). batch() is getting called twice, first time with the requested rate and second time with the slowest rate (which overwrites the requested rate). Fix batch call in SensorFusion::activate()

Bug: 12064319
Change-Id: If62f3e514233f69810336fd22b136b4395b667d3
ensorFusion.cpp
ensorFusion.h
3d0c7797acd4d3973a0a6c0513400f7909df0407 26-Oct-2013 Aravind Akella <aakella@google.com> am 245c4339: am 46417b84: Merge "Bug fixes for SensorService" into klp-dev

* commit '245c43395b9bb6502e0a4bcde4c60ad9541e5ce2':
Bug fixes for SensorService
b4099e77ec2bf8e9d4259ff30f0cb1d621deed91 16-Oct-2013 Aravind Akella <aakella@google.com> Bug fixes for SensorService

i) Emulate Flush for AOSP Fusion Sesnsors on newer HALs that support batching.
ii) Early return if there are no events for the current SensorEventConnection.

Bug: 11325707, 11376538

Change-Id: Idb856302463649a99d3d5d0c965bb06ba06b8e1d
ensorService.cpp
ensorService.h
e276feb813b06cbd7b89b37bd5361748dc43cfda 15-Oct-2013 Aravind Akella <aakella@google.com> am 487c7815: am 641a1868: Merge "SensorService Flush API bug fix." into klp-dev

* commit '487c7815d7d81570c4f2cf37ceddf10ec84e0c39':
SensorService Flush API bug fix.
c551eac5b16a53f872cbb692d3a0c81e39329725 15-Oct-2013 Aravind Akella <aakella@google.com> SensorService Flush API bug fix.

SensorService is dead locking itself when flush is called on older devices which don't support batching. mConnectionLock is acquired twice.

Change-Id: I5c25585bfb2b396df4b05826a9cba1da7997a3ee
ensorService.cpp
ensorService.h
4a1e00fb3abb4e0598c3fb9a35c04349f672c5f9 11-Oct-2013 Aravind Akella <aakella@google.com> am 1f1e5768: am 5d6aa951: Merge "Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection." into klp-dev

* commit '1f1e576840d5b36a091368abb6fe6610384b6449':
Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection.
701166d9f60a6e1149ff568aec0e03f3f3925292 08-Oct-2013 Aravind Akella <aakella@google.com> Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection.

Change-Id: I4ef2bec80406c517903ab9782dc9eaf3fa8b7f36
ensorService.cpp
ensorService.h
63ff1c644f785c78adbf65b9abf6b998cee2c7a1 25-Sep-2013 Mike Lockwood <lockwood@google.com> Cleanup Binder interface between sensorservice and BatteryStats

Change-Id: Ia507160a2534059afe93849c8efc8407a046b50e
atteryService.cpp
atteryService.h
fca43392b755b34c83c3abbfea216bafa9cd8171 17-Sep-2013 Aravind Akella <aakella@google.com> Merge "Fix for AOSP fusion sensors not handling multiple clients correctly." into klp-dev
bf72deea2f9982a09c6a95f94cfa1654bc8c684f 17-Sep-2013 Aravind Akella <aakella@google.com> Fix for AOSP fusion sensors not handling multiple clients correctly.

Bug: 10786801
Change-Id: I7b938bc583a303a30237c3d93b5accbf64cc90b5
orrectedGyroSensor.cpp
ravitySensor.cpp
inearAccelerationSensor.cpp
rientationSensor.cpp
otationVectorSensor.cpp
ensorFusion.cpp
4c8b951f8d6a121e758bd3905fa8987c77863790 06-Sep-2013 Aravind Akella <aakella@google.com> Sensor Batching Bug fixes.

i) SensorService dropping events. Increase SOCKET_BUFFER_SIZE in BitTube ctor.
ii) Call flush before every activate.
iii) Emulate flush for older devices. Add a trivial flush complete event when flush is called.

Bug: 10641596
Change-Id: I30d0f3948e830457143f16e157b6ad81908687ce
ensorService.cpp
ensorService.h
90ed3e8d7883d9c80fb8bf11b1c593bd8b2b39d0 10-Sep-2013 Mathias Agopian <mathias@google.com> fix a few problems with BitTube

BitTube used to send objects one at a time and didn't
handle errors properly.

We now send all the objects in one call, which means they
have to be read as a single batch as well. This changes the
BitTube API.

Update SensorService to the new API.

Also added an API to set the size of the send buffer.

Bug: 10641596
Change-Id: I77c70d35e351fdba0416fae4b7ca3b1d56272251
ensorService.cpp
724d91d778e71c8186399f4955de14b54812b3ed 27-Jun-2013 Aravind Akella <aakella@google.com> Sensor batching. Changes to the native code.

Bug: 10109508
Change-Id: I7333f3aac76125a8226a4c99c901fb904588df04
ensorDevice.cpp
ensorDevice.h
ensorFusion.cpp
ensorFusion.h
ensorInterface.cpp
ensorInterface.h
ensorService.cpp
ensorService.h
7ffaa7c60d51cc0eb731158de2ac3df9c50cc0b4 22-Jul-2013 Mathias Agopian <mathias@google.com> move services executables sources in their respective src folder

Change-Id: Ic65434a26c7fed1699abf0851fec6faa40e09c0c
ndroid.mk
ain_sensorservice.cpp
ee83397bb07ef6807ca3f4d691da7d4fd7d632f0 16-Jul-2013 Dianne Hackborn <hackbod@google.com> Fix issue #9860494: Waiting for service batteryinfo...

I changed the name of the service, this needs to follow.

Change-Id: Id8e346cee9d75cfe142cd43f6aea43302878b6dc
atteryService.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
ensorDevice.cpp
ensorDevice.h
ensorInterface.cpp
ensorInterface.h
ensorService.cpp
ensorService.h
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
ensorDevice.cpp
ensorDevice.h
ensorFusion.cpp
ensorFusion.h
ensorService.cpp
7438fd1a0132bc6de101e2a5f75040a119b6f29b 08-Jul-2013 Mathias Agopian <mathias@google.com> simplify some unnecessary complex code

getSensorType() ran in O(n) instead of O(1). fix that.

Change-Id: Idcf29e46fc34db32604a0d8e5a9156486783b74f
ensorService.cpp
ensorService.h
24f9bea8ebc752cee0047fce1c0cddbb431e886d 30-May-2013 Mathias Agopian <mathias@google.com> revert parts of dc5b63e40, which made gyro drift estimation unstable

initialize the system covariance matrix with non-zero
values for the gyro-bias part. this improves the initial
bias estimation speed significantly.

the initial covariance matrix should be small because the drift
changes slowly. the real problem is that we're not starting with
a good estimate of the drift, which this algorithm relies on.

so with this revert, it'll take a while for the drift to be estimated
but it won't be unstable.

Change-Id: Id5584bc114a2390d507643b2451b2650c1b90721
usion.cpp
2e2a560c4b60c24258e0eaadc1189eb9dcc1a0b4 30-May-2013 Mathias Agopian <mathias@google.com> use gyro timestamp directly in fusion

we used to estimate the gyro rate and deduce the period from that
but it turns out this is causing problems.

Bug: 5192288
Change-Id: I8ca826d0e11e488587bcaa1720de99e92b82f191
ensorFusion.cpp
ensorFusion.h
0319306670b0344da99efa606b6f172dde575a39 11-May-2013 Mathias Agopian <mathias@google.com> various fixes to the sensorservice

1) "google" sensors are now reporting AOSP as the vendor string
2) don't expose the system's sensor fusion if the HAL provides it
3) use uncalibrated gyro if availble for the system's sensor fusion

Change-Id: I25140436cdb29d55e39fd6fbbf8c44a410a83d5c
orrectedGyroSensor.cpp
ravitySensor.cpp
inearAccelerationSensor.cpp
rientationSensor.cpp
otationVectorSensor.cpp
ensorFusion.cpp
ensorService.cpp
ensorService.h
b6df7d0e4c2117ca476662bd52b6745b3d8a305f 09-May-2013 Mathias Agopian <mathias@google.com> make all libsurfaceflinger and libsensorservice symbols's visibility hidden

we only export the main entry-point.
this saves about 150KB.

Change-Id: I55eb2b6705386fdfa43860deb62f9cdd2a0982aa
ndroid.mk
ensorService.h
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
ensorDevice.cpp
ensorDevice.h
ensorInterface.cpp
ensorInterface.h
ensorService.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
ndroid.mk
ensorDevice.cpp
ensorDevice.h
ensorService.cpp
ensorService.h
8a0cb4ee0b6c351de82987efb472fa38dfaf608a 10-Apr-2013 Ying Wang <wangying@google.com> Add liblog

Bug: 8580410
Change-Id: I2ca4fa00dde0b574df3619134836bcb9315bd506
ndroid.mk
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
ndroid.mk
atteryService.cpp
atteryService.h
ensorDevice.cpp
ensorService.cpp
5307d17fe33fc26eeeacd6339a9fbfe96cf56873 19-Sep-2012 Mathias Agopian <mathias@google.com> track UID with connections

Change-Id: Id4865f3cd27a95acdbbfdff1f2bb4123f312a13b
ensorService.cpp
ensorService.h
a5b8e8bfa9f3416ce61ee08162fb139afde60488 19-Sep-2012 Mathias Agopian <mathias@google.com> fix a typo in SensorService

It shouldn't have caused much harm though.
Also log a warning when enabling a sensor
for a connection that is already enabled.

Change-Id: Ia4a052381e79183cd4cb1bedc7ba08e5228d7a38
ensorService.cpp
33264868ba0aaccb9d4b5e5a067a79a43633f6ec 29-Jun-2012 Mathias Agopian <mathias@google.com> add a way to enable debugging sensors at runtime

if debug.sensors is true, extra debugging
sensors are enabled and HAL provided sensor fusion
is disabled

Change-Id: I9b093424edb8c5363d1337237cdf6abe4ab266f9
ensorService.cpp
ensorService.h
bdf277355dcd647bd5d27b38fc107243a2247a02 29-Jun-2012 Mathias Agopian <mathias@google.com> improve sensor fusion

we now use a better quaternion propagation equation
this is especially beneficial for lower gyroscope rates

Change-Id: Ifbf273c8a092a8849ca4fe4b9bca30787e924018
usion.cpp
8f11b24a729c9779d75e09df27967091dc6e27c7 28-Jun-2012 Mathias Agopian <mathias@google.com> add some comments

Change-Id: Ia2e2c9531715fc2bd5b51c4dc58389e01abfe7e6
usion.cpp
dc5b63e40ee697324d39fe105d6f12c2bb031fc6 19-Jun-2012 Mathias Agopian <mathias@google.com> small improvement to sensor fusion

1) there was a typo when computing the system covariance
a term in dT^3 was ommitted; the impact was was very limited
because of how small this term is.

2) initialize the system covariance matrix with non-zero
values for the gyro-bias part. this improves the initial
bias estimation speed significantly.

3) added comments here and there

Change-Id: I4328c9cca73e089889d5e74b9fda99d7831762dc
usion.cpp
8dd4fe8dd37b740282b48b7867eec26fcf95e027 31-May-2012 Mathias Agopian <mathias@google.com> fix a potential buffer overflow in sensorservice

Bug: 6580560
Change-Id: Icf6cafbca09174515a964a7cd69d8cc589ad52de
ensorService.cpp
d1920ffede9e9bc107104ad94c291ca0f0f18bc3 30-May-2012 Mathias Agopian <mathias@google.com> Fix a stack corruption in sensorservice

Bug: 6576732
Change-Id: If0f2fb0d0c35b932fb77cd262e676042145b28f9
ensorService.cpp
a5c106a4f0afcf061728a1cb7c8c3b908728575d 20-Apr-2012 Mathias Agopian <mathias@google.com> fix a typo causing sensor event to be sorted in reverse chronological order

Change-Id: I041c64616d88ed1abb5efc90ed9eb0d9baeb4832
ensorService.cpp
907103bf186cfdd2ed9eb3b6c36de53ade7b16f6 03-Apr-2012 Mathias Agopian <mathias@google.com> usea socketpair instead of a pipe in BitTube

Bug: 6252830
Change-Id: I363cc7e9f73a5b7d8bbccee312c6d8938c84e99a
ensorService.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
ensorDevice.cpp
ensorService.cpp
3c20fbed7f3a916ced10f2ed5a272271b7d81ede 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

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

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
usion.cpp
ensorService.cpp
c7839e897646ece32894d3b7d1685c3880d949fe 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE

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

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
ensorInterface.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
ensorDevice.cpp
ensorFusion.cpp
ensorService.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
ensorDevice.cpp
ensorService.cpp
62569ecf526c7c01cb68ea461c6bbd3cb26057d2 08-Nov-2011 Mathias Agopian <mathias@google.com> SensorService now always clamps the requested rate

Requested rate will be clamped to the minimum rate and then
to 1ms. Previously we would return an error if a lower
rate was asked. The SensorManager documentation wording
allows this change.

We do this to get more consistancy between all the sensor
drivers / HALs

Change-Id: I199f76486fb76ccbb11e7280460a03726c767e84
ensorService.cpp
ae09d65f5b35cb51da2e1386a6dd7a52085f1325 02-Nov-2011 Mathias Agopian <mathias@google.com> fix an issue where SensorService could request an invalid sensor delay

When the app requests "fastest", the java layer encodes this as a
delay of 0. SensorService was passing this unchanged to the HAL.
However the HAL is required to reject delays lower that the
advertised lower delay.

Change-Id: I92be77acd3af62ffeb49e4b31e24ddcd203510e2
ensorService.cpp
b3989276d17f2b083bec67b695d1078fb86c6c53 21-Oct-2011 Mathias Agopian <mathias@google.com> Rename SensorChannel to BitTube
ensorService.cpp
ensorService.h
667102f6b072582fe497599e0b760f9fc94ceffa 15-Sep-2011 Mathias Agopian <mathias@google.com> improve sensorservice dumpsys

Change-Id: I8b53d5cab884c3aca16d95df5fbf288368d52e8b
usion.cpp
ensorDevice.cpp
ensorDevice.h
b9e152637a99548fdbab95e8de6a9d70bf9a6a47 13-Sep-2011 Mathias Agopian <mathias@google.com> improve sensorservice_test output

Change-Id: I6248b6f1f001fedec1bddcddfcd2b381d9bb4bf4
ests/sensorservicetest.cpp
a83f45c6c734084422f56733c25350625594bc00 25-Aug-2011 Mathias Agopian <mathias@google.com> Fix a few style issues and remove LOG spam

Change-Id: I6b6f75373f4ac28f98dea6a6f1c2567a6aa02243
usion.cpp
3e87d8dadefaf4b56bf15a15f1b53928d7a12cd2 19-Aug-2011 Michael Johnson <mpj@google.com> More error checks to avoid div by zero.

Change-Id: I18e5b72d02bf5420c14334d3a03f18fa40572d31
usion.cpp
ec.h
a01b4e237d57b74689576a3d486a2b2b903e74f4 18-Aug-2011 Max Braun <braun@google.com> Fix occasional fusion divergence by detecting it and resetting the fusion.

Change-Id: I51186e12fb9b2316e3671e3908174f4495df89a0
usion.cpp
usion.h
at.h
16bcf66afa333f8d3f3b835ed556e4fce8fa35bf 16-Aug-2011 Mathias Agopian <mathias@google.com> have the sensorsevice test print the delay of the first received event

Change-Id: I89d63122574c3f8790f00512c76d59b463acf18f
ests/sensorservicetest.cpp
16c3e4ae72e543f53a82f393dd287c11db8a7a80 21-Jul-2011 Mathias Agopian <mathias@google.com> silence sensorservice when it's dropping events

Change-Id: Ib05862e545aa780821aa605e45ab189f530494b7
ensorService.cpp
7b2b32f2e761a919deb6f82d978b379429f77b05 15-Jul-2011 Mathias Agopian <mathias@google.com> sensorservice: be more robust when there are no sensor h/w

Bug: 5030108
Change-Id: I45b85b3c492b9268cb0ae44d2e5fc8c708b6e66e
ensorFusion.cpp
ensorService.cpp
0be7a26220f786c068d6f5488d89ea4937c1df51 12-Jul-2011 Jeff Brown <jeffbrown@google.com> Remove the simulator target from all makefiles. Bug: 5010576

Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
ndroid.mk
1cb13461a8cf62e3ba634e5965332f2d284f6d42 28-Jun-2011 Mathias Agopian <mathias@google.com> PermissionCache caches permission checks

This is intended to absorb the cost of the IPC
to the permission controller.
Cached permission checks cost about 3us, while
full blown ones are two orders of magnitude slower.

CAVEAT: PermissionCache can only handle system
permissions safely for now, because the cache is
not purged upon global permission changes.

Change-Id: I8b8a5e71e191e3c01e8f792f253c379190eee62e
ensorService.cpp
ensorService.h
eaf2d0bfe37415ba1e42a97608823e8dbef53220 14-Jun-2011 Mathias Agopian <mathias@google.com> cleanup Kalman filter parameters, add/fix comments/units

Change-Id: Iedcae7164af8f7ea0e048ea7c72d0f35d16d739f
usion.cpp
010e42230135815907e76e5d7e5f30edf9e1799d 09-Jun-2011 Mathias Agopian <mathias@google.com> improve orientation sensor with gyro data

when we do our own sensor fusion, we also export an
improved orientation sensor and hide the HAL sensor.
The fused orientation sensor is much more precise, fast
and smooth.

Change-Id: I0ea843b47ad9d12f6b22cce51f8629852d423126
ensorService.cpp
ensorService.h
3301542828febc768e1df42892cfac4992c35474 28-May-2011 Mathias Agopian <mathias@google.com> use quaternions instead of MRPs

also use correct time propagation equation
disable the fused sensors when gyro is not present since
they were unusable in practice.

Change-Id: Iad797425784e67dc6c5690e97c71c583418cc5b5
ndroid.mk
orrectedGyroSensor.cpp
usion.cpp
usion.h
ravitySensor.cpp
ravitySensor.h
rientationSensor.cpp
otationVectorSensor.cpp
otationVectorSensor.h
econdOrderLowPassFilter.cpp
econdOrderLowPassFilter.h
ensorFusion.cpp
ensorFusion.h
ensorService.cpp
uat.h
ec.h
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
ndroid.mk
orrectedGyroSensor.cpp
orrectedGyroSensor.h
usion.cpp
usion.h
ravitySensor.cpp
ravitySensor.h
inearAccelerationSensor.cpp
inearAccelerationSensor.h
rientationSensor.cpp
rientationSensor.h
otationVectorSensor.cpp
otationVectorSensor.h
econdOrderLowPassFilter.cpp
econdOrderLowPassFilter.h
ensorDevice.cpp
ensorFusion.cpp
ensorFusion.h
ensorInterface.h
ensorService.cpp
at.h
raits.h
ec.h
a1b7db95b6ccf5be9d8dfaac1b8f45494813edc0 28-May-2011 Mathias Agopian <mathias@google.com> Fix a few issues with sensors reference-counting
ensorDevice.cpp
ensorService.cpp
ensorService.h
e04a63b3053270d64890f156869e7cf75c436fbb 20-May-2011 Mathias Agopian <mathias@google.com> Fix a crasher in SensorService

SensorService main thread wasn't java-enabled. however, in
some situations we end-up calling into the BatteryService from
that thread which causes a crash.

Change-Id: Iffba90e4c4b743dba84d62f1342001a9db31916d
ensorService.cpp
b1c14906ba87420d3a02e311ea65df1f03f7a3f9 14-Mar-2011 Iliyan Malchev <malchev@google.com> frameworks/base: remove LOCAL_PRELINK_MODULE

Change-Id: I54dd62ebef47e7690afa5a858f3cad941b135481
Signed-off-by: Iliyan Malchev <malchev@google.com>
ndroid.mk
3f2f8916112126fb1a93e4a4b4e2d4e01570aeee 11-Mar-2011 Mathias Agopian <mathias@google.com> fix [4025681] continuous sensors should not try to send an event as soon as they're activated

Make sure to send an event down only for sensors that report a value only on data
change. Other sensors, will naturally send an event when the next event is available.

Bug: 4025681
Change-Id: I6d444deda388b6bc9a33e3371e09d390f1566ec5
ensorService.cpp
db5b4bce9e65ec9c2c7762b601297e4abadbc22a 03-Feb-2011 Mathias Agopian <mathias@google.com> fix [3421350] Killing a game that uses the accelerometer renders the device unable to sleep

when an app dies, make sure to disable all sensors that process
is connected to, regardless of wether this was the LAST connection
to this sensor.

Change-Id: I9c72b1792eee03815304674d5c2f25b5270e4748
ensorService.cpp
ensorService.h
2cf098846c83bab82272f107ba110f7c47df1763 19-Jan-2011 Mathias Agopian <mathias@google.com> fix [3369027] Sensor.TYPE_ROTATION_VECTOR is unstable and returns NaNs when running slowly

The cut-off frequency of the lowpass filter was too high
for the sampling rate used by DELAY_NORMAL.

Now we use the same filters used for the gravity vector
(cascaded biquad at 1.5 Hz)

Change-Id: I319dc4f449a3abd553d61b196a9ddcf7782f912d
otationVectorSensor.cpp
otationVectorSensor.h
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
ravitySensor.cpp
ravitySensor.h
inearAccelerationSensor.cpp
inearAccelerationSensor.h
otationVectorSensor.cpp
otationVectorSensor.h
ensorDevice.cpp
ensorDevice.h
ensorInterface.cpp
ensorInterface.h
87c9dbb728febe9ce035874796c58f308043879d 12-Nov-2010 Mathias Agopian <mathias@google.com> Uses 4-th order low-pass for extracting gravity.

Most accelerometers have 8-bits accuracy so we beed to
reject 48dB in thestop-band, which requires a 4-th order
filter at the cut-off frequency we're using.

Change-Id: Ic00421d38d751641f86b1f3ad7663e6b44a91198
ravitySensor.cpp
ravitySensor.h
econdOrderLowPassFilter.cpp
econdOrderLowPassFilter.h
ddf1ceb647d029febfd007b389cd92c84668a03c 23-Nov-2010 Mathias Agopian <mathias@google.com> allow rotation-vector to have 4 components

- upadte documentation for rotation vector
- update method dealing with rotation vector to deal with 4 components
- virtual rotation-vector sensor reports all four components
- improve SensorManager documentation layout

Whent he 4-th component of the rotation-vector is present, we can save
a square-root when computing the quaternion or rotation matrix from it.

Change-Id: Ia84d278dd5f0909fab1c5ba050f8df2679e2c7c8
otationVectorSensor.cpp
5c6d7ff3e643d0fb4b46d81a3a4e6edaba779edd 22-Nov-2010 Mathias Agopian <mathias@google.com> don't attempt to normalize the rotation vector

indeed, by construction of the rotation matrix, it is
guaranteed to have a length of 1.

moreover, the normalization code was missing a square-root,
fortunatelly, since the length is 1, this didn't cause any
damage (since sqrt(1) = 1).

Change-Id: I9facd668caaf5bb3bfccb139ab872f2bb2066365
otationVectorSensor.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
ndroid.mk
ravitySensor.cpp
ravitySensor.h
inearAccelerationSensor.cpp
inearAccelerationSensor.h
otationVectorSensor.cpp
otationVectorSensor.h
econdOrderLowPassFilter.cpp
econdOrderLowPassFilter.h
ensorDevice.cpp
ensorDevice.h
ensorInterface.cpp
ensorInterface.h
ensorService.cpp
ensorService.h
71d7a5c289c6ef6b5fc86dd4784a075ca6470e38 15-Nov-2010 Mathias Agopian <mathias@google.com> Fix a race condition in sensormanager

the per-connection state assumed the main sensorservice
lock was held during access. This is however not true while
pre-processing the events just before sending them to clients.
Therefore, there was a small window during which this state
could be modified while being used.

we now have an internal lock that protects this state.

Change-Id: I594680f20f09d6a4f1f38f093a1d3f650dcef1be
ensorService.cpp
ensorService.h
94e8f6813f3fb2beaa9bcbfb1ad9b4ae2eb46949 11-Nov-2010 Mathias Agopian <mathias@google.com> record the last event received regardless of having clients or not

We only recorded the last received event (which is needed when a sensor
is activated on a connection) when there was some connection active.
This should fix an issue where sometimes the light sensor doesn't
return an event whent activated.

we also didn't need to hold the main lock while dispatching events
to clients.

Change-Id: I6c6386c040051ce205e3c0516c678e0603fa45e1
ensorService.cpp
ensorService.h
24d72350f321c17b0bfe1ef3fd52d4070a1c02c3 06-Nov-2010 Mathias Agopian <mathias@google.com> improve sensorservice dumpsys and increase the max sensor rate to 1 ms (1000Hz)

the increased maximum rate is needed for proper gyro integration, current gyro
parts can sample at up to 800Hz

Change-Id: Ide75f6d5bc7a0fdafeb2dafd72db39e7afb9e794
ensorService.cpp
ensorService.h
ests/sensorservicetest.cpp
1e0b1e8491e5f6dc59faabe70cbfa942853150e0 14-Sep-2010 Jeff Brown <jeffbrown@google.com> Replace epoll() with poll() and rename PollLoop to Looper.

As part of this change, consolidated and cleaned up the Looper API so
that there are fewer distinctions between the NDK and non-NDK declarations
(no need for two callback types, etc.).

Removed the dependence on specific constants from sys/poll.h such as
POLLIN. Instead looper.h defines events like LOOPER_EVENT_INPUT for
the events that it supports. That should help make any future
under-the-hood implementation changes easier.

Fixed a couple of compiler warnings along the way.

Change-Id: I449a7ec780bf061bdd325452f823673e2b39b6ae
ensorService.cpp
ests/sensorservicetest.cpp
c4a930d1d5a432a1f302763ac55460d6e83fe7e0 23-Jul-2010 Mathias Agopian <mathias@google.com> Report sensor events to BatteryStats service

Change-Id: I9b83aa709887aa658bc474391573f2d45b6c4eb2
ensorService.cpp
3560fb24b668675627934356f210d84d19bf4e56 23-Jul-2010 Mathias Agopian <mathias@google.com> SensorService handles last known state properly

SensorService now correctly sends the last known
state of a sensor as soon as a new connection is made.
This fixes the issue where, for instance, an application
could wait a long time before getting the light or proximity
sensor initial state.

Change-Id: Ic41392f3626e26c4f15746c7e17c7ecd44bbb10b
ensorService.cpp
ensorService.h
cf51001dbf28e9885fcacd4048902f1c75768fe9 23-Jul-2010 Mathias Agopian <mathias@google.com> filter sensor event by connection

we now don't send events down to a connection that has not
registered for this event.

Change-Id: I3fe507974d3e99293749bfec2ef871e8a0ee9600
ensorService.cpp
ensorService.h
7c1c531872a95051cb11ec829e3daf890d9bb58a 22-Jul-2010 Mathias Agopian <mathias@google.com> propagate sensor event rate properly to the sensor HAL

Change-Id: I1abe4c0fcce423caab79208353fded4d57398227
ensorService.cpp
ensorService.h
1cd700015318727d6d42236ab6274f1949fb08ba 22-Jul-2010 Mathias Agopian <mathias@google.com> propagate sensor event rate properly

Change-Id: I32e67d30e4295285a6827956cc8161b2025d70bc
ensorService.cpp
50df2959e58fc7408f98d11d77c8428397dca445 20-Jul-2010 Mathias Agopian <mathias@google.com> SensorService doesn't crash if correct HAL is not present

Change-Id: I83700b1a1b43390f5830e1056572bfb16e58e8e4
ensorService.cpp
ensorService.h
5d2707214dfb97bd8dfcc6620be36841d3c82420 20-Jul-2010 Mathias Agopian <mathias@google.com> Better dumpsys logs

Change-Id: Iae65a8547ee5815cc4c3b74d2c9ef17bed7f565d
ensorService.cpp
ensorService.h
451beee076cac09f817abae78a990dea108a9482 20-Jul-2010 Mathias Agopian <mathias@google.com> Added partial support for repporting sensor activity to IBatteryStats

Change-Id: I2af319d89e49b0f2349ec9d8b0fccac80e9bc047
ensorService.cpp
fc32881fcc68640d008c7515cdd1bcd866f72cd5 15-Jul-2010 Mathias Agopian <mathias@google.com> new SensorService

remove old sensor service and implement SensorManager
on top of the new (native) SensorManger API.

Change-Id: Iddb77d498755da3e11646473a44d651f12f40281
ndroid.mk
ensorService.cpp
ensorService.h
ests/Android.mk
ests/sensorservicetest.cpp