What is the stack reported for your app ANR?  (You can find it in
/data/anr/traces.txt).

It's possible this is just a platform bug.  Changing a window like this is
probably not something anyone else has done.  If it is a platform problem it
could also vary significantly across platform releases -- most platform
versions have had some significant work on event dispatching, especially 2.3
which completely rewrote it.

On Fri, Apr 8, 2011 at 5:44 AM, luiX_ <[email protected]> wrote:

> 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




-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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

Reply via email to