Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97a06a12 authored by Jason Monk's avatar Jason Monk
Browse files

Add switchable theme to tuner

Allows option in tuner to switch between system theme overlays
if multiple exist. Requires a restart to take effect.

Test: Settings -> Tuner -> Other -> Theme
Change-Id: Iea43b9cbb67fd91c6008be594ad4cfd19c3f57ec
parent 126dd25d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -52,6 +52,16 @@ interface IUiModeManager {
     */
    int getNightMode();

    /**
     * Sets whith theme overlays to use within /vendor/overlay.
     */
    void setTheme(String theme);

    /**
     * Gets whith theme overlays to use within /vendor/overlay.
     */
    String getTheme();

    /**
     * Tells if UI mode is locked or not.
     */
+29 −0
Original line number Diff line number Diff line
@@ -240,6 +240,35 @@ public class UiModeManager {
        }
    }

    /**
     * Sets the vendor theme overlay property, then triggers a reboot.
     * @hide
     */
    public void setTheme(String theme) {
        if (mService != null) {
            try {
                mService.setTheme(theme);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }
    }

    /**
     * Gets the vendor theme overlay property.
     * @hide
     */
    public String getTheme() {
        if (mService != null) {
            try {
                return mService.getTheme();
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }
        return null;
    }

    /**
     * Returns the currently configured night mode.
     * <p>
+6 −0
Original line number Diff line number Diff line
@@ -3130,6 +3130,12 @@
    <permission android:name="android.permission.MANAGE_AUTO_FILL"
        android:protectionLevel="signature" />

    <!-- Allows an app to set the theme overlay in /vendor/overlay
         being used.
         @hide  <p>Not for use by third-party applications.</p> -->
    <permission android:name="android.permission.MODIFY_THEME_OVERLAY"
                android:protectionLevel="signature" />

    <application android:process="system"
                 android:persistent="true"
                 android:hasCode="false"
+2 −0
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@
    <!-- shortcut manager -->
    <uses-permission android:name="android.permission.RESET_SHORTCUT_MANAGER_THROTTLING" />

    <uses-permission android:name="android.permission.MODIFY_THEME_OVERLAY" />

    <application
        android:name=".SystemUIApplication"
        android:persistent="true"
+7 −0
Original line number Diff line number Diff line
@@ -1722,4 +1722,11 @@
        not appear on production builds ever. -->
    <string name="pip_allow_minimize_summary" translatable="false">Allow PIP to minimize slightly offscreen</string>

    <!-- Tuner string -->
    <string name="change_theme_reboot" translatable="false">Changing the theme requires a restart.</string>
    <!-- Tuner string -->
    <string name="theme" translatable="false">Theme</string>
    <!-- Tuner string -->
    <string name="default_theme" translatable="false">Default</string>

</resources>
Loading