1// Signature format: 2.0 2package android.media { 3 4 public class MediaController2 implements java.lang.AutoCloseable { 5 method public void cancelSessionCommand(@NonNull Object); 6 method public void close(); 7 method @Nullable public android.media.Session2Token getConnectedToken(); 8 method public boolean isPlaybackActive(); 9 method @NonNull public Object sendSessionCommand(@NonNull android.media.Session2Command, @Nullable android.os.Bundle); 10 } 11 12 public static final class MediaController2.Builder { 13 ctor public MediaController2.Builder(@NonNull android.content.Context, @NonNull android.media.Session2Token); 14 method @NonNull public android.media.MediaController2 build(); 15 method @NonNull public android.media.MediaController2.Builder setConnectionHints(@NonNull android.os.Bundle); 16 method @NonNull public android.media.MediaController2.Builder setControllerCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaController2.ControllerCallback); 17 } 18 19 public abstract static class MediaController2.ControllerCallback { 20 ctor public MediaController2.ControllerCallback(); 21 method public void onCommandResult(@NonNull android.media.MediaController2, @NonNull Object, @NonNull android.media.Session2Command, @NonNull android.media.Session2Command.Result); 22 method public void onConnected(@NonNull android.media.MediaController2, @NonNull android.media.Session2CommandGroup); 23 method public void onDisconnected(@NonNull android.media.MediaController2); 24 method public void onPlaybackActiveChanged(@NonNull android.media.MediaController2, boolean); 25 method @Nullable public android.media.Session2Command.Result onSessionCommand(@NonNull android.media.MediaController2, @NonNull android.media.Session2Command, @Nullable android.os.Bundle); 26 } 27 28 public final class MediaParser { 29 method public boolean advance(@NonNull android.media.MediaParser.SeekableInputReader) throws java.io.IOException; 30 method @NonNull public static android.media.MediaParser create(@NonNull android.media.MediaParser.OutputConsumer, @NonNull java.lang.String...); 31 method @NonNull public static android.media.MediaParser createByName(@NonNull String, @NonNull android.media.MediaParser.OutputConsumer); 32 method @NonNull public String getParserName(); 33 method @NonNull public static java.util.List<java.lang.String> getParserNames(@NonNull android.media.MediaFormat); 34 method public void release(); 35 method public void seek(@NonNull android.media.MediaParser.SeekPoint); 36 method @NonNull public android.media.MediaParser setParameter(@NonNull String, @NonNull Object); 37 method public boolean supportsParameter(@NonNull String); 38 field public static final String PARAMETER_ADTS_ENABLE_CBR_SEEKING = "android.media.mediaparser.adts.enableCbrSeeking"; 39 field public static final String PARAMETER_AMR_ENABLE_CBR_SEEKING = "android.media.mediaparser.amr.enableCbrSeeking"; 40 field public static final String PARAMETER_FLAC_DISABLE_ID3 = "android.media.mediaparser.flac.disableId3"; 41 field public static final String PARAMETER_MATROSKA_DISABLE_CUES_SEEKING = "android.media.mediaparser.matroska.disableCuesSeeking"; 42 field public static final String PARAMETER_MP3_DISABLE_ID3 = "android.media.mediaparser.mp3.disableId3"; 43 field public static final String PARAMETER_MP3_ENABLE_CBR_SEEKING = "android.media.mediaparser.mp3.enableCbrSeeking"; 44 field public static final String PARAMETER_MP3_ENABLE_INDEX_SEEKING = "android.media.mediaparser.mp3.enableIndexSeeking"; 45 field public static final String PARAMETER_MP4_IGNORE_EDIT_LISTS = "android.media.mediaparser.mp4.ignoreEditLists"; 46 field public static final String PARAMETER_MP4_IGNORE_TFDT_BOX = "android.media.mediaparser.mp4.ignoreTfdtBox"; 47 field public static final String PARAMETER_MP4_TREAT_VIDEO_FRAMES_AS_KEYFRAMES = "android.media.mediaparser.mp4.treatVideoFramesAsKeyframes"; 48 field public static final String PARAMETER_TS_ALLOW_NON_IDR_AVC_KEYFRAMES = "android.media.mediaparser.ts.allowNonIdrAvcKeyframes"; 49 field public static final String PARAMETER_TS_DETECT_ACCESS_UNITS = "android.media.mediaparser.ts.ignoreDetectAccessUnits"; 50 field public static final String PARAMETER_TS_ENABLE_HDMV_DTS_AUDIO_STREAMS = "android.media.mediaparser.ts.enableHdmvDtsAudioStreams"; 51 field public static final String PARAMETER_TS_IGNORE_AAC_STREAM = "android.media.mediaparser.ts.ignoreAacStream"; 52 field public static final String PARAMETER_TS_IGNORE_AVC_STREAM = "android.media.mediaparser.ts.ignoreAvcStream"; 53 field public static final String PARAMETER_TS_IGNORE_SPLICE_INFO_STREAM = "android.media.mediaparser.ts.ignoreSpliceInfoStream"; 54 field public static final String PARAMETER_TS_MODE = "android.media.mediaparser.ts.mode"; 55 field public static final String PARSER_NAME_AC3 = "android.media.mediaparser.Ac3Parser"; 56 field public static final String PARSER_NAME_AC4 = "android.media.mediaparser.Ac4Parser"; 57 field public static final String PARSER_NAME_ADTS = "android.media.mediaparser.AdtsParser"; 58 field public static final String PARSER_NAME_AMR = "android.media.mediaparser.AmrParser"; 59 field public static final String PARSER_NAME_FLAC = "android.media.mediaparser.FlacParser"; 60 field public static final String PARSER_NAME_FLV = "android.media.mediaparser.FlvParser"; 61 field public static final String PARSER_NAME_FMP4 = "android.media.mediaparser.FragmentedMp4Parser"; 62 field public static final String PARSER_NAME_MATROSKA = "android.media.mediaparser.MatroskaParser"; 63 field public static final String PARSER_NAME_MP3 = "android.media.mediaparser.Mp3Parser"; 64 field public static final String PARSER_NAME_MP4 = "android.media.mediaparser.Mp4Parser"; 65 field public static final String PARSER_NAME_OGG = "android.media.mediaparser.OggParser"; 66 field public static final String PARSER_NAME_PS = "android.media.mediaparser.PsParser"; 67 field public static final String PARSER_NAME_TS = "android.media.mediaparser.TsParser"; 68 field public static final String PARSER_NAME_UNKNOWN = "android.media.mediaparser.UNKNOWN"; 69 field public static final String PARSER_NAME_WAV = "android.media.mediaparser.WavParser"; 70 field public static final int SAMPLE_FLAG_DECODE_ONLY = -2147483648; // 0x80000000 71 field public static final int SAMPLE_FLAG_ENCRYPTED = 1073741824; // 0x40000000 72 field public static final int SAMPLE_FLAG_HAS_SUPPLEMENTAL_DATA = 268435456; // 0x10000000 73 field public static final int SAMPLE_FLAG_KEY_FRAME = 1; // 0x1 74 field public static final int SAMPLE_FLAG_LAST_SAMPLE = 536870912; // 0x20000000 75 } 76 77 public static interface MediaParser.InputReader { 78 method public long getLength(); 79 method public long getPosition(); 80 method public int read(@NonNull byte[], int, int) throws java.io.IOException; 81 } 82 83 public static interface MediaParser.OutputConsumer { 84 method public void onSampleCompleted(int, long, int, int, int, @Nullable android.media.MediaCodec.CryptoInfo); 85 method public void onSampleDataFound(int, @NonNull android.media.MediaParser.InputReader) throws java.io.IOException; 86 method public void onSeekMapFound(@NonNull android.media.MediaParser.SeekMap); 87 method public void onTrackCountFound(int); 88 method public void onTrackDataFound(int, @NonNull android.media.MediaParser.TrackData); 89 } 90 91 public static final class MediaParser.ParsingException extends java.io.IOException { 92 } 93 94 public static final class MediaParser.SeekMap { 95 method public long getDurationMicros(); 96 method @NonNull public android.util.Pair<android.media.MediaParser.SeekPoint,android.media.MediaParser.SeekPoint> getSeekPoints(long); 97 method public boolean isSeekable(); 98 field public static final int UNKNOWN_DURATION = -2147483648; // 0x80000000 99 } 100 101 public static final class MediaParser.SeekPoint { 102 field @NonNull public static final android.media.MediaParser.SeekPoint START; 103 field public final long position; 104 field public final long timeMicros; 105 } 106 107 public static interface MediaParser.SeekableInputReader extends android.media.MediaParser.InputReader { 108 method public void seekToPosition(long); 109 } 110 111 public static final class MediaParser.TrackData { 112 field @Nullable public final android.media.DrmInitData drmInitData; 113 field @NonNull public final android.media.MediaFormat mediaFormat; 114 } 115 116 public static final class MediaParser.UnrecognizedInputFormatException extends java.io.IOException { 117 } 118 119 public class MediaSession2 implements java.lang.AutoCloseable { 120 method public void broadcastSessionCommand(@NonNull android.media.Session2Command, @Nullable android.os.Bundle); 121 method public void cancelSessionCommand(@NonNull android.media.MediaSession2.ControllerInfo, @NonNull Object); 122 method public void close(); 123 method @NonNull public java.util.List<android.media.MediaSession2.ControllerInfo> getConnectedControllers(); 124 method @NonNull public String getId(); 125 method @NonNull public android.media.Session2Token getToken(); 126 method public boolean isPlaybackActive(); 127 method @NonNull public Object sendSessionCommand(@NonNull android.media.MediaSession2.ControllerInfo, @NonNull android.media.Session2Command, @Nullable android.os.Bundle); 128 method public void setPlaybackActive(boolean); 129 } 130 131 public static final class MediaSession2.Builder { 132 ctor public MediaSession2.Builder(@NonNull android.content.Context); 133 method @NonNull public android.media.MediaSession2 build(); 134 method @NonNull public android.media.MediaSession2.Builder setExtras(@NonNull android.os.Bundle); 135 method @NonNull public android.media.MediaSession2.Builder setId(@NonNull String); 136 method @NonNull public android.media.MediaSession2.Builder setSessionActivity(@Nullable android.app.PendingIntent); 137 method @NonNull public android.media.MediaSession2.Builder setSessionCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaSession2.SessionCallback); 138 } 139 140 public static final class MediaSession2.ControllerInfo { 141 method @NonNull public android.os.Bundle getConnectionHints(); 142 method @NonNull public String getPackageName(); 143 method @NonNull public android.media.session.MediaSessionManager.RemoteUserInfo getRemoteUserInfo(); 144 method public int getUid(); 145 } 146 147 public abstract static class MediaSession2.SessionCallback { 148 ctor public MediaSession2.SessionCallback(); 149 method public void onCommandResult(@NonNull android.media.MediaSession2, @NonNull android.media.MediaSession2.ControllerInfo, @NonNull Object, @NonNull android.media.Session2Command, @NonNull android.media.Session2Command.Result); 150 method @Nullable public android.media.Session2CommandGroup onConnect(@NonNull android.media.MediaSession2, @NonNull android.media.MediaSession2.ControllerInfo); 151 method public void onDisconnected(@NonNull android.media.MediaSession2, @NonNull android.media.MediaSession2.ControllerInfo); 152 method public void onPostConnect(@NonNull android.media.MediaSession2, @NonNull android.media.MediaSession2.ControllerInfo); 153 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); 154 } 155 156 public abstract class MediaSession2Service extends android.app.Service { 157 ctor public MediaSession2Service(); 158 method public final void addSession(@NonNull android.media.MediaSession2); 159 method @NonNull public final java.util.List<android.media.MediaSession2> getSessions(); 160 method @CallSuper @Nullable public android.os.IBinder onBind(@NonNull android.content.Intent); 161 method @Nullable public abstract android.media.MediaSession2 onGetSession(@NonNull android.media.MediaSession2.ControllerInfo); 162 method @Nullable public abstract android.media.MediaSession2Service.MediaNotification onUpdateNotification(@NonNull android.media.MediaSession2); 163 method public final void removeSession(@NonNull android.media.MediaSession2); 164 field public static final String SERVICE_INTERFACE = "android.media.MediaSession2Service"; 165 } 166 167 public static class MediaSession2Service.MediaNotification { 168 ctor public MediaSession2Service.MediaNotification(int, @NonNull android.app.Notification); 169 method @NonNull public android.app.Notification getNotification(); 170 method public int getNotificationId(); 171 } 172 173 public final class Session2Command implements android.os.Parcelable { 174 ctor public Session2Command(int); 175 ctor public Session2Command(@NonNull String, @Nullable android.os.Bundle); 176 method public int describeContents(); 177 method public int getCommandCode(); 178 method @Nullable public String getCustomAction(); 179 method @Nullable public android.os.Bundle getCustomExtras(); 180 method public void writeToParcel(@NonNull android.os.Parcel, int); 181 field public static final int COMMAND_CODE_CUSTOM = 0; // 0x0 182 field @NonNull public static final android.os.Parcelable.Creator<android.media.Session2Command> CREATOR; 183 } 184 185 public static final class Session2Command.Result { 186 ctor public Session2Command.Result(int, @Nullable android.os.Bundle); 187 method public int getResultCode(); 188 method @Nullable public android.os.Bundle getResultData(); 189 field public static final int RESULT_ERROR_UNKNOWN_ERROR = -1; // 0xffffffff 190 field public static final int RESULT_INFO_SKIPPED = 1; // 0x1 191 field public static final int RESULT_SUCCESS = 0; // 0x0 192 } 193 194 public final class Session2CommandGroup implements android.os.Parcelable { 195 method public int describeContents(); 196 method @NonNull public java.util.Set<android.media.Session2Command> getCommands(); 197 method public boolean hasCommand(@NonNull android.media.Session2Command); 198 method public boolean hasCommand(int); 199 method public void writeToParcel(@NonNull android.os.Parcel, int); 200 field @NonNull public static final android.os.Parcelable.Creator<android.media.Session2CommandGroup> CREATOR; 201 } 202 203 public static final class Session2CommandGroup.Builder { 204 ctor public Session2CommandGroup.Builder(); 205 ctor public Session2CommandGroup.Builder(@NonNull android.media.Session2CommandGroup); 206 method @NonNull public android.media.Session2CommandGroup.Builder addCommand(@NonNull android.media.Session2Command); 207 method @NonNull public android.media.Session2CommandGroup build(); 208 method @NonNull public android.media.Session2CommandGroup.Builder removeCommand(@NonNull android.media.Session2Command); 209 } 210 211 public final class Session2Token implements android.os.Parcelable { 212 ctor public Session2Token(@NonNull android.content.Context, @NonNull android.content.ComponentName); 213 method public int describeContents(); 214 method @NonNull public android.os.Bundle getExtras(); 215 method @NonNull public String getPackageName(); 216 method @Nullable public String getServiceName(); 217 method public int getType(); 218 method public int getUid(); 219 method public void writeToParcel(android.os.Parcel, int); 220 field @NonNull public static final android.os.Parcelable.Creator<android.media.Session2Token> CREATOR; 221 field public static final int TYPE_SESSION = 0; // 0x0 222 field public static final int TYPE_SESSION_SERVICE = 1; // 0x1 223 } 224 225} 226 227