Hi, i'm trying to make a workaround for the inCall problem I was having.
Now, I'm trying to just set a low brightness and disable touch events,
something like this:
@Override
public void onSensorChanged(SensorEvent event) {
Log.w(LOG_TAG, "onSensorChanged: " + event.values[0]);
if (event.values[0] == 0.0) {
Window mywindow = getWindow();
WindowManager.LayoutParams lp = mywindow.getAttributes();
lp.screenBrightness = 0.1f;
mywindow.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
mywindow.setAttributes(lp);
Log.w(LOG_TAG, "Screen goes off!");
} else {
Window mywindow = getWindow();
WindowManager.LayoutParams lp = mywindow.getAttributes();
lp.screenBrightness = this.defBrightness;
mywindow.clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
mywindow.setAttributes(lp);
Log.w(LOG_TAG, "Screen goes on!");
}
}
Now, my problem is that, when screen touch is disabled and I start touching
it I got an ANR exception due to the keyDispatching timeOut.
Any idea on how can I avoid this? I tried overriding the method onTouchEvent
with no luck :(
Thanks!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en