summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-05-10 07:24:55 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-05-10 07:24:55 +0000
commit39d3cd9746971d28d7bde50c2eb5c082e12a4b4e (patch)
tree8aff366547e5d9312939c84d1c306b1578659ec3
parent8641a3c3b6d0fc8949f73b7ff278262411c1d1fa (diff)
parent899152ac438889a19bb37c32a4c6608de35ffc46 (diff)
downloadMediaProvider-39d3cd9746971d28d7bde50c2eb5c082e12a4b4e.tar.gz
Snap for 4773106 from 899152ac438889a19bb37c32a4c6608de35ffc46 to pi-release
Change-Id: I4369de89201c414d3260f6778fd892f5ad977bb8
-rw-r--r--src/com/android/providers/media/MediaProvider.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 9d2e9961a..8f3b54b3b 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -915,7 +915,7 @@ public class MediaProvider extends ContentProvider {
+ " BEGIN SELECT _DELETE_FILE(old._data);END");
}
- private static void updateFromKKSchema(SQLiteDatabase db, boolean internal, int fromVersion) {
+ private static void updateFromKKSchema(SQLiteDatabase db) {
// Delete albums and artists, then clear the modification time on songs, which
// will cause the media scanner to rescan everything, rebuilding the artist and
// album tables along the way, while preserving playlists.
@@ -924,7 +924,15 @@ public class MediaProvider extends ContentProvider {
db.execSQL("DELETE from albums");
db.execSQL("DELETE from artists");
db.execSQL("ALTER TABLE files ADD COLUMN title_resource_uri TEXT DEFAULT NULL");
- db.execSQL("UPDATE files SET date_modified=0;");
+ db.execSQL("UPDATE files SET date_modified=0");
+ }
+
+ private static void updateFromOCSchema(SQLiteDatabase db) {
+ // Add the column used for title localization, and force a rescan of any
+ // ringtones, alarms and notifications that may be using it.
+ db.execSQL("ALTER TABLE files ADD COLUMN title_resource_uri TEXT DEFAULT NULL");
+ db.execSQL("UPDATE files SET date_modified=0"
+ + " WHERE (is_alarm IS 1) OR (is_ringtone IS 1) OR (is_notification IS 1)");
}
/**
@@ -953,8 +961,10 @@ public class MediaProvider extends ContentProvider {
if (fromVersion < 700) {
// Anything older than KK is recreated from scratch
createLatestSchema(db, internal);
+ } else if (fromVersion < 800) {
+ updateFromKKSchema(db);
} else if (fromVersion < 900) {
- updateFromKKSchema(db, internal, fromVersion);
+ updateFromOCSchema(db);
}
sanityCheck(db, fromVersion);