Backport album artist support from Honeycomb.

MediaProvider was already receiving album artist info (for album
disambiguation), and now it stores it in the database too.
b/4081769

Change-Id: I85a771da949aaf3c0246f7cb0c367b5ea1d52f69
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index b10ca63..306535e 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -957,6 +957,10 @@
             updateBucketNames(db, "video");
         }
 
+        /*
+         *  Android 2.2 shipped with database version 89
+         */
+
         if (fromVersion < 91) {
             // Never query by mini_thumb_magic_index
             db.execSQL("DROP INDEX IF EXISTS mini_thumb_magic_index");
@@ -981,6 +985,17 @@
             db.execSQL("DELETE from albums");
             db.execSQL("UPDATE audio_meta SET date_modified=0;");
         }
+
+        /*
+         *  Android 2.3 shipped with database version 93
+         */
+
+        if (fromVersion < 100) {
+            db.execSQL("ALTER TABLE audio_meta ADD COLUMN album_artist TEXT;");
+            recreateAudioView(db);
+            db.execSQL("UPDATE audio_meta SET date_modified=0;");
+        }
+
         sanityCheck(db, fromVersion);
     }
 
@@ -1861,11 +1876,7 @@
                 // the view.
                 ContentValues values = new ContentValues(initialValues);
 
-                // TODO Remove this and actually store the album_artist in the
-                // database. For now this is here so the media scanner can start
-                // sending us the album_artist, even though it's not in the db yet.
                 String albumartist = values.getAsString(MediaStore.Audio.Media.ALBUM_ARTIST);
-                values.remove(MediaStore.Audio.Media.ALBUM_ARTIST);
                 String compilation = values.getAsString(MediaStore.Audio.Media.COMPILATION);
                 values.remove(MediaStore.Audio.Media.COMPILATION);
 
@@ -2332,11 +2343,7 @@
                 case AUDIO_MEDIA_ID:
                     {
                         ContentValues values = new ContentValues(initialValues);
-                        // TODO Remove this and actually store the album_artist in the
-                        // database. For now this is here so the media scanner can start
-                        // sending us the album_artist, even though it's not in the db yet.
                         String albumartist = values.getAsString(MediaStore.Audio.Media.ALBUM_ARTIST);
-                        values.remove(MediaStore.Audio.Media.ALBUM_ARTIST);
                         String compilation = values.getAsString(MediaStore.Audio.Media.COMPILATION);
                         values.remove(MediaStore.Audio.Media.COMPILATION);
 
@@ -3220,7 +3227,7 @@
 
     private static String TAG = "MediaProvider";
     private static final boolean LOCAL_LOGV = true;
-    private static final int DATABASE_VERSION = 93;
+    private static final int DATABASE_VERSION = 100;
     private static final String INTERNAL_DATABASE_NAME = "internal.db";
     private static final String EXTERNAL_DATABASE_NAME = "external.db";