summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2016-01-27 17:41:24 -0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-02-01 11:47:05 -0800
commit6542c71b08808a09d292b65e94c1d00d3e8d231b (patch)
treeefb6c1c608d108266d6140f38a8be39b57a248be
parent5e0821fb027e46289a2a8813bf18f1781aa4dd58 (diff)
downloadframeworks_base-6542c71b08808a09d292b65e94c1d00d3e8d231b.zip
frameworks_base-6542c71b08808a09d292b65e94c1d00d3e8d231b.tar.gz
frameworks_base-6542c71b08808a09d292b65e94c1d00d3e8d231b.tar.bz2
Themes: Process applied themes before boot finishes
Because apps on /system can change during a reboot, think OTA, we need to make sure the currently applied theme(s) are processed before boot completes, otherwise bad things will happen. Change-Id: Ib286af2d5578723265b3df3936d9fe5c8665a9da TICKET: CYNGNOS-1726
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index f69ed7d..8abb9f0 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -15386,6 +15386,9 @@ public class PackageManagerService extends IPackageManager.Stub {
int[] grantPermissionsUserIds = EMPTY_INT_ARRAY;
synchronized (mPackages) {
+ // process applied themes so their resources are up to date and ready use
+ processAppliedThemes();
+
// Verify that all of the preferred activity components actually
// exist. It is possible for applications to be updated and at
// that point remove a previously declared activity component that
@@ -17749,6 +17752,44 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
+ /**
+ * Makes sure resources and idmaps for themes that are applied are up to date. This should only
+ * impact boots when something on /system has changed.
+ */
+ private void processAppliedThemes() {
+ ThemeConfig themeConfig = ThemeConfig.getBootTheme(mContext.getContentResolver());
+ if (themeConfig == null) return;
+
+ // gather up all the themes applied and then process them
+ Set<String> themesToProcess = new ArraySet<String>();
+ // process theme set for icons
+ if (themeConfig.getIconPackPkgName() != null) {
+ themesToProcess.add(themeConfig.getIconPackPkgName());
+ }
+ // process theme set for non-app specific overlays
+ if (themeConfig.getOverlayPkgName() != null) {
+ themesToProcess.add(themeConfig.getOverlayPkgName());
+ }
+ // process theme set for status bar
+ if (themeConfig.getOverlayForStatusBar() != null) {
+ themesToProcess.add(themeConfig.getOverlayForStatusBar());
+ }
+ // process theme set for navigation bar
+ if (themeConfig.getOverlayForNavBar() != null) {
+ themesToProcess.add(themeConfig.getOverlayForNavBar());
+ }
+ // process themes set for specific apps
+ Map<String, ThemeConfig.AppTheme> appThemesMap = themeConfig.getAppThemes();
+ for (String themePkgName : appThemesMap.keySet()) {
+ themesToProcess.add(themePkgName);
+ }
+
+ // now start the processing
+ for (String themePkgName : themesToProcess) {
+ processThemeResources(themePkgName);
+ }
+ }
+
private void createAndSetCustomResources() {
Configuration tempConfiguration = new Configuration();
String mcc = SystemProperties.get("ro.prebundled.mcc");