One additional note regarding the usage of the goToSleep method. In my opinion it is very dangerous to offer this API to "normal" application. If applications could easily use this API they could put your device to sleep whenever they want. Especially when you download a 3rd party application the user would not be aware of that the application uses the API. Which means you could install application which intentionally want to harm your device.
-- Roman Baumgaertner Sr. SW Engineer-OSDC ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 27, 8:57 pm, Sansiro <wangjiangfeng0...@gmail.com> wrote: > I launch the jar with "adb shell sh /sys/bin/myjar" > > On Jul 28, 11:39 am, Dianne Hackborn <hack...@android.com> wrote: > > > If you are launching from an application, it counts as that application. > > > On Mon, Jul 27, 2009 at 8:33 PM, Sansiro <wangjiangfeng0...@gmail.com>wrote: > > > > Dear Hackborn: > > > The Log show nothing. > > > The program I wrote is not an application with activity, more like a > > > system process. > > > I put my code to the android source code directory and then make the > > > android to get my jar file. > > > Then I push my jar file to emulator's system directory, and launch > > > it . > > > This can make my code do something special, but not include force > > > emulator to sleep. > > > > On Jul 28, 10:44 am, Dianne Hackborn <hack...@android.com> wrote: > > > > Are you looking in the log for error messages? Note that applications > > > > shouldn't be able to generate key events except when they will be > > > > handled > > > by > > > > the app itself, and I don't believe applications can get permission to > > > force > > > > the device to go to sleep (though I am not sure about that). > > > > > On Mon, Jul 27, 2009 at 6:56 PM, Sansiro <wangjiangfeng0...@gmail.com > > > >wrote: > > > > > > I'm puzzled in this problem for days. > > > > > I have tried to learn the source code to find out how goToSleep() > > > > > method work. > > > > > It ended in the file /framework/base/server/ > > > > > PowerManagerService.java.What it does in goToSleep() method is to > > > > > clear all the wake lock in current service.After all the wake lock > > > > > being cleared, device will go to sleep automatically. > > > > > But how to clear all the wake lock? Google provide this with C, but > > > > > it's too difficult for me to read them. > > > > > > Even I got a funny idea.As pressing RedKey can make emulator go to > > > > > sleep, I tried to send virtual key "ENDCALL" and "POWER" to make > > > > > emulator sleep. But I got another failure. %>_<%!!! > > > > > > On Jul 28, 1:20 am, Roman <roman.baumgaert...@t-mobile.com> wrote: > > > > > > It might be that having root permissions might be not sufficient to > > > > > > use goToSleep() correctly. > > > > > > > I found in one of the threads that you also want to make sure that > > > > > > your app is singed as system app. > > > >http://groups.google.com/group/android-developers/browse_thread/threa... > > > > > > > Let me know what you find out. I am curious whether you find a way > > > > > > to > > > > > > resolve this problem. > > > > > > > -- > > > > > > Roman Baumgaertner > > > > > > Sr. SW Engineer-OSDC > > > > > > ·T· · ·Mobile· stick together > > > > > > The views, opinions and statements in this email are those of the > > > > > > author solely in their individual capacity, and do not necessarily > > > > > > represent those of T-Mobile USA, Inc. > > > > > > > On Jul 26, 8:47 pm, Sansiro <wangjiangfeng0...@gmail.com> wrote: > > > > > > > > PowerManager.gotosleep() method seems to not work . > > > > > > > There is no permission problem because my program has the root > > > > > > > permission. > > > > > > > > So any other suggestion?- Hide quoted text - > > > > > > > - Show quoted text - > > > > > -- > > > > 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.- Hide quoted text - > > > > > - Show quoted text - > > > -- > > 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.- Hide quoted text - > > > - Show quoted text - > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "android-framework" group. To post to this group, send email to android-framework@googlegroups.com To unsubscribe from this group, send email to android-framework+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-framework?hl=en -~----------~----~----~----~------~----~------~--~---