Commit Graph

124 Commits

Author SHA1 Message Date
Aravind Akella
0b6acb2231 Add version number to SensorService dump output.
Change-Id: I64f9482ade523ec3fafe14bff14db7196e32413f
2014-10-19 20:30:58 +00:00
Aravind Akella
7830ef3dd0 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
2014-10-07 21:20:12 +00:00
Aravind Akella
8a96955c8e 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
2014-10-02 18:59:56 -07:00
Aravind Akella
deb71b2812 Merge "Fix a possible SensorService deadlock." into lmp-dev 2014-09-29 00:49:26 +00:00
Aravind Akella
e148bc29c2 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
2014-09-28 21:26:49 +00:00
Aravind Akella
678f4fce90 Revert "Fix sockfd leakage in SensorService. Remove sockfd from Looper when the connection is removed from mActiveConnections."
This reverts commit 5105960d49.

Change-Id: I4d39ded2e50ef8a8e0aac27e438876203385a1f0
2014-09-27 02:06:32 +00:00
Aravind Akella
5105960d49 Fix sockfd leakage in SensorService. Remove sockfd from Looper
when the connection is removed from mActiveConnections.

Bug: 17472228
Change-Id: Iaabe0968bd2104ef961ff5e8659bf91712e2e1db
2014-09-23 23:46:22 +00:00
Aravind Akella
0ec2066e47 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
2014-09-15 20:32:21 +00:00
Aravind Akella
8493b79e1c 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
2014-09-10 18:24:18 -07:00
Aravind Akella
9e3adfcebf 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
2014-09-03 18:24:05 -07:00
Aravind Akella
5466c3d20d 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
2014-08-22 17:09:23 -07:00
Aravind Akella
e74baf6ca7 SensorService fixes.
i) Add more debug stats (acks needed, acks received)
  ii) Comment out write failure message.

Change-Id: Iac892a66530849a2dd023d6f5628cd070a79537d
2014-08-21 12:28:35 -07:00
Aravind Akella
6c2664ae34 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
2014-08-19 11:18:25 -07:00
Aravind Akella
56ae42613c 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
2014-07-24 17:23:01 -07:00
Sean Wan
7869e224aa CW on L: Fix a SIGSEGV crash in sensor service.
This is to fix b/16189080.

BUG: 16189080
Change-Id: I78d44e82f797c0808891acde609040c46745a0bb
2014-07-15 11:10:44 -07:00
Aravind Akella
adb65d9add Merge "Surface reportingMode for Sensors." 2014-06-12 03:30:50 +00:00
Aravind Akella
0e025c5af3 Surface reportingMode for Sensors.
Change-Id: Iac8dd3408c90eb7d285a2e8043131fab3a7e58fa
2014-06-12 14:49:41 -07:00
Mark Salyzyn
c46422ed2b am 20914f0a: am a4e345e1: Merge "sensorservice: 64-bit compile issues"
* commit '20914f0ad3691d977f61f1d4b92b49535e8f6f33':
  sensorservice: 64-bit compile issues
2014-06-12 16:13:39 +00:00
Mark Salyzyn
20914f0ad3 am a4e345e1: Merge "sensorservice: 64-bit compile issues"
* commit 'a4e345e169fd9101011e358abdfb9308bc065bdb':
  sensorservice: 64-bit compile issues
2014-06-12 16:09:59 +00:00
Mark Salyzyn
db45861ff4 sensorservice: 64-bit compile issues
Change-Id: Ied7b779f39e71d041791729f7355b052b63903c5
2014-06-10 14:50:02 -07:00
Aravind Akella
d9441e4c27 Surface maxDelay and isWakeUpSensor flag in Sensor.java.
Change-Id: Idd1e9045190beeca87b086b272e8cbf0bed05bae
2014-05-23 18:58:01 -07:00
Aravind Akella
9a844cf78f 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
2014-04-23 14:38:56 -07:00
Aravind Akella
93b84e39e6 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
2014-04-11 19:40:33 +00:00
Aravind Akella
ef89f7638c 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
2014-04-11 19:34:53 +00:00
Aravind Akella
700180487f Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors
This reverts commit 4369a4ebd5.

Change-Id: Ifa8619cc6873470a07a987763d818d78d4232610
2014-04-11 00:06:06 +00:00
Etienne Le Grand
75b332037f 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"
2014-04-05 09:06:00 +00:00
Etienne Le Grand
30d6fd6b28 Revert "Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors"
This reverts commit c57a019e11.

Change-Id: I3540565bc3e56a32cf3b176a29216cf68bb763b2
(cherry picked from commit 4369a4ebd5)
2014-04-05 06:13:41 +00:00
Etienne Le Grand
4369a4ebd5 Revert "Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors"
This reverts commit c57a019e11.

Change-Id: I3540565bc3e56a32cf3b176a29216cf68bb763b2
2014-04-05 05:02:22 +00:00
Etienne Le Grand
33458f72e1 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
2014-04-05 03:53:51 +00:00
Etienne Le Grand
00f4dde1aa 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
2014-04-05 01:52:28 +00:00
Etienne Le Grand
c57a019e11 Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors
Change-Id: If0f3dbdb5d2e9378e1fed4614baee4e750d0c850
2014-04-04 16:31:09 -07:00
Mark Salyzyn
c45011f272 am cdbf28b3: Merge "native frameworks: 64-bit compile issues"
* commit 'cdbf28b3f7f5327f4cb0eb95b8326bf4c24c87ba':
  native frameworks: 64-bit compile issues
2014-03-13 23:18:43 +00:00
Mark Salyzyn
993146092f am d4dabf87: am cdbf28b3: Merge "native frameworks: 64-bit compile issues"
* commit 'd4dabf872ac0a12e12aebae9032f7d62762c2aeb':
  native frameworks: 64-bit compile issues
2014-03-13 23:12:09 +00:00
Mark Salyzyn
d4dabf872a am cdbf28b3: Merge "native frameworks: 64-bit compile issues"
* commit 'cdbf28b3f7f5327f4cb0eb95b8326bf4c24c87ba':
  native frameworks: 64-bit compile issues
2014-03-13 15:26:10 +00:00
Mark Salyzyn
92dc3fc52c native frameworks: 64-bit compile issues
- Fix format (print/scanf)
- Suppress unused argument warning messages (bonus)

Change-Id: I05c7724d2aba6da1e82a86000e11f3a8fef4e728
2014-03-12 13:12:44 -07:00
Aravind Akella
19d6481956 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 8850909038)
2014-03-06 19:07:18 +00:00
Aravind Akella
35348dc712 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.
2014-03-06 02:57:23 +00:00
Aravind Akella
8ae7c02e6f 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.
2014-03-06 02:24:29 +00:00
Aravind Akella
4b84704b97 Ignore flush complete events when recording last value for a sensor.
Bug: 11822806
Change-Id: I1402d6684ed71ed413aef6a7be3aad945b331ec2
2014-03-06 00:48:59 +00:00
Patrick Tjin
eefced119b Add uid to sensorservice's dump of active connections
Change-Id: I1c365157bcd28a93635dbde4a8d91c79750e03ae
2014-02-05 15:06:03 -08:00
Aravind Akella
ebff73c37d 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
2014-01-31 22:33:51 +00:00
Aravind Akella
8850909038 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
2013-12-10 01:57:12 +00:00
Aravind Akella
3d0c7797ac am 245c4339: am 46417b84: Merge "Bug fixes for SensorService" into klp-dev
* commit '245c43395b9bb6502e0a4bcde4c60ad9541e5ce2':
  Bug fixes for SensorService
2013-10-25 18:12:58 -07:00
Aravind Akella
b4099e77ec 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
2013-10-25 13:58:58 -07:00
Aravind Akella
e276feb813 am 487c7815: am 641a1868: Merge "SensorService Flush API bug fix." into klp-dev
* commit '487c7815d7d81570c4f2cf37ceddf10ec84e0c39':
  SensorService Flush API bug fix.
2013-10-15 10:07:23 -07:00
Aravind Akella
c551eac5b1 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
2013-10-14 17:09:19 -07:00
Aravind Akella
4a1e00fb3a 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.
2013-10-10 19:26:34 -07:00
Aravind Akella
701166d9f6 Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection.
Change-Id: I4ef2bec80406c517903ab9782dc9eaf3fa8b7f36
2013-10-09 17:26:01 -07:00
Mike Lockwood
63ff1c644f Cleanup Binder interface between sensorservice and BatteryStats
Change-Id: Ia507160a2534059afe93849c8efc8407a046b50e
2013-09-25 09:28:41 -07:00
Aravind Akella
fca43392b7 Merge "Fix for AOSP fusion sensors not handling multiple clients correctly." into klp-dev 2013-09-17 18:17:50 +00:00