17

I'm sure this would have been asked before. But I couldn't find out yet.

I recently updated to Lollipop in my Sony Xperia Z phone. The notification bar and pull down settings are great.

But on lock screen, I don't want to turn on/off any WiFi, Bluetooth or any settings. Simply pull down settings should not be allowed on lock screen. How can I do that? Is there any option?

I have pattern lock already.

3
  • I found this but it didn't work on Marshmallow, it might on Lollipop. It requires root and Xposed. Mar 8, 2016 at 19:14
  • It's time for you to upgrade to Android N :)
    – Thomas Vos
    Mar 20, 2016 at 18:18
  • In marshmallow, there is straightforward setting to not allow access to notification drawer when device is securely locked. Dec 28, 2016 at 4:28

2 Answers 2

14

I'm using CyanogenOS 12 (derived from CM12), so the following solution may not work on an stock Lollipop, but regardless, it is a very useful solution.


The tiles that you can toggle in the Quick Settings are assigned particular names like Bluetooth → bt, Wi-Fi -> wifi, Landscape/Portrait → rotation, and many others, and these names are stored as a value for the key sysui_qs_tiles under the table secure of settings.db (Settings Storage).

While those tiles can be removed/re-arranged from the Settings UI, the command line can also be considered to achieve the task.

The relevant command is settings and its usage is mentioned as:

usage:  settings [--user NUM] get namespace key
        settings [--user NUM] put namespace key value
        settings [--user NUM] delete namespace key

'namespace' is one of {system, secure, global}, case-insensitive
If '--user NUM' is not given, the operations are performed on the owner user.

You would need ADB setup in your machine before you proceed any further. Alternatively, if the device is rooted, you can use a terminal app like Terminal Emulator for Android.

Note: ADB in wireless mode may prove dangerous if the device doesn't support authenticating a client before giving access. Proceed at your own risk!

We first have to find out the value stored in the key sysui_qs_tiles, and to do that, enter in a terminal the command:

adb shell settings get secure sysui_qs_tiles

For rooted devices using terminal app:

su
settings get secure sysui_qs_tiles

The output would be like:

wifi,bt,cell,rotation,flashlight,hotspot,location,airplane

Now, if I want to remove Airplane Mode from the Quick Settings or want Wi-Fi tile to be shown after Hotspot, then the commands in a respective order would be:

adb shell settings put secure sysui_qs_tiles wifi,bt,cell,rotation,flashlight,hotspot,location
adb shell settings put secure sysui_qs_tiles bt,cell,rotation,flashlight,hotspot,wifi,location

For rooted devices using terminal app:

su
settings put secure sysui_qs_tiles wifi,bt,cell,rotation,flashlight,hotspot,location
settings put secure sysui_qs_tiles bt,cell,rotation,flashlight,hotspot,wifi,location

Now, coming back to the requirement, that is, "hide quick settings on Lock screen". You can use an tool like Tasker to remove the tiles from Quick Settings when the screen is locked, and add them back when the screen is unlocked.

Before we proceed with Tasker's usage, I should mention that settings command can only be used with ADB in non-rooted devices because of higher privileges required than what is granted to an ordinary user, and hence, for automation in Tasker the device would have to have ADB running in wireless mode. To do so, see:

Instructions for Tasker

  1. Create a task named "Tiles s-unlocked".
  2. Add an action as Code → Run Shell, and add these details:

    Command: adb connect localhost:<PORT>; adb shell settings put secure sysui_qs_tiles wifi,bt,cell,rotation,flashlight,hotspot,location

    For rooted devices, the details would be:

    • Command: settings put secure sysui_qs_tiles wifi,bt,cell,rotation,flashlight,hotspot,location
    • Check Use Root

    For cases where it matters:

    1. Use <PORT> as the port number on which ADB wireless is running like 5555
    2. In place of wifi,bt,cell,rotation,flashlight,hotspot,location use the names of the tiles you want or have in Quick Settings
  3. Create an another task named "Tiles s-locked".

  4. Note: If you configured settings such that the screen doesn't lock right after the device gets to sleep, but after XY seconds (like 30 seconds), then create an action as Task → Wait and set those XY Seconds. Alternatively, sleep XY can be used in the next step under the Command. Arielle suggested the idea.

  5. Add an another action as Code → Run Shell, and add these details:

    Command: adb connect localhost:<PORT>; adb shell settings put secure sysui_qs_tiles ' '

    For rooted devices, the details would be:

    • Command: settings put secure sysui_qs_tiles ' '
    • Check Use Root
  6. Create a profile named "S-unlocked" under Event → Display → Display Unlocked, choose Highest Priority, and link the task "Tiles s-unlocked".
  7. Create an another profile named "S-locked" under Event → Display → Display Off, choose Highest Priority, and link the task "Tiles s-locked".
  8. Have the Tasker enabled, and behold the desired action by locking/unlocking the screen.

    (Click image to enlarge)

    Order of images as "No tiles when screen is locked" → "Tiles when screen is unlocked"

(Click image to enlarge)

IMG: No tiles when screen is locked IMG: Tiles when screen is unlocked

Let me know if my solution works in a device running Stock Lollipop.

14
  • Hi I'm not interested to root my mobile. I thought there will be a way with just in mobile settings which I couldn't find. Thanks :)
    – Coder
    Jul 29, 2015 at 4:46
  • 1
    For Readers: settings put secure qs_show_brightness_slider 0 would remove the brightness slider. Change 0 to 1 and it would come back. Unfortunately, my device behaves oddly when I run that command using Tasker. The effect takes place if only I try it manually via ADB or terminal but not via Tasker! If it works for you, let me know.
    – Firelord
    Aug 14, 2015 at 12:03
  • 1
    Thanks a lot for this, it works great on CM12.1 but I want to add a small thing: I noticed that if you also want to set some specific quick settings on your lock screen (for example only flashlight and ambient display) they do not work if the command is executed while the phone is locked. The solution is to configure your phone not to lock the screen until 5 seconds after the displays is turned of (in this way that the command can be run before it locks and everything works correctly).
    – user138784
    Aug 15, 2015 at 15:55
  • @user138784 Thanks for the input. Have you tried the solution with brightness slider (second comment) as well?
    – Firelord
    Aug 16, 2015 at 7:09
  • 1
    @Firelord as far as I found, the support is for custom tiles and BT tethering can't be toggled by tasker on my device (but I think it can by the pro version of secure settings). I didn't find support for setting the available tiles.
    – user138784
    Jan 19, 2016 at 9:36
1

There is no way to disable the quick settings on the lockscreen.

However, it may be possible by flashing a custom ROM on your phone. I know you can rearrange/remove tiles in CyanogenMod.

Note: by flashing a custom ROM your data will be wiped and your warranty is void.

Edit: On XDA-Developers I found this:

The Quick settings menu can be edited - when the phone is unlocked open quick settings panel and tap and hold any of its icons, you will be allowed to remove or add some functionalities. Just remove airplane mode and mobile data. This way when the phone is locked no one can disable its connectivity. The drawback is that you can't switch the airplane mode easily even when the phone is unlocked.

Source: http://forum.xda-developers.com/showpost.php?p=60243490&postcount=13

3
  • I don't want to do it. Better I get use with this
    – Coder
    Jun 16, 2015 at 6:54
  • They should have probably provided the option for it. Hopefully in the next version
    – Coder
    Jun 16, 2015 at 6:55
  • @ShijuKBabu I edited the answer. On stock ROM you should be able to remove airplane mode and mobile data.
    – Thomas Vos
    Jun 16, 2015 at 7:03

You must log in to answer this question.

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