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

Commit 70c8cb1d authored by Jaewan Kim's avatar Jaewan Kim
Browse files

MediaSession2Service: Unhide

Bug: 122563346
Test: Run CTS
Change-Id: Ic5ebad628ca6e2c71ec6a494dcd95515155dd92d
parent 990b4106
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -25915,6 +25915,23 @@ package android.media {
    method @Nullable public android.media.Session2Command.Result onSessionCommand(@NonNull android.media.MediaSession2, @NonNull android.media.MediaSession2.ControllerInfo, @NonNull android.media.Session2Command, @Nullable android.os.Bundle);
  }
  public abstract class MediaSession2Service extends android.app.Service {
    ctor public MediaSession2Service();
    method public final void addSession(@NonNull android.media.MediaSession2);
    method @NonNull public final java.util.List<android.media.MediaSession2> getSessions();
    method @CallSuper @Nullable public android.os.IBinder onBind(@NonNull android.content.Intent);
    method @NonNull public abstract android.media.MediaSession2 onGetPrimarySession();
    method @Nullable public abstract android.media.MediaSession2Service.MediaNotification onUpdateNotification(@NonNull android.media.MediaSession2);
    method public final void removeSession(@NonNull android.media.MediaSession2);
    field public static final String SERVICE_INTERFACE = "android.media.MediaSession2Service";
  }
  public static class MediaSession2Service.MediaNotification {
    ctor public MediaSession2Service.MediaNotification(int, @NonNull android.app.Notification);
    method @NonNull public android.app.Notification getNotification();
    method public int getNotificationId();
  }
  public final class MediaSync {
    ctor public MediaSync();
    method @NonNull public android.view.Surface createInputSurface();
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ public class MediaController2 implements AutoCloseable {
     * If it is not connected yet, it returns {@code null}.
     * <p>
     * This may differ with the {@link Session2Token} from the constructor. For example, if the
     * controller is created with the token for MediaSession2Service, this would return
     * controller is created with the token for {@link MediaSession2Service}, this would return
     * token for the {@link MediaSession2} in the service.
     *
     * @return Session2Token of the connected session, or {@code null} if not connected
+0 −9
Original line number Diff line number Diff line
@@ -43,9 +43,7 @@ import java.util.Map;
 * Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
 * <a href="{@docRoot}reference/androidx/media2/package-summary.html">Media2 Library</a>
 * for consistent behavior across all devices.
 * @hide
 */
// TODO: Unhide
public abstract class MediaSession2Service extends Service {
    /**
     * The {@link Intent} that must be declared as handled by the service.
@@ -110,13 +108,6 @@ public abstract class MediaSession2Service extends Service {
        return null;
    }

    @CallSuper
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        // TODO: Dispatch media key events to the primary session.
        return START_STICKY;
    }

    /**
     * Called by the system to notify that it is no longer used and is being removed. Do not call
     * this method directly.
+3 −10
Original line number Diff line number Diff line
@@ -48,14 +48,6 @@ import java.util.Objects;
 * <p>
 * It can be also obtained by {@link android.media.session.MediaSessionManager}.
 */
// New version of MediaSession2.Token for following reasons
//   - Stop implementing Parcelable for updatable support
//   - Represent session and library service (formerly browser service) in one class.
//     Previously MediaSession2.Token was for session and ComponentName was for service.
//     This helps controller apps to keep target of dispatching media key events in uniform way.
//     For details about the reason, see following. (Android O+)
//         android.media.session.MediaSessionManager.Callback#onAddressedPlayerChanged
// TODO: use @link for MediaSession2Service
public final class Session2Token implements Parcelable {
    private static final String TAG = "Session2Token";

@@ -85,12 +77,13 @@ public final class Session2Token implements Parcelable {
    public static final int TYPE_SESSION = 0;

    /**
     * Type for MediaSession2Service.
     * Type for {@link MediaSession2Service}.
     */
    public static final int TYPE_SESSION_SERVICE = 1;

    private final int mUid;
    private final @TokenType int mType;
    @TokenType
    private final int mType;
    private final String mPackageName;
    private final String mServiceName;
    private final Session2Link mSessionLink;