mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Suppress lint warning about missing POST_NOTIFICATIONS permission
For media session related notifications, permission is not required. https://developer.android.com/develop/ui/views/notifications/notification-permission#exemptions-media-sessions #minor-release PiperOrigin-RevId: 600819251
This commit is contained in:
parent
4c1581a175
commit
b98e5ac0d4
2 changed files with 13 additions and 1 deletions
|
|
@ -203,6 +203,9 @@ import java.util.concurrent.TimeoutException;
|
|||
}
|
||||
}
|
||||
|
||||
// POST_NOTIFICATIONS permission is not required for media session related notifications.
|
||||
// https://developer.android.com/develop/ui/views/notifications/notification-permission#exemptions-media-sessions
|
||||
@SuppressLint("MissingPermission")
|
||||
private void updateNotificationInternal(
|
||||
MediaSession session,
|
||||
MediaNotification mediaNotification,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import static androidx.media3.common.util.Assertions.checkArgument;
|
|||
import static androidx.media3.common.util.Assertions.checkState;
|
||||
import static java.lang.annotation.ElementType.TYPE_USE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.PendingIntent;
|
||||
|
|
@ -165,12 +166,16 @@ import java.util.Map;
|
|||
* <li><b>{@code exo_notification_stop}</b> - The stop icon.
|
||||
* </ul>
|
||||
*
|
||||
* <p>Alternatively, the action icons can be set programatically by using the {@link Builder}.
|
||||
* <p>Alternatively, the action icons can be set programmatically by using the {@link Builder}.
|
||||
*
|
||||
* <p>Unlike the drawables above, the large icon (i.e. the icon passed to {@link
|
||||
* NotificationCompat.Builder#setLargeIcon(Bitmap)} cannot be overridden in this way. Instead, the
|
||||
* large icon is obtained from the {@link MediaDescriptionAdapter} passed to {@link
|
||||
* Builder#Builder(Context, int, String, MediaDescriptionAdapter)}.
|
||||
*
|
||||
* <p>Note: This class would require {@link android.Manifest.permission#POST_NOTIFICATIONS}
|
||||
* permission if used without a {@linkplain #setMediaSessionToken(MediaSessionCompat.Token) media
|
||||
* session}.
|
||||
*/
|
||||
@UnstableApi
|
||||
public class PlayerNotificationManager {
|
||||
|
|
@ -1184,6 +1189,10 @@ public class PlayerNotificationManager {
|
|||
}
|
||||
}
|
||||
|
||||
// This class is generally used with a media session which does not require notification
|
||||
// permission.
|
||||
// https://developer.android.com/develop/ui/views/notifications/notification-permission#exemptions-media-sessions
|
||||
@SuppressLint("MissingPermission")
|
||||
private void startOrUpdateNotification(Player player, @Nullable Bitmap bitmap) {
|
||||
boolean ongoing = getOngoing(player);
|
||||
builder = createNotification(player, builder, ongoing, bitmap);
|
||||
|
|
|
|||
Loading…
Reference in a new issue