How to disable Android screen locking

2,698 views
Skip to first unread message

Максим Андрущенко

unread,
Mar 31, 2010, 4:42:07 PM3/31/10
to android-porting
Hi.

I have no Android power driver.
I applied a patch:
http://gitorious.org/flow-g1-5/platform_frameworks_base/commit/4bc6cd6aecc7330cdcadf2d5168bb3dfa08b6732
to make for ANDROID fake battery.
It works.

But after 5 minutes working ANDROID locks screen, on the screen i see message: charging(96%).

My question is, how to disable ANDROID to lock screen, because i can't unlock it.
Is there any patch or solution for this.

Regards!

Deva R

unread,
Apr 1, 2010, 3:43:20 AM4/1/10
to andrusc...@mail.ru, android-porting
I guess you are tocking about UI lock..


>>i can't unlock it.

you can unlock a locked UI, by pressing and dragging the 'lock' button upwards..
we also mapped a hot key to unlock the screen., will check what
keyevent it publishes.

>>how to disable ANDROID to lock screen

You can get handle to the keyguard manager in App, and disable it..

somebody posted a snippet for this (source:
http://www.androidsnippets.org/snippets/43/)
KeyguardManager keyguardManager =
(KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();

in androidmanifest:
<uses-permission
android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>

2010/4/1 Максим Андрущенко <andrusc...@mail.ru>:

> --
> unsubscribe: android-porti...@googlegroups.com
> website: http://groups.google.com/group/android-porting
>
> To unsubscribe, reply using "remove me" as the subject.
>

mizmit1222

unread,
Apr 1, 2010, 5:30:36 AM4/1/10
to android-porting
Alternatively, set a negative value to screen_off_timeout in
settings.db by SQLite access through adb connection.

$ adb shell
# cd /data/data/com.android.providers.settings/databases
# sqlite3 settings.db
sqlite> update system set value="-1" where name="screen_off_timeout";
sqlite> .quit
$


On Apr 1, 4:43 pm, Deva R <r.deva...@gmail.com> wrote:
> I guess you are tocking about UI lock..
>
> >>i can't unlock it.
>
> you can unlock a locked UI, by pressing and dragging the 'lock' button upwards..
> we also mapped a hot key to unlock the screen., will check what
> keyevent it publishes.
>
> >>how to disable ANDROID to lock screen
>
> You can get handle to the keyguard manager in App, and disable it..
>
> somebody posted a snippet for this (source:http://www.androidsnippets.org/snippets/43/)
> KeyguardManager keyguardManager =
> (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
> KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
> lock.disableKeyguard();
>
> in androidmanifest:
> <uses-permission
> android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>
>

> 2010/4/1 íÁËÓÉÍ áÎÄÒÕÝÅÎËÏ <andruschenk...@mail.ru>:


>
>
>
> > Hi.
>
> > I have no Android power driver.
> > I applied a patch:

> >http://gitorious.org/flow-g1-5/platform_frameworks_base/commit/4bc6cd...

Deva R

unread,
Apr 1, 2010, 7:23:32 AM4/1/10
to mizmi...@gmail.com, android-porting
> Alternatively, set a negative value to screen_off_timeout in
> settings.db by SQLite access through adb connection.
real neat way!!! :>

but when i reboot, the phone boots with locked screen.. i have to
unlock once, and then it stays unlocked forever..

is controls of /data/data/com.android.providers.settings/databases/settings.db
documented somewhere?? looks handy.

thanks,
deva

supermaximus79

unread,
Apr 2, 2010, 11:08:52 AM4/2/10
to android-porting
Thanks a lot!

Could you tell me, what is the name of lock/unlock button in Android.
I know that Back button, which return Android to previous screen,
calls KEY_BACK in Linux.
I added it to my platform.
What about lock/unlock?


On Apr 1, 2:23 pm, Deva R <r.deva...@gmail.com> wrote:
> > Alternatively, set a negative value to screen_off_timeout in
> > settings.db by SQLite access through adb connection.
>
> real neat way!!! :>
>
> but when i reboot, the phone boots with locked screen.. i have to
> unlock once, and then it stays unlocked forever..
>
> is controls of /data/data/com.android.providers.settings/databases/settings.db
> documented somewhere?? looks handy.
>
> thanks,
> deva
>

Deva R

unread,
Apr 9, 2010, 8:46:45 AM4/9/10
to andrusc...@mail.ru, android-porting
Hi,
The keycode used is '0x3B' (59).. which maps to keycode.KEYCODE_SHIFT_LEFT

Not sure how this meta-key is responsible to unlock keyguard..
below is the log collected for below sequence

-wait for screen to lock, and unlock.,
-enable logcat, trace input events.
-press unlock key (not a single keypress, but needs to be kept
pressed down for a duration)


# logcat &
# getevent &
# add device 1: /dev/input/event0
name: "omap_keypad"
add device 2: /dev/input/event2
name: "Synaptic TM12XX TouchPoint 1"
add device 3: /dev/input/event1
name: "Synaptic TM12XX TouchPoint 1"
I/power ( 825): *** set_screen_state 0
E/power ( 825): Failed setting last user activity: g_error=0
W/InputManagerService( 825): Window already focused, ignoring focus
gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@437dd6b0
D/dalvikvm( 910): GC freed 1246 objects / 86080 bytes in 47ms
/dev/input/eventrequest_suspend_state: wakeup (0->0) at 5582947052051
(2000-01-01 01:32:59.897705087 UTC)
0: 0001 003b 00000001
D/KeyguardViewMediator( 825): wakeWhenReadyLocked(82)
D/KeyguardViewMediator( 825): handleWakeWhenReady(82)
D/KeyguardViewMediator( 825): pokeWakelock(5000)
I/power ( 825): *** set_screen_state 1
/dev/input/event0: 0001 003b 00000000
/dev/input/event0: 0001 003b 00000001
D/KeyguardViewMediator( 825): pokeWakelock(5000)
W/InputManagerService( 825): Window already focused, ignoring focus
gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4373aae0
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
E/gralloc ( 825): [unregister] handle 0x417a00 still locked (state=40000001)
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000002
/dev/input/event0: 0001 003b 00000000

Reply all
Reply to author
Forward
0 new messages