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 automation 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
- Create a task named "Tiles s-unlocked".
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:
- Use
<PORT>
as the port number on which ADB wireless is running like 5555
- In place of
wifi,bt,cell,rotation,flashlight,hotspot,location
use the names of the tiles you want or have in Quick Settings
Create an another task named "Tiles s-locked".
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.
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
- Create a profile named "S-unlocked" under Event → Display → Display Unlocked, choose
Highest
Priority, and link the task "Tiles s-unlocked".
- Create an another profile named "S-locked" under Event → Display → Display Off, choose
Highest
Priority, and link the task "Tiles s-locked".
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)

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