From 2071f7e229e34cf716ad0d99bc5ba51e96b32ab1 Mon Sep 17 00:00:00 2001 From: Clark Scheff Date: Mon, 30 Jun 2014 13:57:21 -0700 Subject: Revert "Reapply theme components in a runnable." This reverts commit 92f77e77e097e59f9ec8d7bc64324f1987230af6. Change-Id: I79a7beedb43d097e743a41b0501805cd1afad9d4 --- .../themes/provider/ThemePackageHelper.java | 23 ++++++---------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java index c9752d3..d602315 100644 --- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java +++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java @@ -26,8 +26,6 @@ import android.content.pm.ThemeUtils; import android.content.res.AssetManager; import android.content.res.ThemeManager; import android.database.Cursor; -import android.os.Handler; -import android.os.Looper; import android.provider.ThemesContract; import android.provider.ThemesContract.MixnMatchColumns; import android.provider.ThemesContract.ThemesColumns; @@ -49,8 +47,6 @@ import static android.content.res.CustomTheme.HOLO_DEFAULT; public class ThemePackageHelper { public final static String TAG = ThemePackageHelper.class.getName(); - private static final long REAPPLY_THEME_DELAY = 1000L; - // Maps the theme component to its folder name in assets. public static HashMap sComponentToFolderName = new HashMap(); static { @@ -147,8 +143,7 @@ public class ThemePackageHelper { context.getContentResolver().insert(ThemesColumns.CONTENT_URI, values); } - public static void updatePackage(final Context context, final String pkgName) - throws NameNotFoundException { + public static void updatePackage(Context context, String pkgName) throws NameNotFoundException { if (HOLO_DEFAULT.equals(pkgName)) { updateHoloPackageInternal(context); } else { @@ -162,17 +157,8 @@ public class ThemePackageHelper { updateLegacyIconPackInternal(context, pi, capabilities); } - // Calling reapplyInstalledComponentsForTheme in a runnable posted to a handler gives - // other processes enough time to process the ACTION_PACKAGE_REPLACED before the theme - // change is completed and restarts apps due to config change. - Handler h = new Handler(Looper.getMainLooper()); - h.postDelayed(new Runnable() { - @Override - public void run() { - // We should reapply any components that are currently applied for this theme. - reapplyInstalledComponentsForTheme(context, pkgName); - } - }, REAPPLY_THEME_DELAY); + // We should reapply any components that are currently applied for this theme. + reapplyInstalledComponentsForTheme(context, pkgName); } } @@ -240,6 +226,9 @@ public class ThemePackageHelper { values.put(ThemesColumns.DATE_CREATED, System.currentTimeMillis()); values.put(ThemesColumns.LAST_UPDATE_TIME, pi.lastUpdateTime); + // Insert theme capabilities + insertCapabilities(capabilities, values); + String where = ThemesColumns.PKG_NAME + "=?"; String[] args = { pi.packageName }; context.getContentResolver().update(ThemesColumns.CONTENT_URI, values, where, args); -- cgit v1.2.3