Re: [android-developers] Setting screen on/off

2012-06-02 Thread Mathias Lin
Why does the SDK not allow that for third party apps? Also, why does 
turning the brightness to 0 entirely turns the screen off and lock it? Why 
is there no way to just turn the screen off (entirely dim) without locking 
it, and also keep it listening to touch events?
(So many limitations in the SDK, it forces the developers to use inofficial 
method calls, if there are any for the specific case.)


On Friday, 8 April 2011 15:34:49 UTC+8, Dianne Hackborn wrote:

 Doing this kind of stuff from third party apps isn't really supported. 
  You may be able to hack up a somewhat working solution, but I don't think 
 you can actually implement a fully working robust solution with the SDK 
 APIs.

 On Fri, Apr 8, 2011 at 12:24 AM, luiX_ lui...@gmail.com wrote:

 Hi,

 I'm trying to develop something similar to the proximity event of the 
 dialer during a call, this is: when something is near the proxmity sensor 
 turn off the screen and when there's not power it on again.

 I've had no problem making the sensor's events work, that was easy, but 
 I'm having a lot of trouble trying to set the screen on/off, this is what 
 I've got this far:

- I can power the screen off by setting brightness to zero (using the 
WindowManager.LayoutParams), the problem is that it locks the screen 
instead of just setting it off. 
- I've tried using a PowerManager.WakeLock to several things:
   - using as flag PARTIAL_WAKE_LOCK which should keep the cpu 
  running but allowing the screen and keyboard to go off (but not 
 actually 
  setting them off at the moment, it waits for the configured 
 timeout) 
  - using as flag SCREEN_DIM_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP 
  and then setting the screen off using the brightness trick but I 
 still do 
  have to manually press the button to bring the screen up.
   
 Now, I'm playing with some flags in the Window, but still nothing, I 
 always do have to bring the screen back by pressing the power button.

 Any ideas/snippets to make this work like when you're inside a call in 
 Android's default dialer?

 Thanks! :)

 -- 
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 -- 
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Setting screen on/off

2012-01-26 Thread Rick Alther
I'm running into the exact same problem.  Is the the answer still the same 
at this time - no support for it in the SDK?  What about an NDK solution?

Thanks,
- Rick Alther

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Setting screen on/off

2011-04-08 Thread luiX_
Hi,

I'm trying to develop something similar to the proximity event of the dialer
during a call, this is: when something is near the proxmity sensor turn off
the screen and when there's not power it on again.

I've had no problem making the sensor's events work, that was easy, but I'm
having a lot of trouble trying to set the screen on/off, this is what I've
got this far:

   - I can power the screen off by setting brightness to zero (using the
   WindowManager.LayoutParams), the problem is that it locks the screen instead
   of just setting it off.
   - I've tried using a PowerManager.WakeLock to several things:
  - using as flag PARTIAL_WAKE_LOCK which should keep the cpu running
 but allowing the screen and keyboard to go off (but not
actually setting
 them off at the moment, it waits for the configured timeout)
 - using as flag SCREEN_DIM_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP and
 then setting the screen off using the brightness trick but
I still do have
 to manually press the button to bring the screen up.

Now, I'm playing with some flags in the Window, but still nothing, I always
do have to bring the screen back by pressing the power button.

Any ideas/snippets to make this work like when you're inside a call in
Android's default dialer?

Thanks! :)

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Setting screen on/off

2011-04-08 Thread Dianne Hackborn
Doing this kind of stuff from third party apps isn't really supported.  You
may be able to hack up a somewhat working solution, but I don't think you
can actually implement a fully working robust solution with the SDK APIs.

On Fri, Apr 8, 2011 at 12:24 AM, luiX_ lui...@gmail.com wrote:

 Hi,

 I'm trying to develop something similar to the proximity event of the
 dialer during a call, this is: when something is near the proxmity sensor
 turn off the screen and when there's not power it on again.

 I've had no problem making the sensor's events work, that was easy, but I'm
 having a lot of trouble trying to set the screen on/off, this is what I've
 got this far:

- I can power the screen off by setting brightness to zero (using the
WindowManager.LayoutParams), the problem is that it locks the screen 
 instead
of just setting it off.
- I've tried using a PowerManager.WakeLock to several things:
   - using as flag PARTIAL_WAKE_LOCK which should keep the cpu running
  but allowing the screen and keyboard to go off (but not actually 
 setting
  them off at the moment, it waits for the configured timeout)
  - using as flag SCREEN_DIM_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP and
  then setting the screen off using the brightness trick but I still 
 do have
  to manually press the button to bring the screen up.

 Now, I'm playing with some flags in the Window, but still nothing, I always
 do have to bring the screen back by pressing the power button.

 Any ideas/snippets to make this work like when you're inside a call in
 Android's default dialer?

 Thanks! :)

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en