I didn't use ACQUIRE_CAUSES_WAKEUP flag. I added the flag to the full wake lock and everything worked as expected. Thanks a lot.
Monroe On 10月8日, 上午6時23分, hackbod <[EMAIL PROTECTED]> wrote: > Did you use ACQUIRE_CAUSES_WAKEUP, as described in the java doc? > > http://code.google.com/android/reference/android/os/PowerManager.html > > On Oct 7, 6:48 am, Monroe <[EMAIL PROTECTED]> wrote: > > > > > As I mentioned in my previous post, my program did acquire a partial > > wake lock. > > This resulted in the kernel wake lock PowerManagerSerivce stop being > > released. > > (I observed this by inserting some printks in the kernel sysfs entry.) > > After a short idle period the screen turned off but the CPU is still > > alive. > > (I observed this by having the program print a log message every few > > seconds.) > > I also inserted a log message after the program acquires the full wake > > lock. > > I can see this message being printed in the IDE but the screen is > > still black. > > > Monroe > > > On 10月7日, 上午6時41分, hackbod <[EMAIL PROTECTED]> wrote: > > > > When the device turns off, and there are no partial wake locks held, > > > the entire CPU is shut off, so your code simply will not be able to > > > run until some external event wakes up the CPU again. > > > > As far as reading key events or the countdown timer, there is no way > > > for applications to do this. You can get debug info from the power > > > manager service with "adb shell dumpsys power". > > > > On Oct 5, 8:21 pm, Monroe <[EMAIL PROTECTED]> wrote: > > > > > Thanks Gershon for sharing this information. > > > > I've been testing the 0.9 and 1.0 SDK and got the same results as you. > > > > > I also did one extra wake lock test and the result differs from my > > > > prediction. > > > > I wrote a Java program that creates two locks, one partial and one > > > > full. > > > > The program first acquires the partial wake lock, then waits for a > > > > period of time (long enough so that the screen turns off). > > > > After that it acquires the full lock it created. > > > > I was expecting the screen to come back on after the full lock is > > > > acquired, but the it didn't. > > > > Perhaps I'm not using the Java APIs correctly? > > > > > Monroe > > > > > On 10月6日, 上午3時10分, Gershon <[EMAIL PROTECTED]> wrote: > > > > > > I have a question for Joe and a report for Monroe. > > > > > > First the report. For Android 0.9 beta and 1.0, I have gotten the > > > > > simulator to generally shut off (blank screen) by clicking off Dev > > > > > Tools->Development Settings->Keep screen on while plugged in. After a > > > > > minute of no user activity the screen blanks. You then have to click a > > > > > button to get the lock screen, and then click the Menu button to > > > > > release the lock screen. I have tested that using the Java code > > > > > snippet in android.os.PowerManager to acquire a full lock or a > > > > > SCREEN_DIM_WAKE_LOCK prevents the screen blanking. > > > > > > Now for Joe: Is there any way in user Java code to be able to read the > > > > > KeyEvent or countdown timer to know how long ago the user pressed a > > > > > key or did something under all activities? > > > > > > --Gershon > > > > > > On Aug 10, 12:27 am, Joe Onorato <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, I did most of the user space power management functions in > > > > > > Android. > > > > > > > The big thing that you didn't notice is that there are two classes > > > > > > ofwakelocks -- kernel and user space. All of the user space > > > > > > partialwakelocks funnel through one partialwakelock, called > > > > > > PowerManagerService. The fullwakelocks and user activity countdown > > > > > > timer are all implemented in java and call on to /sys/android_power/ > > > > > > request_state, which turns the screen on and off (and implicitly, > > > > > > also > > > > > > keeps the CPU on). The kernel still has /sys/android_power/ > > > > > > acquire_full_wake_lock, but it is not used. > > > > > > > By the time the KeyEventwakelockis released, someone has either > > > > > > called userActivity on the power manager, which resets the countdown > > > > > > timer, or they haven't, which means that the device should notwake > > > > > > up. > > > > > > > -joe- 隱藏被引用文字 - > > > > > > - 顯示被引用文字 -- 隱藏被引用文字 - > > - 顯示被引用文字 - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Internals" group. To post to this group, send email to android-internals@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-internals?hl=en -~----------~----~----~----~------~----~------~--~---