Update buckets after path changes.

Bug: 7174672
Change-Id: Ib44a52ad337ca6df135955e71e6cec3261da780d
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f035150..c7e479c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2,7 +2,7 @@
         package="com.android.providers.media"
         android:sharedUserId="android.media"
         android:sharedUserLabel="@string/uid_label"
-        android:versionCode="510">
+        android:versionCode="511">
         
     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
     <uses-permission android:name="android.permission.WRITE_SETTINGS" />
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 4566b0f..607dc8d 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -1746,6 +1746,10 @@
                         + "'||SUBSTR(_data,17) WHERE _data LIKE '/storage/sdcard0/%';");
             }
         }
+        if (fromVersion < 511) {
+            // we update _data in version 510, we need to update the bucket_id as well
+            updateBucketNames(db);
+        }
 
         sanityCheck(db, fromVersion);
         long elapsedSeconds = (SystemClock.currentTimeMicro() - startTime) / 1000000;