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

Commit f5a49981 authored by Clark Scheff's avatar Clark Scheff
Browse files

Themes: Don't kill launchers that handle the theme change

Change-Id: I5e3a7ea2455a4c407928bb5c90b7fc4e5906aa73
parent 0bf7a582
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -607,9 +607,12 @@ public class ThemeService extends IThemeService.Stub {
        homeIntent.addCategory(Intent.CATEGORY_HOME);

        List<ResolveInfo> infos = pm.queryIntentActivities(homeIntent, 0);
        List<ResolveInfo> themeChangeInfos = pm.queryBroadcastReceivers(
                new Intent(ThemeUtils.ACTION_THEME_CHANGED), 0);
        for(ResolveInfo info : infos) {
            if (info.activityInfo != null && info.activityInfo.applicationInfo != null &&
                    !isSetupActivity(info)) {
                    !isSetupActivity(info) && !handlesThemeChanges(
                    info.activityInfo.applicationInfo.packageName, themeChangeInfos)) {
                String pkgToStop = info.activityInfo.applicationInfo.packageName;
                Log.d(TAG, "Force stopping " +  pkgToStop + " for theme change");
                try {
@@ -626,6 +629,17 @@ public class ThemeService extends IThemeService.Stub {
               CM_SETUPWIZARD_PACKAGE.equals(info.activityInfo.packageName);
    }

    private boolean handlesThemeChanges(String pkgName, List<ResolveInfo> infos) {
        if (infos != null && infos.size() > 0) {
            for (ResolveInfo info : infos) {
                if (info.activityInfo.applicationInfo.packageName.equals(pkgName)) {
                    return true;
                }
            }
        }
        return false;
    }

    private void postProgress(String pkgName) {
        int N = mClients.beginBroadcast();
        for(int i=0; i < N; i++) {