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

Commit 6be8de36 authored by Bryan Mawhinney's avatar Bryan Mawhinney
Browse files

Default MediaStyled notifications to CATEGORY_TRANSPORT

This makes it easier to identify them later (e.g., for filtering).
The developer can always specify a different category if preferred.

Also fixed some javadoc related to setMediaSession()

Change-Id: I5f28514758218ff66fdbaa9fd37ccb19f12d4852
parent 9d32507a
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -3223,6 +3223,10 @@ public class Notification implements Parcelable
     * {@link #setShowActionsInCompactView(int...)} you can promote up to 2 actions to be displayed
     * in the standard view alongside the usual content.
     *
     * Notifications created with MediaStyle will have their category set to
     * {@link Notification#CATEGORY_TRANSPORT CATEGORY_TRANSPORT} unless you set a different
     * category using {@link Notification.Builder#setCategory(String) setCategory()}.
     *
     * Finally, if you attach a {@link android.media.session.MediaSession.Token} using
     * {@link android.app.Notification.MediaStyle#setMediaSession(MediaSession.Token)},
     * the System UI can identify this as a notification representing an active media session
@@ -3235,9 +3239,9 @@ public class Notification implements Parcelable
     *     .setSmallIcon(R.drawable.ic_stat_player)
     *     .setContentTitle("Track title")     // these three lines are optional
     *     .setContentText("Artist - Album")   // if you use
     *     .setLargeIcon(albumArtBitmap))      // setMediaSession(token, true)
     *     .setMediaSession(mySession, true)
     *     .setStyle(<b>new Notification.MediaStyle()</b>)
     *     .setLargeIcon(albumArtBitmap))      // setMediaSession(token)
     *     .setStyle(<b>new Notification.MediaStyle()</b>
     *         .setMediaSession(mySession))
     *     .build();
     * </pre>
     *
@@ -3279,7 +3283,9 @@ public class Notification implements Parcelable
        public Notification buildStyled(Notification wip) {
            wip.contentView = makeMediaContentView();
            wip.bigContentView = makeMediaBigContentView();

            if (wip.category == null) {
                wip.category = Notification.CATEGORY_TRANSPORT;
            }
            return wip;
        }