summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLuis Vidal <lvidal@cyngn.com>2016-01-14 20:16:55 (GMT)
committerLuis Vidal <lvidal@cyngn.com>2016-01-15 00:56:32 (GMT)
commit59bff5c10357bfe55244966d9c43bcce11ed646b (patch)
treef75ff858c93d24ed50df01d852d769439bbbae34 /src
parent3b82b9cbc34178e641bb8cf5d8a2676a6e586950 (diff)
downloadandroid_packages_providers_ThemesProvider-59bff5c10357bfe55244966d9c43bcce11ed646b.zip
android_packages_providers_ThemesProvider-59bff5c10357bfe55244966d9c43bcce11ed646b.tar.gz
android_packages_providers_ThemesProvider-59bff5c10357bfe55244966d9c43bcce11ed646b.tar.bz2
No default lock wallpaper and live lock screen for system theme
Patch to remove the defaults inserted in the DB for lock wallpaper and live lock screen in system theme Change-Id: If90e1e00d9eabeb19eba98e9828d552cc892da24 TICKET: CHOOSER-109
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java26
-rw-r--r--src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java1
2 files changed, 22 insertions, 5 deletions
diff --git a/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java b/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java
index eb5b21d..b2960d3 100644
--- a/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java
+++ b/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java
@@ -36,7 +36,7 @@ import android.util.Log;
public class ThemesOpenHelper extends SQLiteOpenHelper {
private static final String TAG = ThemesOpenHelper.class.getName();
- private static final int DATABASE_VERSION = 19;
+ private static final int DATABASE_VERSION = 20;
private static final String DATABASE_NAME = "themes.db";
private static final String SYSTEM_THEME_PKG_NAME = ThemeConfig.SYSTEM_DEFAULT;
private static final String OLD_SYSTEM_THEME_PKG_NAME = "holo";
@@ -132,6 +132,10 @@ public class ThemesOpenHelper extends SQLiteOpenHelper {
upgradeToVersion19(db);
oldVersion = 19;
}
+ if (oldVersion == 19) {
+ upgradeToVersion20(db);
+ oldVersion = 20;
+ }
if (oldVersion != DATABASE_VERSION) {
Log.e(TAG, "Recreating db because unknown database version: " + oldVersion);
dropTables(db);
@@ -483,6 +487,14 @@ public class ThemesOpenHelper extends SQLiteOpenHelper {
}
}
+ private void upgradeToVersion20(SQLiteDatabase db) {
+ //No default lock screen nor live lock screen for system theme
+ db.execSQL(String.format("UPDATE %s SET %s='0', %s='0' WHERE %s='%s'",
+ ThemesTable.TABLE_NAME, ThemesColumns.MODIFIES_LOCKSCREEN,
+ ThemesColumns.MODIFIES_LIVE_LOCK_SCREEN, ThemesColumns.PKG_NAME,
+ SYSTEM_THEME_PKG_NAME));
+ }
+
private void dropTables(SQLiteDatabase db) {
db.execSQL("DROP TABLE IF EXISTS " + ThemesTable.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + MixnMatchTable.TABLE_NAME);
@@ -545,7 +557,6 @@ public class ThemesOpenHelper extends SQLiteOpenHelper {
values.put(ThemesColumns.MODIFIES_FONTS, 1);
values.put(ThemesColumns.MODIFIES_ICONS, 1);
values.put(ThemesColumns.MODIFIES_LAUNCHER, 1);
- values.put(ThemesColumns.MODIFIES_LOCKSCREEN, 1);
values.put(ThemesColumns.MODIFIES_NOTIFICATIONS, 1);
values.put(ThemesColumns.MODIFIES_RINGTONES, 1);
values.put(ThemesColumns.MODIFIES_STATUS_BAR, 1);
@@ -575,9 +586,16 @@ public class ThemesOpenHelper extends SQLiteOpenHelper {
public static void insertDefaults(SQLiteDatabase db) {
ContentValues values = new ContentValues();
long updateTime = System.currentTimeMillis();
- values.put(MixnMatchColumns.COL_VALUE, SYSTEM_THEME_PKG_NAME);
- values.put(MixnMatchColumns.COL_UPDATE_TIME, updateTime);
for(String key : MixnMatchColumns.ROWS) {
+ if (key.equals(MixnMatchColumns.KEY_LOCKSCREEN) ||
+ key.equals(MixnMatchColumns.KEY_LIVE_LOCK_SCREEN)) {
+ //No system default for lock wallpaper or live lock screen
+ values.put(MixnMatchColumns.COL_VALUE, "");
+ values.put(MixnMatchColumns.COL_UPDATE_TIME, 0);
+ } else {
+ values.put(MixnMatchColumns.COL_VALUE, SYSTEM_THEME_PKG_NAME);
+ values.put(MixnMatchColumns.COL_UPDATE_TIME, updateTime);
+ }
values.put(MixnMatchColumns.COL_KEY, key);
db.insert(TABLE_NAME, null, values);
}
diff --git a/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java b/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java
index e204640..0e90f48 100644
--- a/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java
+++ b/src/org/cyanogenmod/themes/provider/util/WallpaperPreviewGenerator.java
@@ -66,7 +66,6 @@ public class WallpaperPreviewGenerator {
item = createWallpaperItems(0, baseDir, null, pkgName, preview, false);
if (item != null) {
items.wallpapers.add(item);
- items.lockscreen = item;
}
} else {
final Context themeContext = mContext.createPackageContext(themeInfo.packageName, 0);