Friday, June 9, 2017

How to set a Custom Screen Saver on Huawei and Honor devices running EMUI

Android 4.2 Jelly Bean introduced a feature called the daydream, which is essentially just an interactive screen saver that activates when the device is docked and/or charging. Third party developers can make their own screen savers which are accessible to the user in Settings → Display. Unfortunately, not every OEM allows their users to set a custom screen saver. Huawei and its sub-brand Honor, for instance, only gives their users a single screen saver option – the photo table option which acts as a slideshow.

(Note: Google renamed daydreams to screen savers starting with the release of Android 7.0 Nougat so users would not confuse the feature with the Daydream VR platform. However, Huawei and Honor devices still refer to screen savers as "Daydream" in settings so I'm using both terms interchangeably.)

I don't know why EMUI (the software running on Huawei and Honor's Android smartphones) doesn't allow users to set a custom screen saver in settings, but I do know that it's possible to set your own screen saver manually. Here's how.


Tutorial – Set a Custom Screen Saver Manually in EMUI

Set up ADB

Since this method involves sending ADB commands, we'll first need to make sure we have that setup before touching anything else. Download the standalone ADB binary and save it anywhere on your desktop/laptop computer's storage (pro-tip: for Windows, drop everything into C:\Windows for ADB to work system-wide). Next ensure you have the proper driver for your phone installed by running HiSuite and seeing if it recognizes your phone. If not, let HiSuite install the drivers for you.

Now on your phone, go to Settings → About Phone and tap on "build number" 7 times until you see a pop up stating you are now a developer. Back in Settings, a new menu item will appear called Developer Options. Enter this and look for "USB Debugging." Enable it and then connect your phone to your PC.

Open up a command prompt/terminal on your PC and enter the following command:

  adb devices  

Back on your phone, you should see a pop-up asking you to authorize your computer to use USB debugging. Authorize it. Now on your computer, the output of the above command should show your phone's serial number. If so, then you're ready to move on.

Setting up Custom Screen Saver

The next thing you'll need to do is go to Settings → Display and flip the toggle to turn on screen savers (called Daydream in EMUI). Don't worry about any of the settings below it, all of that will be irrelevant when we set our own custom screen saver.

Next, you'll need to download and install a custom daydream/screen saver from the Google Play Store. I tested this method on Google Clock, Lucid DayDream Screensaver, and Night clock. You'll also need some way to manually figure out what the name of your custom screen saver app's "dream service" is. This is the name of the screen saver service that the Android system starts when you set it in Settings → Display → Daydream. However, since EMUI does not display the list of apps that have this service available, we have to dig into the services of the app to find out what it's called.

I will show you two different methods on how to do this. Method 1 is less precise, but easier to do. Method 2 will guarantee you get the right name down.

Method 1 – Using My Android Tools

Download and install My Android Tools from the Play Store. Open the app and expand the sidebar on the left side. Tap on "Service" under Component Info to bring up the list of installed apps and all of their services. Look for the daydream/screen saver app you installed in the list. Select it, and you'll see a list of services that each app has.

Look for something that sounds like it might be the daydream/screen saver service. For Google Clock, that would be com.android.deskclock.Screensaver. For Lucid that's de.j4velin.ultimateDayDream.DreamWrapper. For Night Clock that's com.firebirdberlin.nightdream.NightDreamService. Once you have this information, we are ready to set our custom screen saver. Skip below the the "Sending the ADB Command to Set Custom Screen Savers" part.

Method 2 – Inspecting the Android Manifest File

Download any app on the Play Store capable of inspecting an app's Android Manifest file. I used Developer for this purpose, but any other app works. View your screen saver app's Manifest file and search for the <service> tag that includes the permission "android.permission.BIND_DREAM_SERVICE."

Snippet of Android Manifest file from Google Clock

Snippet of Android Manifest file from Lucid DayDream

Snippet of Android Manifest file from Night Clock

Once you've found it, take note of the service name. For Google Clock, that would be com.android.deskclock.Screensaver. For Lucid that's de.j4velin.ultimateDayDream.DreamWrapper. For Night Clock that's com.firebirdberlin.nightdream.NightDreamService.

Sending the ADB Command to set Custom Screen Savers

Open up a command prompt or terminal on your computer and enter the following command:

  adb shell  

Then, enter this command:

  settings put secure screensaver_components YOUR.CUSTOM.SCREENSAVER.COMPONENT  

where YOUR.CUSTOM.SCREENSAVER.COMPONENT is the package name of the screen saver followed by the screen saver's service name. The package name and the service name should be separated by a forward slash.

For example, if I want to set Google Clock as my screen saver:

  settings put secure screensaver_components com.android.deskclock/.Screensaver  

As you can see, the first part of the component, com.android.deskclock, is the package name of Google Clock. If you followed Method 1, the package name is found by looking at the common prefix of all the services. If you followed Method 2, the package name is listed at the very top of the Manifest file. Either way, you can just assume that what follows before the last period is the package name.

For the second part of the component name, .Screensaver, this is actually a shortcut notation that allows us to skip having to write out the full component name com.android.deskclock/com.android.deskclock.Screensaver.

As another example, here's how I would set Lucid as my screen saver:

  settings put secure screensaver_components de.j4velin.ultimateDayDream/.DreamWrapper  

Finally, here's how I would set Night Clock as my screen saver:

  settings put secure screensaver_components com.firebirdberlin.nightdream/.NightDreamService  

Once you've set your custom screen saver via an ADB command, you're good to go. Just plug your phone in or dock it and wait for the screen to timeout on its own. You should now see your Huawei or Honor phone start playing your custom screen saver! If you want to customize the screen saver, you'll have to do so by going into the app's settings.


Follow the XDA Tutorials RSS feed for more content like this. Download XDA Labs to quickly catch up on all the latest news and original features published on the XDA Portal.



from xda-developers http://ift.tt/2rapa5z
via IFTTT

No comments:

Post a Comment