With every new release of Google’s Android OS, there are fewer reasons for most users to root their devices. However, among the remaining users who still choose to root their devices, one of the most commonly cited reasons is to enable system-wide theme support. Typically, this is managed via the Substratum theme framework ever since the unfortunate demise of the CyanogenMod Theme Engine. Over time, the team behind Substratum worked hard to include support for more devices by incorporating Substratum support at the ROM level so it could run without root access. And now, the team has taken the project beyond what any of us could have imagined by bringing full system-wide theme support without root for any Android Oreo device.
To give you an idea of just how incredible of a development this is, consider that the following will now be possible without root:
- Theming of the Android Framework and Android System UI, as well as any other system applications. (A lot of you are going to lovehaving a dark theme available, finally!)
- Theming of any third-party application
- Custom fonts for third-party applications
- Many other modifications such as a status bar center-clock mod
The list goes on! Substratum has an extensive list of available themes that support the framework (all of which are supported in this upcoming new version of Substratum for Android 8.0), an active community on Google+ and our own forums, and given this development the support is only bound to grow!
Android Oreo and the Overlay Manager Service
Ever since Google incorporated native support for Sony’s Runtime Resource Overlay (RRO) theme engine in Android 6.0 Marshmallow, we’ve been waiting for Google to provide a built-in interface as well as public APIs that developers can use to theme both system framework application as well as third-party applications. Alas, the Android Nougat release brought little new to the table ever since Sony’s RRO was added to the Android Open Source Project (AOSP).
But thanks to the diligent work by the engineers over at Sony Mobile, the RRO theme engine eventually evolved into what’s known as Overlay Manager Service (OMS), which is what Substratum is based on. Sony was the pioneer in regards to an open source theming solution, but since their OMS theme engine was accepted into AOSP around the time of the final Android 7.1 release, the only way for users of non-Sony devices to take advantage of the theme engine is through a custom ROM.
That changed in Android 8.0. When Substratum was initially released for the first few Android O Developer Previews, the developers of Substratum realized that full supportfor Sony’s OMS was available. This means that a user could install an existing Substratum-supported theme and it would be fully functioning on Android Oreo devices without requiring any ROM patches. There was only one problem though: the process of enabling an installed Substratum theme required root access, or so they thought.
Rootless, System-Wide Substratum Theme Support for Android Oreo
While the developers quietly put their work on the issue of getting Android Oreo users a fully rootless theme solution on the back burner, we were independently digging into every Android O Developer Preview and finding evidence of the theme engine at play, though we misidentified it as being based on the older RRO rather than Sony’s newer OMS. Google even teased the community about theme support in a developer-centric AMA over on Reddit, stating that there were still some hurdles to be overcome before a full theming solution could be built in to Android.
Not satisfied with that answer, we wanted to see just how far Google had gone in getting theme support for Android Oreo. To do that, I dug into the source code of Android 8.0 once the final release dropped, and discovered the existence of ADB shell commands that could enable or disable overlays, which XDA Writer Adam Conway covered yesterday.
Initially, I wasn’t too impressed with the finding, since to my knowledge at the time it was functionally useless as myself and my colleagues were under the impression that installing a theme still required root access as the theme files would need to be moved to a folder that is inaccessible to the user space (in /system/vendor/overlay, which is how RRO functioned). Nicholas Chum himself, one of the lead developers behind Substratum, commented on our post that he was aware of the existence of these commands for quite some time and has been using it for Android O builds already.
One person, though, saw an opportunity arise after we published our article yesterday. XDA’s very own Jeff Corcoran, the developer behind our in-house XDA Labs application, realized that there was a potential workaround to get Android Oreo’s native command line interface for OMS to work without root. It involved a method that was utilized by Helium, the popular non-root backup solution, and more recently by the open-source Greenify alternative known as Brevent.
Elevated Privileges Through a Script
Ordinarily, the “cmd overlay” commands that Google added to the Oreo release can only be run through either a device with root privileges or through a device tethered to a computer invoking the Android Debug Bridge (ADB) shell. A handful of clever developers, such as the Helium and Brevent developers, over the years figured out how to essentially elevate the privileges of an application running on the phone to match that of ADB shell. In doing so, the application can send commands that it usually could not due to restricted permissions. In the case of Substratum, that means the application can install then enable or disable Substratum themes without root.
This realization was a major breakthrough that was only discovered yesterday evening. In the course of a few hours, Nicholas (with the help of Jeff) was able to create a quick alpha version of a rootless Substratum theme manager for Android Oreo devices. And it works – but with a few caveats.
Caveats of Rootless Substratum Support
The process required in order to grant Substratum ADB shell elevated privileges will require the use of a very simple and lightweight desktop application (or just an ADB shell command if you know what you’re doing). Once granted, Substratum will function as you would expect with it being able to handle managing all of your installed Substratum themes. Any themes that you install will remain installed until you choose to uninstall it through Substratum again.
However, the privileges that Substratum is granted are transient, as they are lost when the user performs a full reboot (though luckily soft reboots of the System UI do not lose the privilege). This means that you will have to run the desktop program again if you have rebooted your phone and wish to use Substratum to add, remove, or modify a theme. I want to reiterate again that any themes you install will remain installed even if you reboot, so that means if you would like to just change a few themes only occasionally, this should be perfect for you. You should also be able to switch themes from the Settings menu, as the Developer Preview’s “Theme” option under Display settings then recognizes installed themes, and allows you to switch between them
Finally, the last thing I need to mention is something that seems obvious once you think about it, but in your excitement at hearing news you might have forgotten. Your device is still unrooted. That means you can’t touch or modify any files that absolutely require root access to edit, even if the Substratum theme you installed promised to change something. Sorry, but unfortunately that means you can’t apply a system-wide font change to bring back the blob emojis, though as mentioned in the beginning, it is possible for a Substratum theme to alter the fonts of individual applications.
The Necessity of Substratum
Let’s get an important detail out of the way now. When is this coming? As the title mentions, the first public availability of the rootless Substratum for Android 8.0 devices such as the Google Nexus 5X, Google Nexus 6P, Google Pixel, and Google Pixel XL should be within 1 week. That’s not a guarantee by any means, as things can change in the development process that may require additional time investment, but since OMS is already fully supported in AOSP, all the Substratum team is working on now is the interfacing between the Substratum app and unrooted devices.
Next up: will it be free? No. Substratum for unrooted Android Oreo devices will be a paid application. I cannot tell you how much it will cost as Nicholas has not yet decided on a price, but rest assured the price will be fair given the value of what you will be receiving. Up to this point, Substratum has been freely available for many devices, so consider supporting this kind of development by first supporting Team Substratum. You can either wait for Google to eventually release that dark theme you’ve always wanted (ha, good one), or you can throw a few pennies in to support independent development that many people take for granted.
Still not convinced of its value? You can try installing Substratum themes on your own unrooted 8.0 device. In fact, that’s exactly what we did above. Of course, we had a bit of help by Nicholas in order to do so. If you want to install an existing Substratum theme from the Google Play Store, here are the general steps:
- Download and install the APK file onto your device.
- Extract the contents and compile each overlay into an individual APK file for each app that you want to be themed
- Install each individual overlay APK file that you manually compiled in step #2
- For each and every overlay APK that you install, run the following command to enable it:
cmd overlay enable <package>
- If you want to change the priority of overlays, use:
cmd overlay set-priority <package> PARENT|lowest|highest
- List all of your installed overlays with:
cmd overlay list
- Remove any overlays you don’t want with:
cmd overlay disable <package>
If you really want to use the command line to manage themes, be our guest! Personally, I was stuck getting past step #2. Substratum is not using some hidden method that you can’t come up with on your own, but it is making it far easier for you to manage. When it’s possible to do something manually but an application can do it for me much more easily, I tend to just let the app do its job. But that’s up to you.
Personally, I am really, really excited to see where this goes. For any devices out there that don’t already support a built-in theme management system (such as Motorola or OnePlus devices), you now have another reason to look forward to in the Android 8.0 update. For those of you lucky enough to already taste that sweet Oreo, you have something to look forward to in 1 week.
source : Xda Developers