Skip to content

Commit

Permalink
Rename MediaNotificationHandler to MediaNotificationManager
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 425359015
  • Loading branch information
christosts authored and andrewlewis committed Feb 1, 2022
1 parent 23ef7b1 commit a26d7b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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.
Expand Down Expand Up @@ -52,10 +52,10 @@
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";
Expand All @@ -73,7 +73,7 @@

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public abstract class MediaSessionService extends Service {

@GuardedBy("lock")
@Nullable
private MediaNotificationHandler notificationHandler;
private MediaNotificationManager notificationHandler;

/** Creates a service. */
public MediaSessionService() {
Expand All @@ -165,7 +165,7 @@ public void onCreate() {
super.onCreate();
synchronized (lock) {
stub = new MediaSessionServiceStub(this);
notificationHandler = new MediaNotificationHandler(this);
notificationHandler = new MediaNotificationManager(this);
}
}

Expand Down Expand Up @@ -227,7 +227,7 @@ public final void addSession(MediaSession session) {
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);
}
Expand All @@ -245,7 +245,7 @@ public final void addSession(MediaSession session) {
*/
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);
Expand Down Expand Up @@ -273,7 +273,7 @@ public final void removeSession(MediaSession session) {
@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");
}
Expand Down

0 comments on commit a26d7b8

Please sign in to comment.