summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-03-07 09:48:53 -0800
committerClark Scheff <clark@cyngn.com>2015-03-10 09:00:03 -0700
commitd61bdb03364a481b56972b200bec41a410e33fb5 (patch)
tree154e77780d69c8deed8eb3727409d0a4a6b554bd /src
parentcfbac9f8df5def4416f51c3cf7ef217b497c6402 (diff)
downloadandroid_packages_providers_ThemesProvider-d61bdb03364a481b56972b200bec41a410e33fb5.zip
android_packages_providers_ThemesProvider-d61bdb03364a481b56972b200bec41a410e33fb5.tar.gz
android_packages_providers_ThemesProvider-d61bdb03364a481b56972b200bec41a410e33fb5.tar.bz2
Cleanup theme update path
Change-Id: Idf2f586b743025f4788f3373fc0078efec48feb9
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemePackageHelper.java22
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemesProvider.java14
2 files changed, 17 insertions, 19 deletions
diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
index 43b313d..8a20a61 100644
--- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
+++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
@@ -150,9 +150,6 @@ public class ThemePackageHelper {
} else if (pi.isLegacyIconPackApk) {
updateLegacyIconPackInternal(context, pi, capabilities, isProcessing);
}
-
- // We should reapply any components that are currently applied for this theme.
- reapplyInstalledComponentsForTheme(context, pkgName);
}
}
@@ -160,6 +157,10 @@ public class ThemePackageHelper {
Map<String, Boolean> capabilities, boolean isProcessing) {
ThemeInfo info = pi.themeInfo;
boolean isPresentableTheme = ThemePackageHelper.isPresentableTheme(capabilities);
+ final int oldInstallState =
+ ProviderUtils.getInstallStateForTheme(context, pi.packageName);
+ final int newState = isProcessing ? InstallState.UPDATING : InstallState.INSTALLED;
+
ContentValues values = new ContentValues();
values.put(ThemesColumns.PKG_NAME, pi.packageName);
values.put(ThemesColumns.TITLE, info.name);
@@ -172,8 +173,7 @@ public class ThemePackageHelper {
values.put(ThemesColumns.LAST_UPDATE_TIME, pi.lastUpdateTime);
values.put(ThemesColumns.INSTALL_TIME, pi.firstInstallTime);
values.put(ThemesColumns.TARGET_API, pi.applicationInfo.targetSdkVersion);
- values.put(ThemesColumns.INSTALL_STATE,
- isProcessing ? InstallState.UPDATING : InstallState.INSTALLED);
+ values.put(ThemesColumns.INSTALL_STATE, newState);
// Insert theme capabilities
insertCapabilities(capabilities, values);
@@ -181,6 +181,18 @@ public class ThemePackageHelper {
String where = ThemesColumns.PKG_NAME + "=?";
String[] args = { pi.packageName };
context.getContentResolver().update(ThemesColumns.CONTENT_URI, values, where, args);
+
+ // Broadcast that the theme is installed if the previous state was INSTALLING and
+ // the new state is INSTALLED.
+ if (newState == ThemesColumns.InstallState.INSTALLED) {
+ if (oldInstallState == ThemesColumns.InstallState.INSTALLING) {
+ ProviderUtils.sendThemeInstalledBroadcast(context, pi.packageName);
+ } else if (oldInstallState == ThemesColumns.InstallState.UPDATING) {
+ ProviderUtils.sendThemeUpdatedBroadcast(context, pi.packageName);
+ // We should reapply any components that are currently applied for this theme.
+ reapplyInstalledComponentsForTheme(context, pi.packageName);
+ }
+ }
}
private static void updateSystemPackageInternal(Context context) {
diff --git a/src/org/cyanogenmod/themes/provider/ThemesProvider.java b/src/org/cyanogenmod/themes/provider/ThemesProvider.java
index 92af9da..966a18f 100644
--- a/src/org/cyanogenmod/themes/provider/ThemesProvider.java
+++ b/src/org/cyanogenmod/themes/provider/ThemesProvider.java
@@ -279,8 +279,6 @@ public class ThemesProvider extends ContentProvider {
case THEMES_ID:
String pkgName = values.getAsString(ThemesColumns.PKG_NAME);
final boolean updatePreviews = getShouldUpdatePreviews(sqlDB, pkgName);
- final int oldInstallState =
- ProviderUtils.getInstallStateForTheme(getContext(), pkgName);
rowsUpdated = sqlDB.update(ThemesTable.TABLE_NAME, values, selection, selectionArgs);
if (updateNotTriggeredByContentProvider(values) && updatePreviews) {
Intent intent = new Intent(getContext(), PreviewGenerationService.class);
@@ -304,18 +302,6 @@ public class ThemesProvider extends ContentProvider {
hasBootAni != null && hasBootAni);
getContext().startService(intent);
}
- // Broadcast that the theme is installed if the previous state was INSTALLING and
- // the new state is INSTALLED.
- if (values.containsKey(ThemesColumns.INSTALL_STATE)) {
- int newState = values.getAsInteger(ThemesColumns.INSTALL_STATE);
- if (newState == ThemesColumns.InstallState.INSTALLED) {
- if (oldInstallState == ThemesColumns.InstallState.INSTALLING) {
- ProviderUtils.sendThemeInstalledBroadcast(getContext(), pkgName);
- } else if (oldInstallState == ThemesColumns.InstallState.UPDATING) {
- ProviderUtils.sendThemeUpdatedBroadcast(getContext(), pkgName);
- }
- }
- }
getContext().getContentResolver().notifyChange(uri, null);
break;
case MIXNMATCH: