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

Commit 1f1e34e2 authored by d34d's avatar d34d Committed by Steve Kondik
Browse files

Themes: Process theme resources after package scanned [1/2]

This patch processes a theme's resources after the package is
scanned and the theme is added to the PackageManager.

Change-Id: I098e7e8bd192a8ead0c382ff60e28701c064329c
parent ff8ed933
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -188,13 +188,13 @@ public class ThemeService extends IThemeService.Stub {
                        } catch (PackageManager.NameNotFoundException e) {
                            name = null;
                        }
                        if (name != null) {

                        int result = mPM.processThemeResources(pkgName);
                        if (result < 0) {
                                postFailedThemeInstallNotification(name);
                            postFailedThemeInstallNotification(name != null ? name : pkgName);
                        }
                        sendThemeResourcesCachedBroadcast(pkgName, result);
                        }

                        synchronized (mThemesToProcessQueue) {
                            mThemesToProcessQueue.remove(0);
                            if (mThemesToProcessQueue.size() > 0 &&
+12 −9
Original line number Diff line number Diff line
@@ -1148,6 +1148,10 @@ public class PackageManagerService extends IPackageManager.Stub {
                                            pkgList,uidArray, null);
                                }
                            }
                            // if this was a theme, send it off to the theme service for processing
                            if(res.pkg.mIsThemeApk || res.pkg.mIsLegacyIconPackApk) {
                                processThemeResourcesInThemeService(res.pkg.packageName);
                            }
                            if (res.removedInfo.args != null) {
                                // Remove the replaced package's older resources safely now
                                deleteOld = true;
@@ -6689,15 +6693,6 @@ public class PackageManagerService extends IPackageManager.Stub {
                }
            }
            if (!isBootScan && (pkg.mIsThemeApk)) {
                // Pass this off to the ThemeService for processing
                ThemeManager tm =
                        (ThemeManager) mContext.getSystemService(Context.THEME_SERVICE);
                if (tm != null) {
                    tm.processThemeResources(pkg.packageName);
                }
            }
            //Icon Packs need aapt too
            if (isBootScan && (mBootThemeConfig != null &&
                    pkg.packageName.equals(mBootThemeConfig.getIconPackPkgName()))) {
@@ -14638,6 +14633,14 @@ public class PackageManagerService extends IPackageManager.Stub {
        return 0;
    }
    private void processThemeResourcesInThemeService(String pkgName) {
        ThemeManager tm =
                (ThemeManager) mContext.getSystemService(Context.THEME_SERVICE);
        if (tm != null) {
            tm.processThemeResources(pkgName);
        }
    }
    /**
     * The new resource cache structure does not flatten the paths for idmaps, so this method
     * checks for files that end with @idmap and assumes this indicates the older format and