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

Commit 2a7e4449 authored by Clark Scheff's avatar Clark Scheff
Browse files

Themes: Add '|' delimited list of components to broadcast

Change-Id: I742dcb0f502b6089dee584a92a3792016f2a9799
parent f4b90e00
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ public class ThemeService extends IThemeService.Stub {

        killLaunchers();

        postFinish(true, pkgName);
        postFinish(true, pkgName, components);
    }

    private void doApplyDefaultTheme() {
@@ -631,7 +631,7 @@ public class ThemeService extends IThemeService.Stub {
        mClients.finishBroadcast();
    }

    private void postFinish(boolean isSuccess, String pkgName) {
    private void postFinish(boolean isSuccess, String pkgName, List<String> components) {
        synchronized(this) {
            mProgress = 0;
            mPkgName = null;
@@ -650,9 +650,21 @@ public class ThemeService extends IThemeService.Stub {

        // if successful, broadcast that the theme changed
        if (isSuccess) {
            mContext.sendBroadcastAsUser(new Intent(ThemeUtils.ACTION_THEME_CHANGED),
                    UserHandle.ALL);
            broadcastThemeChange(components);
        }
    }

    private void broadcastThemeChange(List<String> components) {
        StringBuilder sb = new StringBuilder();
        String delimiter = "";
        for (String comp : components) {
            sb.append(delimiter);
            sb.append(comp);
            delimiter = "|";
        }
        final Intent intent = new Intent(ThemeUtils.ACTION_THEME_CHANGED);
        intent.putExtra("components", sb.toString());
        mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
    }

    private void incrementProgress(int increment, String pkgName) {