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

Commit b7b3ddc7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove rolled out flag enableNullSessionInMediaBrowserService" into main

parents 8e52d9ff 87331839
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42206,7 +42206,7 @@ package android.service.media {
    method public abstract void onLoadChildren(@NonNull String, @NonNull android.service.media.MediaBrowserService.Result<java.util.List<android.media.browse.MediaBrowser.MediaItem>>);
    method public void onLoadChildren(@NonNull String, @NonNull android.service.media.MediaBrowserService.Result<java.util.List<android.media.browse.MediaBrowser.MediaItem>>, @NonNull android.os.Bundle);
    method public void onLoadItem(String, android.service.media.MediaBrowserService.Result<android.media.browse.MediaBrowser.MediaItem>);
    method public void setSessionToken(android.media.session.MediaSession.Token);
    method public void setSessionToken(@Nullable android.media.session.MediaSession.Token);
    field public static final String SERVICE_INTERFACE = "android.media.browse.MediaBrowserService";
  }
+9 −10
Original line number Diff line number Diff line
@@ -43,8 +43,6 @@ import android.util.ArrayMap;
import android.util.Log;
import android.util.Pair;

import com.android.media.flags.Flags;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
@@ -446,18 +444,19 @@ public abstract class MediaBrowserService extends Service {
     * Call to set the media session.
     *
     * <p>This should be called as soon as possible during the service's startup. It may only be
     * called once.
     * called once with a non-null session token.
     *
     * <p>Passing null as the token removes the current association with a {@link MediaSession} and
     * disconnects all existing {@link MediaBrowser} instances.
     *
     * @param token The token for the service's {@link MediaSession}.
     * @param token The token for the service's {@link MediaSession}, or null to remove the existing
     *     {@link MediaSession} from the service and disconnect all connected {@link MediaBrowser}
     *     instances.
     */
    // TODO: b/185136506 - Update the javadoc to reflect API changes when
    // enableNullSessionInMediaBrowserService makes it to nextfood.
    public void setSessionToken(final MediaSession.Token token) {
    public void setSessionToken(@Nullable final MediaSession.Token token) {
        ServiceState serviceState = mServiceState.get();
        if (token == null) {
            if (!Flags.enableNullSessionInMediaBrowserService()) {
                throw new IllegalArgumentException("Session token may not be null.");
            } else if (serviceState.mSession != null) {
            if (serviceState.mSession != null) {
                ServiceState newServiceState = new ServiceState();
                mBinder.setServiceState(newServiceState);
                mServiceState.set(newServiceState);