pombreda / enh

Automatically exported from code.google.com/p/enh
0 stars 0 forks source link

[dalvik-explorer] sensors fluctuate wildly; report data in wrong units #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run Dalvik Explorer (assuming issue 38 has been fixed)
2. Choose "Sensors" from the main menu

What is the expected output? What do you see instead?
Would expect each sensor to keep reporting data in the same units consistently, 
in a unit that makes sense for that sensor.  (e. g. "hPa" for the Barometer 
Sensor)  Instead, the units for each sensor change from one moment to the next, 
and they are usually not a unit that makes sense for each sensor.  (The 
relative humidity sensor might be reporting "lux" one moment, and "radian/s" 
the next moment.)

What version of the product are you using? On what operating system?
Using dalvik-explorer off the subversion trunk.  Phone is Galaxy S4 with 
Android 4.2.2.  Host is Ubuntu 12.04.

Please provide any additional information below.
I believe the problem is that the SensorEvent is not valid after returning from 
the onSensorChanged method.  It looks like Android is reusing sensor events, 
instead of allocating a new one each time.  So, the SensorEvents squirreled 
away in mData get overwritten with new data from a different sensor before 
SensorItem can display them.  I put together a patch which copies the data out 
of the SensorEvent before returning from onSensorChanges, and the copy is what 
is stored in mData.  This seems to fix the problem.

Original issue reported on code.google.com by ppell...@speakeasy.net on 31 Aug 2013 at 10:49

Attachments:

GoogleCodeExporter commented 9 years ago
thanks. patch applied as r704.

Original comment by elliott....@gmail.com on 22 Sep 2013 at 7:07