Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51ef3fca authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "add album artist support -- MediaStore and MediaScanner bits" into gingerbread

parents ab1c1410 2f5a1665
Loading
Loading
Loading
Loading
+239 −0
Original line number Diff line number Diff line
@@ -143426,6 +143426,17 @@
 visibility="public"
>
</field>
<field name="EXTRA_MEDIA_ALBUM_ARTIST"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.intent.extra.albumartist&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="EXTRA_MEDIA_ARTIST"
 type="java.lang.String"
 transient="false"
@@ -143662,6 +143673,17 @@
 visibility="public"
>
</field>
<field name="ALBUM_ARTIST"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;album_artist&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ALBUM_ID"
 type="java.lang.String"
 transient="false"
@@ -143728,6 +143750,17 @@
 visibility="public"
>
</field>
<field name="NUMBER_OF_SONGS_FOR_ALBUM_ARTIST"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;numsongs_by_album_artist&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="NUMBER_OF_SONGS_FOR_ARTIST"
 type="java.lang.String"
 transient="false"
@@ -143740,6 +143773,179 @@
>
</field>
</interface>
<interface name="MediaStore.Audio.AlbumartistColumns"
 abstract="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<field name="ALBUM_ARTIST"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;album_artist&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ALBUM_ARTIST_KEY"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;album_artist_key&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="NUMBER_OF_ALBUMS"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;number_of_albums&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="NUMBER_OF_TRACKS"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;number_of_tracks&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</interface>
<class name="MediaStore.Audio.Albumartists"
 extends="java.lang.Object"
 abstract="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.provider.BaseColumns">
</implements>
<implements name="android.provider.MediaStore.Audio.AlbumartistColumns">
</implements>
<constructor name="MediaStore.Audio.Albumartists"
 type="android.provider.MediaStore.Audio.Albumartists"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</constructor>
<method name="getContentUri"
 return="android.net.Uri"
 abstract="false"
 native="false"
 synchronized="false"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="volumeName" type="java.lang.String">
</parameter>
</method>
<field name="CONTENT_TYPE"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;vnd.android.cursor.dir/albumartists&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="DEFAULT_SORT_ORDER"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;album_artist_key&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ENTRY_CONTENT_TYPE"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;vnd.android.cursor.item/albumartist&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="EXTERNAL_CONTENT_URI"
 type="android.net.Uri"
 transient="false"
 volatile="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="INTERNAL_CONTENT_URI"
 type="android.net.Uri"
 transient="false"
 volatile="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="MediaStore.Audio.Albumartists.Albums"
 extends="java.lang.Object"
 abstract="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.provider.MediaStore.Audio.AlbumColumns">
</implements>
<constructor name="MediaStore.Audio.Albumartists.Albums"
 type="android.provider.MediaStore.Audio.Albumartists.Albums"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</constructor>
<method name="getContentUri"
 return="android.net.Uri"
 abstract="false"
 native="false"
 synchronized="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="volumeName" type="java.lang.String">
</parameter>
<parameter name="albumArtistId" type="long">
</parameter>
</method>
</class>
<class name="MediaStore.Audio.Albums"
 extends="java.lang.Object"
 abstract="false"
@@ -144031,6 +144237,39 @@
 visibility="public"
>
</field>
<field name="ALBUM_ARTIST"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;album_artist&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ALBUM_ARTIST_ID"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;album_artist_id&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ALBUM_ARTIST_KEY"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;album_artist_key&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ALBUM_ID"
 type="java.lang.String"
 transient="false"
