Is anyone else seeing the following bug on M preview 3?
Inducing a proximity sensor event right after registering a proximity listener with the sensor manager will cause the sensor to becomes "frozen". I.e. if you register a proximity sensor listener with sensor manager while your hand is on the proximity sensor, and very quickly after this you remove your hand, the proximity sensor will not report that there is now nothing in proximity, and will remain with a status of in proximity until the listener is unregistered and re-registered. This can happen across different apps. I.e. if you reproduce this in one app, all apps will report a "frozen" proximity value. I first noticed this in my app which happens to register and un-register the proximity listener on a regular basis, providing a higher than usual chance of this happening.
Which version of the SDK are you using?
23
Which Android build are you using? (e.g. MPA44G)
MPA44I
What device are you using?
Nexus 5
What steps will reproduce the problem? (Please provide the minimal reproducible test case.)
1) This is fairly easy to reproduce with an app available on the market. Download the app "Sensor Kinetics" (SK). It reports various different sensors and their readings. Here is the link: https://play.google.com/store/apps/details?id=com.innoventions.sensorkinetics
2) Open SK and find the proximity sensor reading. Note what the reading is when something is covering the proximity sensor (ex. 0.0cm) and when nothing is covering the proximity sensor (ex. 5.0cm). Leave SK open with the proximity reading in view.
3) Turn the screen off.
4) Turn the screen on (should be at the lock screen at this point).
5) Cover the proximity sensor.
6) Unlock the screen.
7) As soon as the phone is unlocked, very quickly uncover the proximity sensor.
8) Repeat steps 3-7 as the timing for step 7 is tricky to get right (try at least 10 times).
What is the expected output?
The expected output is for the proximity reading to go from in-proximity to out-of-proximity (ex. 0.0cm to 5.0cm) once the proximity sensor is quickly uncovered in step 7 above.
What do you see instead?
The proximity reading remains on in-proximity (ex. 0.0cm) from here on out, no matter if the proximity sensor is covered, uncovered, or re-covered. The reading is only reset once the screen is turned off again (the proximity listener is un-registered at this point).
I have logged a bug report on Google's group below as well. Please star the issue if you believe it is affecting your app.
https://code.google.com/p/android-developer-preview/issues/detail?id=3230
This seems to have been fixed with Android 6.0.1.