Create Customized Lock Screen Shortcuts on Android Oreo
Edited by Jay, Maria Quinney
Android Oreo opens up an excellent variety of customizable options and tweaks that were not accessible in previous versions. The focus of this VisiHow tutorial is changing the lock screen shortcuts from the default, which on Oreo is the Google assistant and the camera app (the two little icons in the bottom left and right corner on the lock screen). Being able to swap out the defaults for apps or functions that you'd rather have quick access to is quite convenient. Also, there is no need to worry about having root access, as we'll be using ADB (Android debug bridge) to customize our lock screen shortcuts.
If you're new to using ADB, please check out our article on Installing adb on Windows before proceeding.
This tutorial is broken into two sections:
- Finding the application package and the application activity name.
- Entering the commands to edit the left and right lock screen shortcuts.
Both of the above tasks can be completed using ADB which is a bonus for those of you who don't have access to root.
At the time of writing this tutorial, Android Oreo (8.1.0) is only available on Nexus and Pixel devices
For this article, we used a Google Pixel and a laptop running Windows 7.
Locate Application Package and Activity Name with ADB
Before getting into the command line tool, we need to enable USB debugging.
Once you have access to developer options and USB debugging turned on, we need to choose which app shortcuts will replace the defaults, as well as get their application package and activity names. To do this, we'll use ADB (command line tool), our Pixel/Nexus device and the charging/data cable.
Open the folder where you extracted the platform tools, hold the shift key + right click, then select "Open command window here".
Plug your device into your PC with the charging/data cable. If you haven't granted access to this device before, you'll see the following pop-up.
Tap "OK", and select "Always allow from this computer" for quicker access in the future.
To make things a little easier, we're going to edit a few settings in the command window. Right-click in the command window title area, then click "Properties".
In the Properties window, select the Options
tab, then place a checkmark next to "QuickEdit Mode".
While still in Properties, select the Layout
tab. Next, change the window width to 90 or higher. The bigger the width, the more room you'll have for potentially long lines of text.
Having the command returns on a single line makes highlighting and copying less complicated later on.
Go to the command window and type: "adb devices" (without the quotation marks), then press Enter.
If you granted access in step 2 (or in the past), you'll see the serial number of your phone/tablet under List of devices attached
in the command window.
We're doing this to ensure ADB is communicating with your device correctly before proceeding.
Now it's time to get the application package and activity name for the shortcuts we'll be editing in the next section of this guide. In the same command window, type: "adb shell" (without the quotes) and press enter.
On your device, open one of the applications you want to add a shortcut to on the lock screen.
With the app open and visible, type or copy and paste the following line in the command window: dumpsys window windows | grep -E 'mCurrentFocus'
Hint, if you selected QuickEdit Mode at the beginning of this section, simply place the cursor where you want, and click the right mouse button to paste the above command and hit enter.
Now you'll see both the appPackage and appActivity displayed in the command window. The "/" separates the two, and the appPackage begins after the "u0".
Write these down or continue with the following steps to copy and paste them into a text file.
Highlight the appPackage with the cursor, right-click in the command window title bar, click "Edit", followed by "Copy".
With the appPackage copied to the clipboard, paste it into a text file. Do this for both the appPackage and appActivity names, and remember to rerun the command in step 10 for your second lock screen shortcut.
Edit Lock Screen Shortcuts Via ADB
Now that we have successfully located and written down down the App Package and App Activity names for both of our new lock screen shortcuts, it's time to edit the following two lines of code in our command prompt window:
settings put secure sysui_keyguard_left "COMPONENT/NAME"
settings put secure sysui_keyguard_right "COMPONENT/NAME"
We will be replacing "COMPONENT" with the Application Package name and "NAME" with the Application Activity name. Do this in your text file before continuing with the following steps.
With your device connected to your PC, open a command window from inside your platform-tools directory.
In the command window, type: "adb devices (without the quotes), then press the enter key.
In the same command window, type: "adb shell" (without the quotes) and press enter.
Next, go to your text file, and copy: settings put secure sysui_keyguard_left "COMPONENT/NAME"
. Remember to replace COMPONENT
with App Package and NAME
with the App Activity.
Head back to your command window and paste the left-side shortcut text, then hit enter.
Line the cursor up and right-click on the mouse to copy what's on the clipboard.
Now go back to your text file and copy the right-side lock screen shortcut code to the clipboard.
Back in the command window, type or paste the right-side shortcut code, then hit the enter key.
No wake your device so you can see the lock screen. You'll see that the bottom left and right shortcut icons no represent the apps you chose earlier on in this tutorial.