From b83a558be9b40d46dbcf40666550d8b2cc29fb3e Mon Sep 17 00:00:00 2001 From: d34d Date: Tue, 26 May 2015 13:05:07 -0700 Subject: Check old install state before reapplying icon pack We only want to reapply an icon pack if the old state was UPDATING and the new state is INSTALLED. Other combinations should not trigger the reapply code. Change-Id: I6ba90341795eed365211ac2b29239e47842d62be --- src/org/cyanogenmod/themes/provider/ThemePackageHelper.java | 11 ++++++++--- 1 file changed, 8 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 3c4ddaf..83e8e19 100644 --- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java +++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java @@ -224,9 +224,14 @@ public class ThemePackageHelper { String[] args = { pi.packageName }; context.getContentResolver().update(ThemesColumns.CONTENT_URI, values, where, args); - if (!isProcessing) { - // We should reapply any components that are currently applied for this theme. - reapplyInstalledComponentsForTheme(context, pi.packageName); + final int oldInstallState = + ProviderUtils.getInstallStateForTheme(context, pi.packageName); + final int newState = isProcessing ? InstallState.UPDATING : InstallState.INSTALLED; + if (newState == ThemesColumns.InstallState.INSTALLED) { + if (oldInstallState == ThemesColumns.InstallState.UPDATING) { + // We should reapply any components that are currently applied for this theme. + reapplyInstalledComponentsForTheme(context, pi.packageName); + } } } -- cgit v1.2.3