summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-04-23 16:16:29 (GMT)
committerClark Scheff <clark@cyngn.com>2015-04-23 16:20:57 (GMT)
commitd1c089d471e41ba9216834c37f7e9380ff4b1212 (patch)
treec182a4284784ee4633364fdea6bda9c73b66319d /src
parentd6c69145c554db81855d7c72f69d2008b7f21417 (diff)
downloadandroid_packages_providers_ThemesProvider-d1c089d471e41ba9216834c37f7e9380ff4b1212.zip
android_packages_providers_ThemesProvider-d1c089d471e41ba9216834c37f7e9380ff4b1212.tar.gz
android_packages_providers_ThemesProvider-d1c089d471e41ba9216834c37f7e9380ff4b1212.tar.bz2
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
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemePackageHelper.java8
1 files changed, 5 insertions, 3 deletions
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<String, String> 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<String, ThemeConfig.AppTheme> 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);
}
}
}