Since Android 5.0 there is a feature called 'Smart Lock', which allows you to access your device without entering your password, pin or pattern.

It is possible to lock the device via shell by emulating a power button press:

adb shell input keyevent 26

Once on the lockscreen, Smart Lock can be temporarily stopped by holding down on the unlock icon (see question) ↓

Lock icon

How can the device be locked and require a manual unlock using a shell command (or script) with or without root access?

1 Answer 1


If you lock the device as an administrator this will require a manual unlock, and in fact will not accept fingerprints either. This is not root, whatever app you are doing this from just has to be on the administrator list and has to execute the lock screen command rather than just a button press.

I'm not sure if you can do this direct from shell or not, but a small tasker app could do it I think using the system lock action and you can code it into an app. There are already standalone apps that do this as well.

Making an app administrator

Practical instructions for adding administrator to an app

Command to lock the screen from within an app (if that's what you're making)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .