From d1c089d471e41ba9216834c37f7e9380ff4b1212 Mon Sep 17 00:00:00 2001 From: d34d Date: Thu, 23 Apr 2015 09:16:29 -0700 Subject: Don't assume all default components come from one package When uninstalling a theme, we check for any components that may have been applied from that theme and change them back to the default. It is possible the default theme does not have all the components that need to be returned to defaults which causes the mixnmatch table to be out of sync. This patch uses the default components map to correctly set the components to the correct default, which can include components from System theme. Change-Id: I78cbe874110d32998969b56dd9076f1439e61664 REF: LETTUCE-245 --- src/org/cyanogenmod/themes/provider/ThemePackageHelper.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java index 8a20a61..93d1d58 100644 --- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java +++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java @@ -230,7 +230,7 @@ public class ThemePackageHelper { // Check currently applied components (fonts, wallpapers etc) and verify the theme is still // installed. If it is not installed, we need to set the component back to the default theme ThemeChangeRequest.Builder builder = new ThemeChangeRequest.Builder(); - String defaultPkgName = ThemeUtils.getDefaultThemePackageName(context); + Map defaultComponents = ThemeUtils.getDefaultComponents(context); Cursor mixnmatch = context.getContentResolver().query(MixnMatchColumns.CONTENT_URI, null, null, null, null); @@ -241,7 +241,7 @@ public class ThemePackageHelper { .mixNMatchKeyToComponent(mixnmatchKey); String pkg = mixnmatch.getString(mixnmatch.getColumnIndex(MixnMatchColumns.COL_VALUE)); if (pkgToRemove.equals(pkg)) { - builder.setComponent(component, defaultPkgName); + builder.setComponent(component, defaultComponents.get(component)); } } @@ -250,10 +250,12 @@ public class ThemePackageHelper { final ThemeConfig themeConfig = config != null ? config.themeConfig : null; if (themeConfig != null) { final Map themes = themeConfig.getAppThemes(); + final String defaultOverlayPkgName + = defaultComponents.get(ThemesColumns.MODIFIES_OVERLAYS); for (String appPkgName : themes.keySet()) { if (ThemeUtils.isPerAppThemeComponent(appPkgName) && pkgToRemove.equals(themes.get(appPkgName).getOverlayPkgName())) { - builder.setAppOverlay(appPkgName, defaultPkgName); + builder.setAppOverlay(appPkgName, defaultOverlayPkgName); } } } -- cgit v1.2.3