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

Commit 27faccff authored by Kyunglyul Hyun's avatar Kyunglyul Hyun Committed by Android (Google) Code Review
Browse files

Merge "Change MediaSession#isActiveState to PlaybackState#isActiveState"

parents 838cfbfb 278ec969
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -103,6 +103,10 @@ package android.media.session {
    field public static final int RESULT_MEDIA_KEY_NOT_HANDLED = 0; // 0x0
  }

  public final class PlaybackState implements android.os.Parcelable {
    method public boolean isActiveState();
  }

}

package android.net {
+1 −3
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.drawable.Icon;
import android.media.session.MediaController;
import android.media.session.MediaSession;
import android.media.session.MediaSessionManager;
import android.media.session.PlaybackState;
import android.os.UserHandle;
@@ -153,8 +152,7 @@ public class PipMediaController {
        }

        ArrayList<RemoteAction> mediaActions = new ArrayList<>();
        int state = mMediaController.getPlaybackState().getState();
        boolean isPlaying = MediaSession.isActiveState(state);
        boolean isPlaying = mMediaController.getPlaybackState().isActiveState();
        long actions = mMediaController.getPlaybackState().getActions();

        // Prev action
+0 −19
Original line number Diff line number Diff line
@@ -608,25 +608,6 @@ public final class MediaSession {
        return null;
    }

    /**
     * Return true if this is considered an active playback state.
     *
     * @hide
     */
    public static boolean isActiveState(int state) {
        switch (state) {
            case PlaybackState.STATE_FAST_FORWARDING:
            case PlaybackState.STATE_REWINDING:
            case PlaybackState.STATE_SKIPPING_TO_PREVIOUS:
            case PlaybackState.STATE_SKIPPING_TO_NEXT:
            case PlaybackState.STATE_BUFFERING:
            case PlaybackState.STATE_CONNECTING:
            case PlaybackState.STATE_PLAYING:
                return true;
        }
        return false;
    }

    /**
     * Returns whether the given bundle includes non-framework Parcelables.
     */
+20 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import android.annotation.DrawableRes;
import android.annotation.IntDef;
import android.annotation.LongDef;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -480,6 +481,25 @@ public final class PlaybackState implements Parcelable {
        return mExtras;
    }

    /**
     * Returns whether this is considered as an active playback state.
     * @hide
     */
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public boolean isActiveState() {
        switch (mState) {
            case PlaybackState.STATE_FAST_FORWARDING:
            case PlaybackState.STATE_REWINDING:
            case PlaybackState.STATE_SKIPPING_TO_PREVIOUS:
            case PlaybackState.STATE_SKIPPING_TO_NEXT:
            case PlaybackState.STATE_BUFFERING:
            case PlaybackState.STATE_CONNECTING:
            case PlaybackState.STATE_PLAYING:
                return true;
        }
        return false;
    }

    public static final @android.annotation.NonNull Parcelable.Creator<PlaybackState> CREATOR =
            new Parcelable.Creator<PlaybackState>() {
        @Override
+4 −0
Original line number Diff line number Diff line
@@ -93,6 +93,10 @@ package android.media.session {
    field public static final int RESULT_MEDIA_KEY_NOT_HANDLED = 0; // 0x0
  }

  public final class PlaybackState implements android.os.Parcelable {
    method public boolean isActiveState();
  }

}

package android.os {
Loading