diff options
author | d34d <clark@cyngn.com> | 2015-10-12 11:03:49 -0700 |
---|---|---|
committer | d34d <clark@cyngn.com> | 2015-12-22 09:01:45 -0800 |
commit | 59167a41b6a7d469ae3b864d3f0d9a8caef7ba33 (patch) | |
tree | 837059fc388785e2234d6c2342c1ff5f0e88abfb | |
parent | c4a60a1aacab57d0587b8b7d5c5eedb7a691e69c (diff) | |
download | android_packages_providers_ThemesProvider-59167a41b6a7d469ae3b864d3f0d9a8caef7ba33.tar.gz android_packages_providers_ThemesProvider-59167a41b6a7d469ae3b864d3f0d9a8caef7ba33.tar.bz2 android_packages_providers_ThemesProvider-59167a41b6a7d469ae3b864d3f0d9a8caef7ba33.zip |
Re-apply live lock screen on update
Change-Id: Ibafde34788c57e551c2bb9eb73a1d7a6d5ad5432
-rw-r--r-- | src/org/cyanogenmod/themes/provider/ThemePackageHelper.java | 69 |
1 files changed, 44 insertions, 25 deletions
diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java index fe30c7c..8e73843 100644 --- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java +++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java @@ -35,6 +35,7 @@ import android.provider.ThemesContract.MixnMatchColumns; import android.provider.ThemesContract.ThemesColumns; import android.provider.ThemesContract.ThemesColumns.InstallState; import android.util.Log; +import com.android.internal.widget.LockPatternUtils; import org.cyanogenmod.themes.provider.util.ProviderUtils; import java.io.IOException; @@ -356,35 +357,53 @@ public class ThemePackageHelper { } private static void reapplyInstalledComponentsForTheme(Context context, String pkgName) { + ThemeChangeRequest.Builder builder = new ThemeChangeRequest.Builder(); Configuration config = context.getResources().getConfiguration(); - if (config == null || config.themeConfig == null) return; + if (config != null && config.themeConfig != null) { + // Other packages such as wallpaper can be changed outside of themes + // and are not tracked well by the provider. We only care to apply resources that may crash + // the system if they are not reapplied. + ThemeConfig themeConfig = config.themeConfig; + if (pkgName.equals(themeConfig.getFontPkgName())) { + builder.setFont(pkgName); + } + if (pkgName.equals(themeConfig.getIconPackPkgName())) { + builder.setIcons(pkgName); + } + if (pkgName.equals(themeConfig.getOverlayPkgName())) { + builder.setOverlay(pkgName); + } + if (pkgName.equals(themeConfig.getOverlayPkgNameForApp(SYSTEMUI_STATUS_BAR_PKG))) { + builder.setStatusBar(pkgName); + } + if (pkgName.equals(themeConfig.getOverlayPkgNameForApp(SYSTEMUI_NAVBAR_PKG))) { + builder.setNavBar(pkgName); + } - ThemeChangeRequest.Builder builder = new ThemeChangeRequest.Builder(); - // Other packages such as wallpaper can be changed outside of themes - // and are not tracked well by the provider. We only care to apply resources that may crash - // the system if they are not reapplied. - ThemeConfig themeConfig = config.themeConfig; - if (pkgName.equals(themeConfig.getFontPkgName())) { - builder.setFont(pkgName); - } - if (pkgName.equals(themeConfig.getIconPackPkgName())) { - builder.setIcons(pkgName); - } - if (pkgName.equals(themeConfig.getOverlayPkgName())) { - builder.setOverlay(pkgName); - } - if (pkgName.equals(themeConfig.getOverlayPkgNameForApp(SYSTEMUI_STATUS_BAR_PKG))) { - builder.setStatusBar(pkgName); - } - if (pkgName.equals(themeConfig.getOverlayPkgNameForApp(SYSTEMUI_NAVBAR_PKG))) { - builder.setNavBar(pkgName); + // Check if there are any per-app overlays using this theme + final Map<String, ThemeConfig.AppTheme> themes = themeConfig.getAppThemes(); + for (String appPkgName : themes.keySet()) { + if (ThemeUtils.isPerAppThemeComponent(appPkgName)) { + builder.setAppOverlay(appPkgName, pkgName); + } + } } - // Check if there are any per-app overlays using this theme - final Map<String, ThemeConfig.AppTheme> themes = themeConfig.getAppThemes(); - for (String appPkgName : themes.keySet()) { - if (ThemeUtils.isPerAppThemeComponent(appPkgName)) { - builder.setAppOverlay(appPkgName, pkgName); + LockPatternUtils lockPatternUtils = new LockPatternUtils(context); + if (lockPatternUtils.isThirdPartyKeyguardEnabled()) { + String[] projection = {MixnMatchColumns.COL_VALUE}; + String selection = MixnMatchColumns.COL_KEY + "=?"; + String[] selectionArgs = {MixnMatchColumns.KEY_LIVE_LOCK_SCREEN}; + Cursor cursor = context.getContentResolver().query(MixnMatchColumns.CONTENT_URI, + projection, selection, selectionArgs, null); + if (cursor != null) { + if (cursor.moveToFirst()) { + String appliedPkgName = cursor.getString(0); + if (pkgName.equals(appliedPkgName)) { + builder.setLiveLockScreen(pkgName); + } + } + cursor.close(); } } |