开发者

How to remove the lock screen that appears after the emulator boots up to main screen in Android 2.1

The lock screen appears at the main screen, after the emulator boots up. I want to disable locking at main screen, so that the nex开发者_运维知识库t time I boot up my emulator the lock screen will not appear. Can anybody suggest the best solution for this?


The latest version of the Android OS 4.2.2 has a way to remove it via the emulator Settings. Just go to : Security >> Screen Lock, and select "NONE." Make sure you are saving the emulator settings to Snapshot so you don't have to keep going through these same steps.


I just suffered this issue as well (not sure if it could be solved programatically) and found that hitting page up worked for me.

http://forum.archosfans.com/viewtopic.php?f=34&t=30574


The lock screen is started by a service.The service is WindowManagerService.In the service ,the code "wm.systemReady()" starts the Lock sceen.


AFAIK, you can't unless you create your own home screen.


From this answer:

  1. If you are the developer or have access to the code of the application under test then the best and the easiest way of achieving this is using: http://developer.android.com/guide/topics/testing/activity_testing.html

     KeyguardLock keyguardLock = ((KeyguardManager)keyguardService).newKeyguardLock(TAG);
    
     if (enable) {
        keyguardLock.reenableKeyguard();
     } else {
        keyguardLock.disableKeyguard();
     }
        return true;
     }
    

    In my opinion this is a nasty solution as it requires you to include an extra permission in your application -- one that virtually no application will need.

    As [OP] mentioned, you should remove this, but people forget: I've seen a few apps released on the Market that still have this permission included, when it really should have been removed.

    If you can automatically only include this permission for test builds, or automatically remove the permission when doing a release build, then fine.

  2. Second best method is to use adb shell commands to unlock it at boot of the emulator. The actual code would differ depending upon what method you use to call these commands. This of course has the limitation that it can be run only at the first start up of the emulator, once the emulator has started this command would do nothing.

    You can run the "adb shell" command as often as you like. On the first startup, it will open the Android menu, which should be harmless. On each subsequent startup, it will press Menu, which will unlock the screen, as desired.

  3. Third method is telnet into the emulator and then use the EV_KEY to unlock it.

    telnet localhost 5554 event send EV_KEY:KEY_MENU:1 EV_KEY:KEY_MENU:0 quit

    You can put this in a bat or shell file and call it from your test to unlock the Home screen. This again has the limitation of being able to unlock at only the first boot and cannot be used to unlock the Home screen after the first boot.

    This seems backwards. The home screen is not locked when you start an emulator for the first time.

    In any case, I wouldn't recommend this at all, since we have the more reliable "adb shell" solution above. Which also should work on real devices.

  4. Fourth option is to use maven to unlock it. http://issues.hudson-ci.org/browse/HUDSON-7185 This is very useful for CI purposes but is limited by inability to unlock the screen from eclipse. So if you are writing your tests in Eclipse you have to run the tests using command prompt if you need to unlock the screen.

    Clarification: that bug report is about the Android Emulator plugin for Jenkins/Hudson, and not Maven. The Maven solution mentioned there just uses the "telnet" option above.

  5. Finally, a further option is to use Android emulator snapshots. Introduced in Android SDK Tools v9, the emulator now supports saving the current state of the emulator (similar to other virtualisation products like VMware).

    So you could start the emulator once, so that it becomes unlocked, then shut it down. Starting the emulator subsequently will immediately load up a clean emulator with the screen unlocked (so long as you do not save emulator state at shutdown (i.e. the "--no-snapshot-save" option).

    BTW, this snapshot functionality will be automated and included in the next release of the Android Emulator Plugin for Jenkins/Hudson.


Following steps worked for me.

Steps: Go to AVD Manager -> Right click on the Virtual Device -> Wipe Data


How to remove the lock screen that appears after the emulator boots up to main screen in Android 2.1

  1. Andy (Right Click) - Settings - VMI Import Tool
  2. Andy (Right Click) - Andy VM Launcher - Delete This Andy - New Andy - Launch
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