+125 −8
Original line number Diff line number Diff line
@@ -64,9 +64,11 @@ public final class MediaStore {
     * Activity Action: Perform a search for media.
     * Contains at least the {@link android.app.SearchManager#QUERY} extra.
     * May also contain any combination of the following extras:
     * EXTRA_MEDIA_ARTIST, EXTRA_MEDIA_ALBUM, EXTRA_MEDIA_TITLE, EXTRA_MEDIA_FOCUS
     * EXTRA_MEDIA_ARTIST, EXTRA_MEDIA_ALBUM_ARTIST, EXTRA_MEDIA_ALBUM,
     * EXTRA_MEDIA_TITLE, EXTRA_MEDIA_FOCUS
     *
     * @see android.provider.MediaStore#EXTRA_MEDIA_ARTIST
     * @see android.provider.MediaStore#EXTRA_MEDIA_ALBUM_ARTIST
     * @see android.provider.MediaStore#EXTRA_MEDIA_ALBUM
     * @see android.provider.MediaStore#EXTRA_MEDIA_TITLE
     * @see android.provider.MediaStore#EXTRA_MEDIA_FOCUS
@@ -94,6 +96,10 @@ public final class MediaStore {
     * The name of the Intent-extra used to define the artist
     */
    public static final String EXTRA_MEDIA_ARTIST = "android.intent.extra.artist";
    /**
     * The name of the Intent-extra used to define the album artist
     */
    public static final String EXTRA_MEDIA_ALBUM_ARTIST = "android.intent.extra.albumartist";
    /**
     * The name of the Intent-extra used to define the album
     */
@@ -892,26 +898,38 @@ public final class MediaStore {
             */
            public static final String ARTIST = "artist";

            /**
             * A non human readable key calculated from the ARTIST, used for
             * searching, sorting and grouping
             * <P>Type: TEXT</P>
             */
            public static final String ARTIST_KEY = "artist_key";

            /**
             * The id of the artist credited for the album that contains the audio file
             * <P>Type: INTEGER (long)</P>
             */
            public static final String ALBUM_ARTIST_ID = "album_artist_id";

            /**
             * The artist credited for the album that contains the audio file
             * <P>Type: TEXT</P>
             * @hide
             */
            public static final String ALBUM_ARTIST = "album_artist";

            /**
             * Whether the song is part of a compilation
             * A non human readable key calculated from the ALBUM_ARTIST, used for
             * searching, sorting and grouping
             * <P>Type: TEXT</P>
             * @hide
             */
            public static final String COMPILATION = "compilation";
            public static final String ALBUM_ARTIST_KEY = "album_artist_key";

            /**
             * A non human readable key calculated from the ARTIST, used for
             * searching, sorting and grouping
             * Whether the song is part of a compilation
             * <P>Type: TEXT</P>
             * @hide
             */
            public static final String ARTIST_KEY = "artist_key";
            public static final String COMPILATION = "compilation";

            /**
             * The composer of the audio file, if any
@@ -1438,6 +1456,91 @@ public final class MediaStore {
            }
        }

        /**
         * Columns representing an album artist
         */
        public interface AlbumartistColumns {
            /**
             * The artist credited for the album that contains the audio file
             * <P>Type: TEXT</P>
             */
            public static final String ALBUM_ARTIST = "album_artist";

            /**
             * A non human readable key calculated from the ALBUM_ARTIST, used for
             * searching, sorting and grouping
             * <P>Type: TEXT</P>
             */
            public static final String ALBUM_ARTIST_KEY = "album_artist_key";

            /**
             * The number of albums in the database for this artist
             */
            public static final String NUMBER_OF_ALBUMS = "number_of_albums";

            /**
             * The number of albums in the database for this artist
             */
            public static final String NUMBER_OF_TRACKS = "number_of_tracks";
        }

        /**
         * Contains album artists for audio files
         */
        public static final class Albumartists implements BaseColumns, AlbumartistColumns {
            /**
             * Get the content:// style URI for the album artists table on the
             * given volume.
             *
             * @param volumeName the name of the volume to get the URI for
             * @return the URI to the audio album artists table on the given volume
             */
            public static Uri getContentUri(String volumeName) {
                return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName +
                        "/audio/albumartists");
            }

            /**
             * The content:// style URI for the internal storage.
             */
            public static final Uri INTERNAL_CONTENT_URI =
                    getContentUri("internal");

            /**
             * The content:// style URI for the "primary" external storage
             * volume.
             */
            public static final Uri EXTERNAL_CONTENT_URI =
                    getContentUri("external");

            /**
             * The MIME type for this table.
             */
            public static final String CONTENT_TYPE = "vnd.android.cursor.dir/albumartists";

            /**
             * The MIME type for entries in this table.
             */
            public static final String ENTRY_CONTENT_TYPE = "vnd.android.cursor.item/albumartist";

            /**
             * The default sort order for this table
             */
            public static final String DEFAULT_SORT_ORDER = ALBUM_ARTIST_KEY;

            /**
             * Sub-directory of each album artist containing all albums on which
             * they are credited.
             */
            public static final class Albums implements AlbumColumns {
                public static final Uri getContentUri(String volumeName,
                        long albumArtistId) {
                    return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName
                            + "/audio/albumartists/" + albumArtistId + "/albums");
                }
            }
        }

        /**
         * Columns representing an album
         */
@@ -1461,6 +1564,12 @@ public final class MediaStore {
             */
            public static final String ARTIST = "artist";

            /**
             * The album artist credited on this album
             * <P>Type: TEXT</P>
             */
            public static final String ALBUM_ARTIST = "album_artist";

            /**
             * The number of songs on this album
             * <P>Type: INTEGER</P>
@@ -1475,6 +1584,14 @@ public final class MediaStore {
             */
            public static final String NUMBER_OF_SONGS_FOR_ARTIST = "numsongs_by_artist";

            /**
             * This column is available when getting album info via album artist,
             * and indicates the number of songs on the album credited to the given
             * album artist.
             * <P>Type: INTEGER</P>
             */
            public static final String NUMBER_OF_SONGS_FOR_ALBUM_ARTIST = "numsongs_by_album_artist";

            /**
             * The year in which the earliest songs
             * on this album were released. This will often
+7 −2
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ public class MediaScanner
    private class MyMediaScannerClient implements MediaScannerClient {

        private String mArtist;
        private String mAlbumArtist;    // use this if mArtist is missing
        private String mAlbumArtist;
        private String mAlbum;
        private String mTitle;
        private String mComposer;
@@ -641,7 +641,7 @@ public class MediaScanner
                map.put(Audio.Media.ARTIST, (mArtist != null && mArtist.length() > 0) ?
                        mArtist : MediaStore.UNKNOWN_STRING);
                map.put(Audio.Media.ALBUM_ARTIST, (mAlbumArtist != null &&
                        mAlbumArtist.length() > 0) ? mAlbumArtist : null);
                        mAlbumArtist.length() > 0) ? mAlbumArtist : MediaStore.UNKNOWN_STRING);
                map.put(Audio.Media.ALBUM, (mAlbum != null && mAlbum.length() > 0) ?
                        mAlbum : MediaStore.UNKNOWN_STRING);
                map.put(Audio.Media.COMPOSER, mComposer);
@@ -680,6 +680,11 @@ public class MediaScanner
                mArtist = mAlbumArtist;
            }

             // use artist if album artist is missing
            if (mAlbumArtist == null || mAlbumArtist.length() == 0) {
                mAlbumArtist = mArtist;
            }

            ContentValues values = toValues();
            String title = values.getAsString(MediaStore.MediaColumns.TITLE);
            if (title == null || TextUtils.isEmpty(title.trim())) {