Commit a26d7b82 by christosts Committed by Andrew Lewis

Rename MediaNotificationHandler to MediaNotificationManager

PiperOrigin-RevId: 425359015
parent 23ef7b11
/*
* Copyright 2019 The Android Open Source Project
* Copyright 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -52,10 +52,10 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* Class to provide default media notification for {@link MediaSessionService}, and set the service
* as foreground/background according to the player state.
* Provides default media notifications for {@link MediaSessionService} and sets the service as
* foreground/background according to the player state.
*/
/* package */ class MediaNotificationHandler {
/* package */ final class MediaNotificationManager {
private static final int NOTIFICATION_ID = 1001;
private static final String NOTIFICATION_CHANNEL_ID = "default_channel_id";
......@@ -73,7 +73,7 @@ import java.util.concurrent.TimeoutException;
private final Map<MediaSession, ListenableFuture<MediaController>> controllerMap;
public MediaNotificationHandler(MediaSessionService service) {
public MediaNotificationManager(MediaSessionService service) {
this.service = service;
Handler mainHandler = new Handler(Looper.getMainLooper());
mainExecutor = (runnable) -> Util.postOrRun(mainHandler, runnable);
......
......@@ -145,7 +145,7 @@ public abstract class MediaSessionService extends Service {
@GuardedBy("lock")
@Nullable
private MediaNotificationHandler notificationHandler;
private MediaNotificationManager notificationHandler;
/** Creates a service. */
public MediaSessionService() {
......@@ -165,7 +165,7 @@ public abstract class MediaSessionService extends Service {
super.onCreate();
synchronized (lock) {
stub = new MediaSessionServiceStub(this);
notificationHandler = new MediaNotificationHandler(this);
notificationHandler = new MediaNotificationManager(this);
}
}
......@@ -227,7 +227,7 @@ public abstract class MediaSessionService extends Service {
if (old == null) {
// Session has returned for the first time. Register callbacks.
// TODO(b/191644474): Check whether the session is registered to multiple services.
MediaNotificationHandler handler;
MediaNotificationManager handler;
synchronized (lock) {
handler = checkStateNotNull(notificationHandler);
}
......@@ -245,7 +245,7 @@ public abstract class MediaSessionService extends Service {
*/
public final void removeSession(MediaSession session) {
checkNotNull(session, "session must not be null");
MediaNotificationHandler handler;
MediaNotificationManager handler;
synchronized (lock) {
sessions.remove(session.getId());
handler = checkStateNotNull(notificationHandler);
......@@ -273,7 +273,7 @@ public abstract class MediaSessionService extends Service {
@Nullable
public MediaNotification onUpdateNotification(MediaSession session) {
checkNotNull(session, "session must not be null");
MediaNotificationHandler handler;
MediaNotificationManager handler;
synchronized (lock) {
handler = checkStateNotNull(notificationHandler, "Service hasn't created");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment