I have an application that demonstrates two different behaviors, possibly related to Android 2.2 and Android 2.1.
The application uses a proximity sensor to determine when the phone is "near" the ear. If a "close" state is detected, I get the application window and set LayoutParams to FLAG_NOT_TOUCHABLE and FLAG_FULLSCREEN. In general, this has the desired effect of preventing the ear from accidentally touching the screen from causing any unwanted action. However...
With my Android V2.2 phones: If I'm in the process of moving apart, the status is Bar, while the proximity sensor detects a โcloseโ state, the status bar closes immediately, and everything is fine.
With Android V2.1 phones: if I have a status bar, partially open, โcloseโ state, and then at the same time (more or less) return to โdistantโ, when the status bar is released, the status bar remains partially open. Meanwhile, part of my application remains visible, but not tangible. I can simulate this on 2.1 phones, but I canโt do this on all with 2.2 phones.
My questions:
1) Does anyone know why this behavior is different, and if it is really related for different versions of Android?
2) Is there a way that an application (for example, mine!) Can detect if the status of the Bar opens or opens in the process of pushing and tells it to close?
Thanks for any help you can offer.
source
share