summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Woodman <olly@google.com>2022-01-20 15:59:34 +0000
committerOliver Woodman <olly@google.com>2022-01-20 17:17:17 +0000
commitcc3dd47ceb1088474e5c9652f68c939fa2702db0 (patch)
treec7276d7fe8528d2e30edb35000c9df4eac4a7481
parent317d5231441b0f98778b4f34d19fe58b7db9654d (diff)
downloadMedia-cc3dd47ceb1088474e5c9652f68c939fa2702db0.tar.gz
MediaSession2Service: Doc notification permission
Test: Javadoc only Bug: 209461524 Change-Id: I3a0041d6bebcedd0528801fdd37d94230a273479
-rw-r--r--apex/framework/java/android/media/MediaSession2Service.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/apex/framework/java/android/media/MediaSession2Service.java b/apex/framework/java/android/media/MediaSession2Service.java
index f6fd509..9f80c43 100644
--- a/apex/framework/java/android/media/MediaSession2Service.java
+++ b/apex/framework/java/android/media/MediaSession2Service.java
@@ -161,19 +161,19 @@ public abstract class MediaSession2Service extends Service {
public abstract MediaSession2 onGetSession(@NonNull ControllerInfo controllerInfo);
/**
- * Called when notification UI needs update. Override this method to show or cancel your own
- * notification UI.
+ * Called to update the media notification when the playback state changes.
* <p>
- * This would be called on {@link MediaSession2}'s callback executor when playback state is
- * changed.
+ * If playback is active and a notification is returned, the service uses it to become a
+ * foreground service. If playback is not active then the notification is still posted, but the
+ * service does not become a foreground service.
* <p>
- * With the notification returned here, the service becomes foreground service when the playback
- * is started. Apps must request the permission
- * {@link android.Manifest.permission#FOREGROUND_SERVICE} in order to use this API. It becomes
- * background service after the playback is stopped.
+ * Apps must request the {@link android.Manifest.permission#FOREGROUND_SERVICE} permission
+ * in order to use this API. For apps targeting {@link android.os.Build.VERSION_CODES#TIRAMISU}
+ * or later, notifications will only be posted if the app has also been granted the
+ * {@link android.Manifest.permission#POST_NOTIFICATIONS} permission.
*
- * @param session a session that needs notification update.
- * @return a {@link MediaNotification}. Can be {@code null}.
+ * @param session the session for which an updated media notification is required.
+ * @return the {@link MediaNotification}. Can be {@code null}.
*/
@Nullable
public abstract MediaNotification onUpdateNotification(@NonNull MediaSession2 session);