import typing

import android.app
import android.content
import android.media
import android.net
import android.os
import android.view
import java
import java.lang
import java.util
import java.util.concurrent

class MediaController(java.lang.Object):
    def __init__(self, context: android.content.Context, token: MediaSession.Token, /) -> None: ...
    def adjustVolume(self, direction: int | java.jint | java.lang.Integer, flags: int | java.jint | java.lang.Integer, /) -> None: ...
    def dispatchMediaButtonEvent(self, keyEvent: android.view.KeyEvent, /) -> bool: ...
    def getExtras(self) -> android.os.Bundle | None: ...
    def getFlags(self) -> int: ...
    def getMetadata(self) -> android.media.MediaMetadata | None: ...
    def getPackageName(self) -> str: ...
    def getPlaybackInfo(self) -> MediaController.PlaybackInfo: ...
    def getPlaybackState(self) -> PlaybackState | None: ...
    def getQueue(self) -> java.util.List[MediaSession.QueueItem] | None: ...
    def getQueueTitle(self) -> java.lang.CharSequence | None: ...
    def getRatingType(self) -> int: ...
    def getSessionActivity(self) -> android.app.PendingIntent | None: ...
    def getSessionInfo(self) -> android.os.Bundle: ...
    def getSessionToken(self) -> MediaSession.Token: ...
    def getTag(self) -> str: ...
    def getTransportControls(self) -> MediaController.TransportControls: ...
    @typing.overload
    def registerCallback(self, callback: MediaController.Callback, /) -> None: ...
    @typing.overload
    def registerCallback(self, callback: MediaController.Callback, handler: android.os.Handler, /) -> None: ...
    def sendCommand(self, command: str | java.lang.String, args: android.os.Bundle, cb: android.os.ResultReceiver, /) -> None: ...
    def setVolumeTo(self, value: int | java.jint | java.lang.Integer, flags: int | java.jint | java.lang.Integer, /) -> None: ...
    def unregisterCallback(self, callback: MediaController.Callback, /) -> None: ...

    class TransportControls(java.lang.Object):
        def fastForward(self) -> None: ...
        def pause(self) -> None: ...
        def play(self) -> None: ...
        def playFromMediaId(self, mediaId: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
        def playFromSearch(self, query: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
        def playFromUri(self, uri: android.net.Uri, extras: android.os.Bundle, /) -> None: ...
        def prepare(self) -> None: ...
        def prepareFromMediaId(self, mediaId: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
        def prepareFromSearch(self, query: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
        def prepareFromUri(self, uri: android.net.Uri, extras: android.os.Bundle, /) -> None: ...
        def rewind(self) -> None: ...
        def seekTo(self, pos: int | java.jlong | java.lang.Long, /) -> None: ...
        @typing.overload
        def sendCustomAction(self, customAction: PlaybackState.CustomAction, args: android.os.Bundle, /) -> None: ...
        @typing.overload
        def sendCustomAction(self, action: str | java.lang.String, args: android.os.Bundle, /) -> None: ...
        def setPlaybackSpeed(self, speed: float | java.jfloat | java.lang.Float, /) -> None: ...
        def setRating(self, rating: android.media.Rating, /) -> None: ...
        def skipToNext(self) -> None: ...
        def skipToPrevious(self) -> None: ...
        def skipToQueueItem(self, id: int | java.jlong | java.lang.Long, /) -> None: ...
        def stop(self) -> None: ...

    class PlaybackInfo(android.os.Parcelable):
        CREATOR: typing.ClassVar[android.os.Parcelable.Creator[MediaController.PlaybackInfo]] = ...
        PLAYBACK_TYPE_LOCAL: typing.ClassVar[int] = ...
        PLAYBACK_TYPE_REMOTE: typing.ClassVar[int] = ...
        def describeContents(self) -> int: ...
        def getAudioAttributes(self) -> android.media.AudioAttributes: ...
        def getCurrentVolume(self) -> int: ...
        def getMaxVolume(self) -> int: ...
        def getPlaybackType(self) -> int: ...
        def getVolumeControl(self) -> int: ...
        def getVolumeControlId(self) -> str: ...
        def toString(self) -> str: ...
        def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class Callback(java.lang.Object):
        def __init__(self) -> None: ...
        def onAudioInfoChanged(self, playbackInfo: MediaController.PlaybackInfo, /) -> None: ...
        def onExtrasChanged(self, extras: android.os.Bundle, /) -> None: ...
        def onMetadataChanged(self, metadata: android.media.MediaMetadata, /) -> None: ...
        def onPlaybackStateChanged(self, state: PlaybackState, /) -> None: ...
        def onQueueChanged(self, queue: java.util.List[MediaSession.QueueItem], /) -> None: ...
        def onQueueTitleChanged(self, title: java.lang.CharSequence, /) -> None: ...
        def onSessionDestroyed(self) -> None: ...
        def onSessionEvent(self, event: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...

class MediaSession(java.lang.Object):
    FLAG_HANDLES_MEDIA_BUTTONS: typing.ClassVar[int] = ...
    FLAG_HANDLES_TRANSPORT_CONTROLS: typing.ClassVar[int] = ...
    @typing.overload
    def __init__(self, context: android.content.Context, tag: str | java.lang.String, /) -> None: ...
    @typing.overload
    def __init__(self, context: android.content.Context, tag: str | java.lang.String, sessionInfo: android.os.Bundle, /) -> None: ...
    def getController(self) -> MediaController: ...
    def getCurrentControllerInfo(self) -> MediaSessionManager.RemoteUserInfo: ...
    def getSessionToken(self) -> MediaSession.Token: ...
    def isActive(self) -> bool: ...
    def release(self) -> None: ...
    def sendSessionEvent(self, event: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
    def setActive(self, active: bool | java.jboolean | java.lang.Boolean, /) -> None: ...
    @typing.overload
    def setCallback(self, callback: MediaSession.Callback, /) -> None: ...
    @typing.overload
    def setCallback(self, callback: MediaSession.Callback, handler: android.os.Handler, /) -> None: ...
    def setExtras(self, extras: android.os.Bundle, /) -> None: ...
    def setFlags(self, flags: int | java.jint | java.lang.Integer, /) -> None: ...
    def setMediaButtonBroadcastReceiver(self, broadcastReceiver: android.content.ComponentName, /) -> None: ...
    def setMediaButtonReceiver(self, mbr: android.app.PendingIntent, /) -> None: ...
    def setMetadata(self, metadata: android.media.MediaMetadata, /) -> None: ...
    def setPlaybackState(self, state: PlaybackState, /) -> None: ...
    def setPlaybackToLocal(self, attributes: android.media.AudioAttributes, /) -> None: ...
    def setPlaybackToRemote(self, volumeProvider: android.media.VolumeProvider, /) -> None: ...
    def setQueue(self, queue: java.util.List[MediaSession.QueueItem], /) -> None: ...
    def setQueueTitle(self, title: java.lang.CharSequence, /) -> None: ...
    def setRatingType(self, type: int | java.jint | java.lang.Integer, /) -> None: ...
    def setSessionActivity(self, pi: android.app.PendingIntent, /) -> None: ...

    class Token(android.os.Parcelable):
        CREATOR: typing.ClassVar[android.os.Parcelable.Creator[MediaSession.Token]] = ...
        def describeContents(self) -> int: ...
        def equals(self, obj: java.lang.Object | int | bool | float | str, /) -> bool: ...
        def hashCode(self) -> int: ...
        def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class QueueItem(android.os.Parcelable):
        CREATOR: typing.ClassVar[android.os.Parcelable.Creator[MediaSession.QueueItem]] = ...
        UNKNOWN_ID: typing.ClassVar[int] = ...
        def __init__(self, description: android.media.MediaDescription, id: int | java.jlong | java.lang.Long, /) -> None: ...
        def describeContents(self) -> int: ...
        def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
        def getDescription(self) -> android.media.MediaDescription: ...
        def getQueueId(self) -> int: ...
        def toString(self) -> str: ...
        def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class Callback(java.lang.Object):
        def __init__(self) -> None: ...
        def onCommand(self, command: str | java.lang.String, args: android.os.Bundle, cb: android.os.ResultReceiver, /) -> None: ...
        def onCustomAction(self, action: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
        def onFastForward(self) -> None: ...
        def onMediaButtonEvent(self, mediaButtonIntent: android.content.Intent, /) -> bool: ...
        def onPause(self) -> None: ...
        def onPlay(self) -> None: ...
        def onPlayFromMediaId(self, mediaId: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
        def onPlayFromSearch(self, query: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
        def onPlayFromUri(self, uri: android.net.Uri, extras: android.os.Bundle, /) -> None: ...
        def onPrepare(self) -> None: ...
        def onPrepareFromMediaId(self, mediaId: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
        def onPrepareFromSearch(self, query: str | java.lang.String, extras: android.os.Bundle, /) -> None: ...
        def onPrepareFromUri(self, uri: android.net.Uri, extras: android.os.Bundle, /) -> None: ...
        def onRewind(self) -> None: ...
        def onSeekTo(self, pos: int | java.jlong | java.lang.Long, /) -> None: ...
        def onSetPlaybackSpeed(self, speed: float | java.jfloat | java.lang.Float, /) -> None: ...
        def onSetRating(self, rating: android.media.Rating, /) -> None: ...
        def onSkipToNext(self) -> None: ...
        def onSkipToPrevious(self) -> None: ...
        def onSkipToQueueItem(self, id: int | java.jlong | java.lang.Long, /) -> None: ...
        def onStop(self) -> None: ...

class MediaSessionManager(java.lang.Object):
    @typing.overload
    def addOnActiveSessionsChangedListener(self, sessionListener: MediaSessionManager.OnActiveSessionsChangedListener, notificationListener: android.content.ComponentName, /) -> None: ...
    @typing.overload
    def addOnActiveSessionsChangedListener(self, sessionListener: MediaSessionManager.OnActiveSessionsChangedListener, notificationListener: android.content.ComponentName, handler: android.os.Handler, /) -> None: ...
    def addOnMediaKeyEventSessionChangedListener(self, executor: java.util.concurrent.Executor, listener: MediaSessionManager.OnMediaKeyEventSessionChangedListener, /) -> None: ...
    @typing.overload
    def addOnSession2TokensChangedListener(self, listener: MediaSessionManager.OnSession2TokensChangedListener, /) -> None: ...
    @typing.overload
    def addOnSession2TokensChangedListener(self, listener: MediaSessionManager.OnSession2TokensChangedListener, handler: android.os.Handler, /) -> None: ...
    def getActiveSessions(self, notificationListener: android.content.ComponentName, /) -> java.util.List[MediaController]: ...
    def getMediaKeyEventSession(self) -> MediaSession.Token | None: ...
    def getMediaKeyEventSessionPackageName(self) -> str: ...
    def getSession2Tokens(self) -> java.util.List[android.media.Session2Token]: ...
    def isTrustedForMediaControl(self, userInfo: MediaSessionManager.RemoteUserInfo, /) -> bool: ...
    def notifySession2Created(self, token: android.media.Session2Token, /) -> None: ...
    def removeOnActiveSessionsChangedListener(self, sessionListener: MediaSessionManager.OnActiveSessionsChangedListener, /) -> None: ...
    def removeOnMediaKeyEventSessionChangedListener(self, listener: MediaSessionManager.OnMediaKeyEventSessionChangedListener, /) -> None: ...
    def removeOnSession2TokensChangedListener(self, listener: MediaSessionManager.OnSession2TokensChangedListener, /) -> None: ...

    class RemoteUserInfo(java.lang.Object):
        def __init__(self, packageName: str | java.lang.String, pid: int | java.jint | java.lang.Integer, uid: int | java.jint | java.lang.Integer, /) -> None: ...
        def equals(self, obj: java.lang.Object | int | bool | float | str, /) -> bool: ...
        def getPackageName(self) -> str: ...
        def getPid(self) -> int: ...
        def getUid(self) -> int: ...
        def hashCode(self) -> int: ...

    class OnSession2TokensChangedListener(java.lang.Object):
        def onSession2TokensChanged(self, arg1: java.util.List[android.media.Session2Token], /) -> None: ...

    class OnMediaKeyEventSessionChangedListener(java.lang.Object):
        def onMediaKeyEventSessionChanged(self, arg1: str | java.lang.String, arg2: MediaSession.Token, /) -> None: ...

    class OnActiveSessionsChangedListener(java.lang.Object):
        def onActiveSessionsChanged(self, arg1: java.util.List[MediaController], /) -> None: ...

class PlaybackState(android.os.Parcelable):
    ACTION_FAST_FORWARD: typing.ClassVar[int] = ...
    ACTION_PAUSE: typing.ClassVar[int] = ...
    ACTION_PLAY: typing.ClassVar[int] = ...
    ACTION_PLAY_FROM_MEDIA_ID: typing.ClassVar[int] = ...
    ACTION_PLAY_FROM_SEARCH: typing.ClassVar[int] = ...
    ACTION_PLAY_FROM_URI: typing.ClassVar[int] = ...
    ACTION_PLAY_PAUSE: typing.ClassVar[int] = ...
    ACTION_PREPARE: typing.ClassVar[int] = ...
    ACTION_PREPARE_FROM_MEDIA_ID: typing.ClassVar[int] = ...
    ACTION_PREPARE_FROM_SEARCH: typing.ClassVar[int] = ...
    ACTION_PREPARE_FROM_URI: typing.ClassVar[int] = ...
    ACTION_REWIND: typing.ClassVar[int] = ...
    ACTION_SEEK_TO: typing.ClassVar[int] = ...
    ACTION_SET_PLAYBACK_SPEED: typing.ClassVar[int] = ...
    ACTION_SET_RATING: typing.ClassVar[int] = ...
    ACTION_SKIP_TO_NEXT: typing.ClassVar[int] = ...
    ACTION_SKIP_TO_PREVIOUS: typing.ClassVar[int] = ...
    ACTION_SKIP_TO_QUEUE_ITEM: typing.ClassVar[int] = ...
    ACTION_STOP: typing.ClassVar[int] = ...
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[PlaybackState]] = ...
    PLAYBACK_POSITION_UNKNOWN: typing.ClassVar[int] = ...
    STATE_BUFFERING: typing.ClassVar[int] = ...
    STATE_CONNECTING: typing.ClassVar[int] = ...
    STATE_ERROR: typing.ClassVar[int] = ...
    STATE_FAST_FORWARDING: typing.ClassVar[int] = ...
    STATE_NONE: typing.ClassVar[int] = ...
    STATE_PAUSED: typing.ClassVar[int] = ...
    STATE_PLAYING: typing.ClassVar[int] = ...
    STATE_REWINDING: typing.ClassVar[int] = ...
    STATE_SKIPPING_TO_NEXT: typing.ClassVar[int] = ...
    STATE_SKIPPING_TO_PREVIOUS: typing.ClassVar[int] = ...
    STATE_SKIPPING_TO_QUEUE_ITEM: typing.ClassVar[int] = ...
    STATE_STOPPED: typing.ClassVar[int] = ...
    def describeContents(self) -> int: ...
    def getActions(self) -> int: ...
    def getActiveQueueItemId(self) -> int: ...
    def getBufferedPosition(self) -> int: ...
    def getCustomActions(self) -> java.util.List[PlaybackState.CustomAction]: ...
    def getErrorMessage(self) -> java.lang.CharSequence: ...
    def getExtras(self) -> android.os.Bundle | None: ...
    def getLastPositionUpdateTime(self) -> int: ...
    def getPlaybackSpeed(self) -> float: ...
    def getPosition(self) -> int: ...
    def getState(self) -> int: ...
    def isActive(self) -> bool: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class CustomAction(android.os.Parcelable):
        CREATOR: typing.ClassVar[android.os.Parcelable.Creator[PlaybackState.CustomAction]] = ...
        def describeContents(self) -> int: ...
        def getAction(self) -> str: ...
        def getExtras(self) -> android.os.Bundle: ...
        def getIcon(self) -> int: ...
        def getName(self) -> java.lang.CharSequence: ...
        def toString(self) -> str: ...
        def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

        class Builder(java.lang.Object):
            def __init__(self, action: str | java.lang.String, name: java.lang.CharSequence, icon: int | java.jint | java.lang.Integer, /) -> None: ...
            def build(self) -> PlaybackState.CustomAction: ...
            def setExtras(self, extras: android.os.Bundle, /) -> PlaybackState.CustomAction.Builder: ...

    class Builder(java.lang.Object):
        @typing.overload
        def __init__(self) -> None: ...
        @typing.overload
        def __init__(self, from_: PlaybackState, /) -> None: ...
        @typing.overload
        def addCustomAction(self, customAction: PlaybackState.CustomAction, /) -> PlaybackState.Builder: ...
        @typing.overload
        def addCustomAction(self, action: str | java.lang.String, name: str | java.lang.String, icon: int | java.jint | java.lang.Integer, /) -> PlaybackState.Builder: ...
        def build(self) -> PlaybackState: ...
        def setActions(self, actions: int | java.jlong | java.lang.Long, /) -> PlaybackState.Builder: ...
        def setActiveQueueItemId(self, id: int | java.jlong | java.lang.Long, /) -> PlaybackState.Builder: ...
        def setBufferedPosition(self, bufferedPosition: int | java.jlong | java.lang.Long, /) -> PlaybackState.Builder: ...
        def setErrorMessage(self, error: java.lang.CharSequence, /) -> PlaybackState.Builder: ...
        def setExtras(self, extras: android.os.Bundle, /) -> PlaybackState.Builder: ...
        @typing.overload
        def setState(self, state: int | java.jint | java.lang.Integer, position: int | java.jlong | java.lang.Long, playbackSpeed: float | java.jfloat | java.lang.Float, /) -> PlaybackState.Builder: ...
        @typing.overload
        def setState(self, state: int | java.jint | java.lang.Integer, position: int | java.jlong | java.lang.Long, playbackSpeed: float | java.jfloat | java.lang.Float, updateTime: int | java.jlong | java.lang.Long, /) -> PlaybackState.Builder: ...
