Initial commit
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.IInterface;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
import android.support.v4.media.MediaMetadataCompat;
|
||||
import android.support.v4.media.session.MediaSessionCompat;
|
||||
import android.text.TextUtils;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IMediaControllerCallback extends IInterface {
|
||||
|
||||
public static abstract class Stub extends Binder implements IMediaControllerCallback {
|
||||
public Stub() {
|
||||
attachInterface(this, "android.support.v4.media.session.IMediaControllerCallback");
|
||||
}
|
||||
|
||||
@Override // android.os.IInterface
|
||||
public IBinder asBinder() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.os.Binder
|
||||
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
|
||||
if (i == 1598968902) {
|
||||
parcel2.writeString("android.support.v4.media.session.IMediaControllerCallback");
|
||||
return true;
|
||||
}
|
||||
switch (i) {
|
||||
case 1:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
c(parcel.readString(), parcel.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(parcel) : null);
|
||||
return true;
|
||||
case 2:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
b();
|
||||
return true;
|
||||
case 3:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
a(parcel.readInt() != 0 ? PlaybackStateCompat.CREATOR.createFromParcel(parcel) : null);
|
||||
return true;
|
||||
case 4:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
a(parcel.readInt() != 0 ? MediaMetadataCompat.CREATOR.createFromParcel(parcel) : null);
|
||||
return true;
|
||||
case 5:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
a(parcel.createTypedArrayList(MediaSessionCompat.QueueItem.CREATOR));
|
||||
return true;
|
||||
case 6:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
a(parcel.readInt() != 0 ? (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel) : null);
|
||||
return true;
|
||||
case 7:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
a(parcel.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(parcel) : null);
|
||||
return true;
|
||||
case 8:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
a(parcel.readInt() != 0 ? ParcelableVolumeInfo.CREATOR.createFromParcel(parcel) : null);
|
||||
return true;
|
||||
case 9:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
g(parcel.readInt());
|
||||
return true;
|
||||
case 10:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
c(parcel.readInt() != 0);
|
||||
return true;
|
||||
case 11:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
b(parcel.readInt() != 0);
|
||||
return true;
|
||||
case 12:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
h(parcel.readInt());
|
||||
return true;
|
||||
case 13:
|
||||
parcel.enforceInterface("android.support.v4.media.session.IMediaControllerCallback");
|
||||
f();
|
||||
return true;
|
||||
default:
|
||||
return super.onTransact(i, parcel, parcel2, i2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void a(Bundle bundle) throws RemoteException;
|
||||
|
||||
void a(MediaMetadataCompat mediaMetadataCompat) throws RemoteException;
|
||||
|
||||
void a(ParcelableVolumeInfo parcelableVolumeInfo) throws RemoteException;
|
||||
|
||||
void a(PlaybackStateCompat playbackStateCompat) throws RemoteException;
|
||||
|
||||
void a(CharSequence charSequence) throws RemoteException;
|
||||
|
||||
void a(List<MediaSessionCompat.QueueItem> list) throws RemoteException;
|
||||
|
||||
void b() throws RemoteException;
|
||||
|
||||
void b(boolean z) throws RemoteException;
|
||||
|
||||
void c(String str, Bundle bundle) throws RemoteException;
|
||||
|
||||
void c(boolean z) throws RemoteException;
|
||||
|
||||
void f() throws RemoteException;
|
||||
|
||||
void g(int i) throws RemoteException;
|
||||
|
||||
void h(int i) throws RemoteException;
|
||||
}
|
74
sources/android/support/v4/media/session/IMediaSession.java
Normal file
74
sources/android/support/v4/media/session/IMediaSession.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.os.IInterface;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IMediaSession extends IInterface {
|
||||
void a(IMediaControllerCallback iMediaControllerCallback) throws RemoteException;
|
||||
|
||||
boolean a(KeyEvent keyEvent) throws RemoteException;
|
||||
|
||||
public static abstract class Stub extends Binder implements IMediaSession {
|
||||
public static IMediaSession a(IBinder iBinder) {
|
||||
if (iBinder == null) {
|
||||
return null;
|
||||
}
|
||||
IInterface queryLocalInterface = iBinder.queryLocalInterface("android.support.v4.media.session.IMediaSession");
|
||||
return (queryLocalInterface == null || !(queryLocalInterface instanceof IMediaSession)) ? new Proxy(iBinder) : (IMediaSession) queryLocalInterface;
|
||||
}
|
||||
|
||||
private static class Proxy implements IMediaSession {
|
||||
private IBinder a;
|
||||
|
||||
Proxy(IBinder iBinder) {
|
||||
this.a = iBinder;
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaSession
|
||||
public boolean a(KeyEvent keyEvent) throws RemoteException {
|
||||
Parcel obtain = Parcel.obtain();
|
||||
Parcel obtain2 = Parcel.obtain();
|
||||
try {
|
||||
obtain.writeInterfaceToken("android.support.v4.media.session.IMediaSession");
|
||||
if (keyEvent != null) {
|
||||
obtain.writeInt(1);
|
||||
keyEvent.writeToParcel(obtain, 0);
|
||||
} else {
|
||||
obtain.writeInt(0);
|
||||
}
|
||||
this.a.transact(2, obtain, obtain2, 0);
|
||||
obtain2.readException();
|
||||
return obtain2.readInt() != 0;
|
||||
} finally {
|
||||
obtain2.recycle();
|
||||
obtain.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.os.IInterface
|
||||
public IBinder asBinder() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaSession
|
||||
public void a(IMediaControllerCallback iMediaControllerCallback) throws RemoteException {
|
||||
Parcel obtain = Parcel.obtain();
|
||||
Parcel obtain2 = Parcel.obtain();
|
||||
try {
|
||||
obtain.writeInterfaceToken("android.support.v4.media.session.IMediaSession");
|
||||
obtain.writeStrongBinder(iMediaControllerCallback != null ? iMediaControllerCallback.asBinder() : null);
|
||||
this.a.transact(3, obtain, obtain2, 0);
|
||||
obtain2.readException();
|
||||
} finally {
|
||||
obtain2.recycle();
|
||||
obtain.recycle();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,442 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ResultReceiver;
|
||||
import android.support.v4.media.MediaMetadataCompat;
|
||||
import android.support.v4.media.session.IMediaControllerCallback;
|
||||
import android.support.v4.media.session.IMediaSession;
|
||||
import android.support.v4.media.session.MediaControllerCompatApi21;
|
||||
import android.support.v4.media.session.MediaSessionCompat;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import androidx.core.app.BundleCompat;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class MediaControllerCompat {
|
||||
private final MediaControllerImpl a;
|
||||
|
||||
public static abstract class Callback implements IBinder.DeathRecipient {
|
||||
MessageHandler a;
|
||||
IMediaControllerCallback b;
|
||||
|
||||
private class MessageHandler extends Handler {
|
||||
}
|
||||
|
||||
public Callback() {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
MediaControllerCompatApi21.a(new StubApi21(this));
|
||||
} else {
|
||||
this.b = new StubCompat(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
}
|
||||
|
||||
void a(int i, Object obj, Bundle bundle) {
|
||||
MessageHandler messageHandler = this.a;
|
||||
if (messageHandler != null) {
|
||||
Message obtainMessage = messageHandler.obtainMessage(i, obj);
|
||||
obtainMessage.setData(bundle);
|
||||
obtainMessage.sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Bundle bundle) {
|
||||
}
|
||||
|
||||
public void a(MediaMetadataCompat mediaMetadataCompat) {
|
||||
}
|
||||
|
||||
public void a(PlaybackInfo playbackInfo) {
|
||||
}
|
||||
|
||||
public void a(PlaybackStateCompat playbackStateCompat) {
|
||||
}
|
||||
|
||||
public void a(CharSequence charSequence) {
|
||||
}
|
||||
|
||||
public void a(String str, Bundle bundle) {
|
||||
}
|
||||
|
||||
public void a(List<MediaSessionCompat.QueueItem> list) {
|
||||
}
|
||||
|
||||
@Override // android.os.IBinder.DeathRecipient
|
||||
public void binderDied() {
|
||||
a(8, null, null);
|
||||
}
|
||||
|
||||
private static class StubApi21 implements MediaControllerCompatApi21.Callback {
|
||||
private final WeakReference<Callback> a;
|
||||
|
||||
StubApi21(Callback callback) {
|
||||
this.a = new WeakReference<>(callback);
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompatApi21.Callback
|
||||
public void a(String str, Bundle bundle) {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
if (callback.b == null || Build.VERSION.SDK_INT >= 23) {
|
||||
callback.a(str, bundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompatApi21.Callback
|
||||
public void b() {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompatApi21.Callback
|
||||
public void b(Object obj) {
|
||||
Callback callback = this.a.get();
|
||||
if (callback == null || callback.b != null) {
|
||||
return;
|
||||
}
|
||||
callback.a(PlaybackStateCompat.fromPlaybackState(obj));
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompatApi21.Callback
|
||||
public void a(Object obj) {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(MediaMetadataCompat.fromMediaMetadata(obj));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompatApi21.Callback
|
||||
public void a(List<?> list) {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(MediaSessionCompat.QueueItem.fromQueueItemList(list));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompatApi21.Callback
|
||||
public void a(CharSequence charSequence) {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompatApi21.Callback
|
||||
public void a(Bundle bundle) {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompatApi21.Callback
|
||||
public void a(int i, int i2, int i3, int i4, int i5) {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(new PlaybackInfo(i, i2, i3, i4, i5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class StubCompat extends IMediaControllerCallback.Stub {
|
||||
private final WeakReference<Callback> a;
|
||||
|
||||
StubCompat(Callback callback) {
|
||||
this.a = new WeakReference<>(callback);
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(PlaybackStateCompat playbackStateCompat) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(2, playbackStateCompat, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void b() throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(8, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void c(String str, Bundle bundle) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(1, str, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void c(boolean z) throws RemoteException {
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void f() throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(13, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void g(int i) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(9, Integer.valueOf(i), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void h(int i) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(12, Integer.valueOf(i), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(MediaMetadataCompat mediaMetadataCompat) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(3, mediaMetadataCompat, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void b(boolean z) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(11, Boolean.valueOf(z), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(List<MediaSessionCompat.QueueItem> list) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(5, list, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(CharSequence charSequence) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(6, charSequence, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(Bundle bundle) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(7, bundle, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(ParcelableVolumeInfo parcelableVolumeInfo) throws RemoteException {
|
||||
Callback callback = this.a.get();
|
||||
if (callback != null) {
|
||||
callback.a(4, parcelableVolumeInfo != null ? new PlaybackInfo(parcelableVolumeInfo.volumeType, parcelableVolumeInfo.audioStream, parcelableVolumeInfo.controlType, parcelableVolumeInfo.maxVolume, parcelableVolumeInfo.currentVolume) : null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface MediaControllerImpl {
|
||||
boolean a(KeyEvent keyEvent);
|
||||
}
|
||||
|
||||
static class MediaControllerImplApi21 implements MediaControllerImpl {
|
||||
protected final Object a;
|
||||
final Object b = new Object();
|
||||
private final List<Callback> c = new ArrayList();
|
||||
private HashMap<Callback, ExtraCallback> d = new HashMap<>();
|
||||
final MediaSessionCompat.Token e;
|
||||
|
||||
private static class ExtraBinderRequestResultReceiver extends ResultReceiver {
|
||||
private WeakReference<MediaControllerImplApi21> mMediaControllerImpl;
|
||||
|
||||
ExtraBinderRequestResultReceiver(MediaControllerImplApi21 mediaControllerImplApi21) {
|
||||
super(null);
|
||||
this.mMediaControllerImpl = new WeakReference<>(mediaControllerImplApi21);
|
||||
}
|
||||
|
||||
@Override // android.os.ResultReceiver
|
||||
protected void onReceiveResult(int i, Bundle bundle) {
|
||||
MediaControllerImplApi21 mediaControllerImplApi21 = this.mMediaControllerImpl.get();
|
||||
if (mediaControllerImplApi21 == null || bundle == null) {
|
||||
return;
|
||||
}
|
||||
synchronized (mediaControllerImplApi21.b) {
|
||||
mediaControllerImplApi21.e.setExtraBinder(IMediaSession.Stub.a(BundleCompat.a(bundle, "android.support.v4.media.session.EXTRA_BINDER")));
|
||||
mediaControllerImplApi21.e.setSessionToken2Bundle(bundle.getBundle("android.support.v4.media.session.SESSION_TOKEN2_BUNDLE"));
|
||||
mediaControllerImplApi21.a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ExtraCallback extends Callback.StubCompat {
|
||||
ExtraCallback(Callback callback) {
|
||||
super(callback);
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompat.Callback.StubCompat, android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(MediaMetadataCompat mediaMetadataCompat) throws RemoteException {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompat.Callback.StubCompat, android.support.v4.media.session.IMediaControllerCallback
|
||||
public void b() throws RemoteException {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompat.Callback.StubCompat, android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(List<MediaSessionCompat.QueueItem> list) throws RemoteException {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompat.Callback.StubCompat, android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(CharSequence charSequence) throws RemoteException {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompat.Callback.StubCompat, android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(Bundle bundle) throws RemoteException {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompat.Callback.StubCompat, android.support.v4.media.session.IMediaControllerCallback
|
||||
public void a(ParcelableVolumeInfo parcelableVolumeInfo) throws RemoteException {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
public MediaControllerImplApi21(Context context, MediaSessionCompat.Token token) throws RemoteException {
|
||||
this.e = token;
|
||||
this.a = MediaControllerCompatApi21.a(context, this.e.getToken());
|
||||
if (this.a == null) {
|
||||
throw new RemoteException();
|
||||
}
|
||||
if (this.e.getExtraBinder() == null) {
|
||||
b();
|
||||
}
|
||||
}
|
||||
|
||||
private void b() {
|
||||
a("android.support.v4.media.session.command.GET_EXTRA_BINDER", null, new ExtraBinderRequestResultReceiver(this));
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompat.MediaControllerImpl
|
||||
public boolean a(KeyEvent keyEvent) {
|
||||
return MediaControllerCompatApi21.a(this.a, keyEvent);
|
||||
}
|
||||
|
||||
public void a(String str, Bundle bundle, ResultReceiver resultReceiver) {
|
||||
MediaControllerCompatApi21.a(this.a, str, bundle, resultReceiver);
|
||||
}
|
||||
|
||||
void a() {
|
||||
if (this.e.getExtraBinder() == null) {
|
||||
return;
|
||||
}
|
||||
for (Callback callback : this.c) {
|
||||
ExtraCallback extraCallback = new ExtraCallback(callback);
|
||||
this.d.put(callback, extraCallback);
|
||||
callback.b = extraCallback;
|
||||
try {
|
||||
this.e.getExtraBinder().a(extraCallback);
|
||||
callback.a(13, null, null);
|
||||
} catch (RemoteException e) {
|
||||
Log.e("MediaControllerCompat", "Dead object in registerCallback.", e);
|
||||
}
|
||||
}
|
||||
this.c.clear();
|
||||
}
|
||||
}
|
||||
|
||||
static class MediaControllerImplApi23 extends MediaControllerImplApi21 {
|
||||
public MediaControllerImplApi23(Context context, MediaSessionCompat.Token token) throws RemoteException {
|
||||
super(context, token);
|
||||
}
|
||||
}
|
||||
|
||||
static class MediaControllerImplApi24 extends MediaControllerImplApi23 {
|
||||
public MediaControllerImplApi24(Context context, MediaSessionCompat.Token token) throws RemoteException {
|
||||
super(context, token);
|
||||
}
|
||||
}
|
||||
|
||||
static class MediaControllerImplBase implements MediaControllerImpl {
|
||||
private IMediaSession a;
|
||||
|
||||
public MediaControllerImplBase(MediaSessionCompat.Token token) {
|
||||
this.a = IMediaSession.Stub.a((IBinder) token.getToken());
|
||||
}
|
||||
|
||||
@Override // android.support.v4.media.session.MediaControllerCompat.MediaControllerImpl
|
||||
public boolean a(KeyEvent keyEvent) {
|
||||
if (keyEvent == null) {
|
||||
throw new IllegalArgumentException("event may not be null.");
|
||||
}
|
||||
try {
|
||||
this.a.a(keyEvent);
|
||||
return false;
|
||||
} catch (RemoteException e) {
|
||||
Log.e("MediaControllerCompat", "Dead object in dispatchMediaButtonEvent.", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final class PlaybackInfo {
|
||||
PlaybackInfo(int i, int i2, int i3, int i4, int i5) {
|
||||
}
|
||||
}
|
||||
|
||||
public MediaControllerCompat(Context context, MediaSessionCompat.Token token) throws RemoteException {
|
||||
new HashSet();
|
||||
if (token == null) {
|
||||
throw new IllegalArgumentException("sessionToken must not be null");
|
||||
}
|
||||
int i = Build.VERSION.SDK_INT;
|
||||
if (i >= 24) {
|
||||
this.a = new MediaControllerImplApi24(context, token);
|
||||
return;
|
||||
}
|
||||
if (i >= 23) {
|
||||
this.a = new MediaControllerImplApi23(context, token);
|
||||
} else if (i >= 21) {
|
||||
this.a = new MediaControllerImplApi21(context, token);
|
||||
} else {
|
||||
this.a = new MediaControllerImplBase(token);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(KeyEvent keyEvent) {
|
||||
if (keyEvent != null) {
|
||||
return this.a.a(keyEvent);
|
||||
}
|
||||
throw new IllegalArgumentException("KeyEvent may not be null");
|
||||
}
|
||||
}
|
@@ -0,0 +1,144 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.MediaMetadata;
|
||||
import android.media.session.MediaController;
|
||||
import android.media.session.MediaSession;
|
||||
import android.media.session.PlaybackState;
|
||||
import android.os.Bundle;
|
||||
import android.os.ResultReceiver;
|
||||
import android.view.KeyEvent;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class MediaControllerCompatApi21 {
|
||||
|
||||
public interface Callback {
|
||||
void a(int i, int i2, int i3, int i4, int i5);
|
||||
|
||||
void a(Bundle bundle);
|
||||
|
||||
void a(CharSequence charSequence);
|
||||
|
||||
void a(Object obj);
|
||||
|
||||
void a(String str, Bundle bundle);
|
||||
|
||||
void a(List<?> list);
|
||||
|
||||
void b();
|
||||
|
||||
void b(Object obj);
|
||||
}
|
||||
|
||||
static class CallbackProxy<T extends Callback> extends MediaController.Callback {
|
||||
protected final T a;
|
||||
|
||||
public CallbackProxy(T t) {
|
||||
this.a = t;
|
||||
}
|
||||
|
||||
@Override // android.media.session.MediaController.Callback
|
||||
public void onAudioInfoChanged(MediaController.PlaybackInfo playbackInfo) {
|
||||
this.a.a(playbackInfo.getPlaybackType(), PlaybackInfo.b(playbackInfo), playbackInfo.getVolumeControl(), playbackInfo.getMaxVolume(), playbackInfo.getCurrentVolume());
|
||||
}
|
||||
|
||||
@Override // android.media.session.MediaController.Callback
|
||||
public void onExtrasChanged(Bundle bundle) {
|
||||
MediaSessionCompat.a(bundle);
|
||||
this.a.a(bundle);
|
||||
}
|
||||
|
||||
@Override // android.media.session.MediaController.Callback
|
||||
public void onMetadataChanged(MediaMetadata mediaMetadata) {
|
||||
this.a.a(mediaMetadata);
|
||||
}
|
||||
|
||||
@Override // android.media.session.MediaController.Callback
|
||||
public void onPlaybackStateChanged(PlaybackState playbackState) {
|
||||
this.a.b(playbackState);
|
||||
}
|
||||
|
||||
@Override // android.media.session.MediaController.Callback
|
||||
public void onQueueChanged(List<MediaSession.QueueItem> list) {
|
||||
this.a.a(list);
|
||||
}
|
||||
|
||||
@Override // android.media.session.MediaController.Callback
|
||||
public void onQueueTitleChanged(CharSequence charSequence) {
|
||||
this.a.a(charSequence);
|
||||
}
|
||||
|
||||
@Override // android.media.session.MediaController.Callback
|
||||
public void onSessionDestroyed() {
|
||||
this.a.b();
|
||||
}
|
||||
|
||||
@Override // android.media.session.MediaController.Callback
|
||||
public void onSessionEvent(String str, Bundle bundle) {
|
||||
MediaSessionCompat.a(bundle);
|
||||
this.a.a(str, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlaybackInfo {
|
||||
public static AudioAttributes a(Object obj) {
|
||||
return ((MediaController.PlaybackInfo) obj).getAudioAttributes();
|
||||
}
|
||||
|
||||
public static int b(Object obj) {
|
||||
return a(a(obj));
|
||||
}
|
||||
|
||||
private static int a(AudioAttributes audioAttributes) {
|
||||
if ((audioAttributes.getFlags() & 1) == 1) {
|
||||
return 7;
|
||||
}
|
||||
if ((audioAttributes.getFlags() & 4) == 4) {
|
||||
return 6;
|
||||
}
|
||||
switch (audioAttributes.getUsage()) {
|
||||
case 1:
|
||||
case 11:
|
||||
case 12:
|
||||
case 14:
|
||||
return 3;
|
||||
case 2:
|
||||
return 0;
|
||||
case 3:
|
||||
return 8;
|
||||
case 4:
|
||||
return 4;
|
||||
case 5:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
return 5;
|
||||
case 6:
|
||||
return 2;
|
||||
case 13:
|
||||
return 1;
|
||||
default:
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Object a(Context context, Object obj) {
|
||||
return new MediaController(context, (MediaSession.Token) obj);
|
||||
}
|
||||
|
||||
public static Object a(Callback callback) {
|
||||
return new CallbackProxy(callback);
|
||||
}
|
||||
|
||||
public static boolean a(Object obj, KeyEvent keyEvent) {
|
||||
return ((MediaController) obj).dispatchMediaButtonEvent(keyEvent);
|
||||
}
|
||||
|
||||
public static void a(Object obj, String str, Bundle bundle, ResultReceiver resultReceiver) {
|
||||
((MediaController) obj).sendCommand(str, bundle, resultReceiver);
|
||||
}
|
||||
}
|
284
sources/android/support/v4/media/session/MediaSessionCompat.java
Normal file
284
sources/android/support/v4/media/session/MediaSessionCompat.java
Normal file
@@ -0,0 +1,284 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.ResultReceiver;
|
||||
import android.support.v4.media.MediaDescriptionCompat;
|
||||
import android.support.v4.media.session.IMediaSession;
|
||||
import android.support.v4.media.session.MediaSessionCompatApi21;
|
||||
import androidx.core.app.BundleCompat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MediaSessionCompat {
|
||||
|
||||
public static final class QueueItem implements Parcelable {
|
||||
public static final Parcelable.Creator<QueueItem> CREATOR = new Parcelable.Creator<QueueItem>() { // from class: android.support.v4.media.session.MediaSessionCompat.QueueItem.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public QueueItem createFromParcel(Parcel parcel) {
|
||||
return new QueueItem(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public QueueItem[] newArray(int i) {
|
||||
return new QueueItem[i];
|
||||
}
|
||||
};
|
||||
public static final int UNKNOWN_ID = -1;
|
||||
private final MediaDescriptionCompat mDescription;
|
||||
private final long mId;
|
||||
private Object mItem;
|
||||
|
||||
public QueueItem(MediaDescriptionCompat mediaDescriptionCompat, long j) {
|
||||
this(null, mediaDescriptionCompat, j);
|
||||
}
|
||||
|
||||
public static QueueItem fromQueueItem(Object obj) {
|
||||
if (obj == null || Build.VERSION.SDK_INT < 21) {
|
||||
return null;
|
||||
}
|
||||
return new QueueItem(obj, MediaDescriptionCompat.fromMediaDescription(MediaSessionCompatApi21.QueueItem.a(obj)), MediaSessionCompatApi21.QueueItem.b(obj));
|
||||
}
|
||||
|
||||
public static List<QueueItem> fromQueueItemList(List<?> list) {
|
||||
if (list == null || Build.VERSION.SDK_INT < 21) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator<?> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(fromQueueItem(it.next()));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public MediaDescriptionCompat getDescription() {
|
||||
return this.mDescription;
|
||||
}
|
||||
|
||||
public long getQueueId() {
|
||||
return this.mId;
|
||||
}
|
||||
|
||||
public Object getQueueItem() {
|
||||
if (this.mItem != null || Build.VERSION.SDK_INT < 21) {
|
||||
return this.mItem;
|
||||
}
|
||||
this.mItem = MediaSessionCompatApi21.QueueItem.a(this.mDescription.getMediaDescription(), this.mId);
|
||||
return this.mItem;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "MediaSession.QueueItem {Description=" + this.mDescription + ", Id=" + this.mId + " }";
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
this.mDescription.writeToParcel(parcel, i);
|
||||
parcel.writeLong(this.mId);
|
||||
}
|
||||
|
||||
private QueueItem(Object obj, MediaDescriptionCompat mediaDescriptionCompat, long j) {
|
||||
if (mediaDescriptionCompat == null) {
|
||||
throw new IllegalArgumentException("Description cannot be null.");
|
||||
}
|
||||
if (j == -1) {
|
||||
throw new IllegalArgumentException("Id cannot be QueueItem.UNKNOWN_ID");
|
||||
}
|
||||
this.mDescription = mediaDescriptionCompat;
|
||||
this.mId = j;
|
||||
this.mItem = obj;
|
||||
}
|
||||
|
||||
QueueItem(Parcel parcel) {
|
||||
this.mDescription = MediaDescriptionCompat.CREATOR.createFromParcel(parcel);
|
||||
this.mId = parcel.readLong();
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Token implements Parcelable {
|
||||
public static final Parcelable.Creator<Token> CREATOR = new Parcelable.Creator<Token>() { // from class: android.support.v4.media.session.MediaSessionCompat.Token.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public Token createFromParcel(Parcel parcel) {
|
||||
return new Token(Build.VERSION.SDK_INT >= 21 ? parcel.readParcelable(null) : parcel.readStrongBinder());
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public Token[] newArray(int i) {
|
||||
return new Token[i];
|
||||
}
|
||||
};
|
||||
private IMediaSession mExtraBinder;
|
||||
private final Object mInner;
|
||||
private Bundle mSessionToken2Bundle;
|
||||
|
||||
Token(Object obj) {
|
||||
this(obj, null, null);
|
||||
}
|
||||
|
||||
public static Token fromBundle(Bundle bundle) {
|
||||
if (bundle == null) {
|
||||
return null;
|
||||
}
|
||||
IMediaSession a = IMediaSession.Stub.a(BundleCompat.a(bundle, "android.support.v4.media.session.EXTRA_BINDER"));
|
||||
Bundle bundle2 = bundle.getBundle("android.support.v4.media.session.SESSION_TOKEN2_BUNDLE");
|
||||
Token token = (Token) bundle.getParcelable("android.support.v4.media.session.TOKEN");
|
||||
if (token == null) {
|
||||
return null;
|
||||
}
|
||||
return new Token(token.mInner, a, bundle2);
|
||||
}
|
||||
|
||||
public static Token fromToken(Object obj) {
|
||||
return fromToken(obj, null);
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof Token)) {
|
||||
return false;
|
||||
}
|
||||
Token token = (Token) obj;
|
||||
Object obj2 = this.mInner;
|
||||
if (obj2 == null) {
|
||||
return token.mInner == null;
|
||||
}
|
||||
Object obj3 = token.mInner;
|
||||
if (obj3 == null) {
|
||||
return false;
|
||||
}
|
||||
return obj2.equals(obj3);
|
||||
}
|
||||
|
||||
public IMediaSession getExtraBinder() {
|
||||
return this.mExtraBinder;
|
||||
}
|
||||
|
||||
public Bundle getSessionToken2Bundle() {
|
||||
return this.mSessionToken2Bundle;
|
||||
}
|
||||
|
||||
public Object getToken() {
|
||||
return this.mInner;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
Object obj = this.mInner;
|
||||
if (obj == null) {
|
||||
return 0;
|
||||
}
|
||||
return obj.hashCode();
|
||||
}
|
||||
|
||||
public void setExtraBinder(IMediaSession iMediaSession) {
|
||||
this.mExtraBinder = iMediaSession;
|
||||
}
|
||||
|
||||
public void setSessionToken2Bundle(Bundle bundle) {
|
||||
this.mSessionToken2Bundle = bundle;
|
||||
}
|
||||
|
||||
public Bundle toBundle() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("android.support.v4.media.session.TOKEN", this);
|
||||
IMediaSession iMediaSession = this.mExtraBinder;
|
||||
if (iMediaSession != null) {
|
||||
BundleCompat.a(bundle, "android.support.v4.media.session.EXTRA_BINDER", iMediaSession.asBinder());
|
||||
}
|
||||
Bundle bundle2 = this.mSessionToken2Bundle;
|
||||
if (bundle2 != null) {
|
||||
bundle.putBundle("android.support.v4.media.session.SESSION_TOKEN2_BUNDLE", bundle2);
|
||||
}
|
||||
return bundle;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
parcel.writeParcelable((Parcelable) this.mInner, i);
|
||||
} else {
|
||||
parcel.writeStrongBinder((IBinder) this.mInner);
|
||||
}
|
||||
}
|
||||
|
||||
Token(Object obj, IMediaSession iMediaSession) {
|
||||
this(obj, iMediaSession, null);
|
||||
}
|
||||
|
||||
public static Token fromToken(Object obj, IMediaSession iMediaSession) {
|
||||
if (obj == null || Build.VERSION.SDK_INT < 21) {
|
||||
return null;
|
||||
}
|
||||
MediaSessionCompatApi21.a(obj);
|
||||
return new Token(obj, iMediaSession);
|
||||
}
|
||||
|
||||
Token(Object obj, IMediaSession iMediaSession, Bundle bundle) {
|
||||
this.mInner = obj;
|
||||
this.mExtraBinder = iMediaSession;
|
||||
this.mSessionToken2Bundle = bundle;
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(Bundle bundle) {
|
||||
if (bundle != null) {
|
||||
bundle.setClassLoader(MediaSessionCompat.class.getClassLoader());
|
||||
}
|
||||
}
|
||||
|
||||
public static final class ResultReceiverWrapper implements Parcelable {
|
||||
public static final Parcelable.Creator<ResultReceiverWrapper> CREATOR = new Parcelable.Creator<ResultReceiverWrapper>() { // from class: android.support.v4.media.session.MediaSessionCompat.ResultReceiverWrapper.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public ResultReceiverWrapper createFromParcel(Parcel parcel) {
|
||||
return new ResultReceiverWrapper(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public ResultReceiverWrapper[] newArray(int i) {
|
||||
return new ResultReceiverWrapper[i];
|
||||
}
|
||||
};
|
||||
ResultReceiver mResultReceiver;
|
||||
|
||||
public ResultReceiverWrapper(ResultReceiver resultReceiver) {
|
||||
this.mResultReceiver = resultReceiver;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
this.mResultReceiver.writeToParcel(parcel, i);
|
||||
}
|
||||
|
||||
ResultReceiverWrapper(Parcel parcel) {
|
||||
this.mResultReceiver = (ResultReceiver) ResultReceiver.CREATOR.createFromParcel(parcel);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.media.MediaDescription;
|
||||
import android.media.session.MediaSession;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class MediaSessionCompatApi21 {
|
||||
|
||||
static class QueueItem {
|
||||
public static Object a(Object obj, long j) {
|
||||
return new MediaSession.QueueItem((MediaDescription) obj, j);
|
||||
}
|
||||
|
||||
public static long b(Object obj) {
|
||||
return ((MediaSession.QueueItem) obj).getQueueId();
|
||||
}
|
||||
|
||||
public static Object a(Object obj) {
|
||||
return ((MediaSession.QueueItem) obj).getDescription();
|
||||
}
|
||||
}
|
||||
|
||||
public static Object a(Object obj) {
|
||||
if (obj instanceof MediaSession.Token) {
|
||||
return obj;
|
||||
}
|
||||
throw new IllegalArgumentException("token is not a valid MediaSession.Token object");
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ParcelableVolumeInfo implements Parcelable {
|
||||
public static final Parcelable.Creator<ParcelableVolumeInfo> CREATOR = new Parcelable.Creator<ParcelableVolumeInfo>() { // from class: android.support.v4.media.session.ParcelableVolumeInfo.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public ParcelableVolumeInfo createFromParcel(Parcel parcel) {
|
||||
return new ParcelableVolumeInfo(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public ParcelableVolumeInfo[] newArray(int i) {
|
||||
return new ParcelableVolumeInfo[i];
|
||||
}
|
||||
};
|
||||
public int audioStream;
|
||||
public int controlType;
|
||||
public int currentVolume;
|
||||
public int maxVolume;
|
||||
public int volumeType;
|
||||
|
||||
public ParcelableVolumeInfo(int i, int i2, int i3, int i4, int i5) {
|
||||
this.volumeType = i;
|
||||
this.audioStream = i2;
|
||||
this.controlType = i3;
|
||||
this.maxVolume = i4;
|
||||
this.currentVolume = i5;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(this.volumeType);
|
||||
parcel.writeInt(this.controlType);
|
||||
parcel.writeInt(this.maxVolume);
|
||||
parcel.writeInt(this.currentVolume);
|
||||
parcel.writeInt(this.audioStream);
|
||||
}
|
||||
|
||||
public ParcelableVolumeInfo(Parcel parcel) {
|
||||
this.volumeType = parcel.readInt();
|
||||
this.controlType = parcel.readInt();
|
||||
this.maxVolume = parcel.readInt();
|
||||
this.currentVolume = parcel.readInt();
|
||||
this.audioStream = parcel.readInt();
|
||||
}
|
||||
}
|
@@ -0,0 +1,353 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.SystemClock;
|
||||
import android.support.v4.media.session.PlaybackStateCompatApi21;
|
||||
import android.text.TextUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class PlaybackStateCompat implements Parcelable {
|
||||
public static final long ACTION_FAST_FORWARD = 64;
|
||||
public static final long ACTION_PAUSE = 2;
|
||||
public static final long ACTION_PLAY = 4;
|
||||
public static final long ACTION_PLAY_FROM_MEDIA_ID = 1024;
|
||||
public static final long ACTION_PLAY_FROM_SEARCH = 2048;
|
||||
public static final long ACTION_PLAY_FROM_URI = 8192;
|
||||
public static final long ACTION_PLAY_PAUSE = 512;
|
||||
public static final long ACTION_PREPARE = 16384;
|
||||
public static final long ACTION_PREPARE_FROM_MEDIA_ID = 32768;
|
||||
public static final long ACTION_PREPARE_FROM_SEARCH = 65536;
|
||||
public static final long ACTION_PREPARE_FROM_URI = 131072;
|
||||
public static final long ACTION_REWIND = 8;
|
||||
public static final long ACTION_SEEK_TO = 256;
|
||||
public static final long ACTION_SET_CAPTIONING_ENABLED = 1048576;
|
||||
public static final long ACTION_SET_RATING = 128;
|
||||
public static final long ACTION_SET_REPEAT_MODE = 262144;
|
||||
public static final long ACTION_SET_SHUFFLE_MODE = 2097152;
|
||||
|
||||
@Deprecated
|
||||
public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 524288;
|
||||
public static final long ACTION_SKIP_TO_NEXT = 32;
|
||||
public static final long ACTION_SKIP_TO_PREVIOUS = 16;
|
||||
public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096;
|
||||
public static final long ACTION_STOP = 1;
|
||||
public static final Parcelable.Creator<PlaybackStateCompat> CREATOR = new Parcelable.Creator<PlaybackStateCompat>() { // from class: android.support.v4.media.session.PlaybackStateCompat.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public PlaybackStateCompat createFromParcel(Parcel parcel) {
|
||||
return new PlaybackStateCompat(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public PlaybackStateCompat[] newArray(int i) {
|
||||
return new PlaybackStateCompat[i];
|
||||
}
|
||||
};
|
||||
public static final int ERROR_CODE_ACTION_ABORTED = 10;
|
||||
public static final int ERROR_CODE_APP_ERROR = 1;
|
||||
public static final int ERROR_CODE_AUTHENTICATION_EXPIRED = 3;
|
||||
public static final int ERROR_CODE_CONCURRENT_STREAM_LIMIT = 5;
|
||||
public static final int ERROR_CODE_CONTENT_ALREADY_PLAYING = 8;
|
||||
public static final int ERROR_CODE_END_OF_QUEUE = 11;
|
||||
public static final int ERROR_CODE_NOT_AVAILABLE_IN_REGION = 7;
|
||||
public static final int ERROR_CODE_NOT_SUPPORTED = 2;
|
||||
public static final int ERROR_CODE_PARENTAL_CONTROL_RESTRICTED = 6;
|
||||
public static final int ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED = 4;
|
||||
public static final int ERROR_CODE_SKIP_LIMIT_REACHED = 9;
|
||||
public static final int ERROR_CODE_UNKNOWN_ERROR = 0;
|
||||
private static final int KEYCODE_MEDIA_PAUSE = 127;
|
||||
private static final int KEYCODE_MEDIA_PLAY = 126;
|
||||
public static final long PLAYBACK_POSITION_UNKNOWN = -1;
|
||||
public static final int REPEAT_MODE_ALL = 2;
|
||||
public static final int REPEAT_MODE_GROUP = 3;
|
||||
public static final int REPEAT_MODE_INVALID = -1;
|
||||
public static final int REPEAT_MODE_NONE = 0;
|
||||
public static final int REPEAT_MODE_ONE = 1;
|
||||
public static final int SHUFFLE_MODE_ALL = 1;
|
||||
public static final int SHUFFLE_MODE_GROUP = 2;
|
||||
public static final int SHUFFLE_MODE_INVALID = -1;
|
||||
public static final int SHUFFLE_MODE_NONE = 0;
|
||||
public static final int STATE_BUFFERING = 6;
|
||||
public static final int STATE_CONNECTING = 8;
|
||||
public static final int STATE_ERROR = 7;
|
||||
public static final int STATE_FAST_FORWARDING = 4;
|
||||
public static final int STATE_NONE = 0;
|
||||
public static final int STATE_PAUSED = 2;
|
||||
public static final int STATE_PLAYING = 3;
|
||||
public static final int STATE_REWINDING = 5;
|
||||
public static final int STATE_SKIPPING_TO_NEXT = 10;
|
||||
public static final int STATE_SKIPPING_TO_PREVIOUS = 9;
|
||||
public static final int STATE_SKIPPING_TO_QUEUE_ITEM = 11;
|
||||
public static final int STATE_STOPPED = 1;
|
||||
final long mActions;
|
||||
final long mActiveItemId;
|
||||
final long mBufferedPosition;
|
||||
List<CustomAction> mCustomActions;
|
||||
final int mErrorCode;
|
||||
final CharSequence mErrorMessage;
|
||||
final Bundle mExtras;
|
||||
final long mPosition;
|
||||
final float mSpeed;
|
||||
final int mState;
|
||||
private Object mStateObj;
|
||||
final long mUpdateTime;
|
||||
|
||||
PlaybackStateCompat(int i, long j, long j2, float f, long j3, int i2, CharSequence charSequence, long j4, List<CustomAction> list, long j5, Bundle bundle) {
|
||||
this.mState = i;
|
||||
this.mPosition = j;
|
||||
this.mBufferedPosition = j2;
|
||||
this.mSpeed = f;
|
||||
this.mActions = j3;
|
||||
this.mErrorCode = i2;
|
||||
this.mErrorMessage = charSequence;
|
||||
this.mUpdateTime = j4;
|
||||
this.mCustomActions = new ArrayList(list);
|
||||
this.mActiveItemId = j5;
|
||||
this.mExtras = bundle;
|
||||
}
|
||||
|
||||
public static PlaybackStateCompat fromPlaybackState(Object obj) {
|
||||
ArrayList arrayList;
|
||||
if (obj == null || Build.VERSION.SDK_INT < 21) {
|
||||
return null;
|
||||
}
|
||||
List<Object> d = PlaybackStateCompatApi21.d(obj);
|
||||
if (d != null) {
|
||||
ArrayList arrayList2 = new ArrayList(d.size());
|
||||
Iterator<Object> it = d.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList2.add(CustomAction.fromCustomAction(it.next()));
|
||||
}
|
||||
arrayList = arrayList2;
|
||||
} else {
|
||||
arrayList = null;
|
||||
}
|
||||
PlaybackStateCompat playbackStateCompat = new PlaybackStateCompat(PlaybackStateCompatApi21.i(obj), PlaybackStateCompatApi21.h(obj), PlaybackStateCompatApi21.c(obj), PlaybackStateCompatApi21.g(obj), PlaybackStateCompatApi21.a(obj), 0, PlaybackStateCompatApi21.e(obj), PlaybackStateCompatApi21.f(obj), arrayList, PlaybackStateCompatApi21.b(obj), Build.VERSION.SDK_INT >= 22 ? PlaybackStateCompatApi22.a(obj) : null);
|
||||
playbackStateCompat.mStateObj = obj;
|
||||
return playbackStateCompat;
|
||||
}
|
||||
|
||||
public static int toKeyCode(long j) {
|
||||
if (j == 4) {
|
||||
return KEYCODE_MEDIA_PLAY;
|
||||
}
|
||||
if (j == 2) {
|
||||
return KEYCODE_MEDIA_PAUSE;
|
||||
}
|
||||
if (j == 32) {
|
||||
return 87;
|
||||
}
|
||||
if (j == 16) {
|
||||
return 88;
|
||||
}
|
||||
if (j == 1) {
|
||||
return 86;
|
||||
}
|
||||
if (j == 64) {
|
||||
return 90;
|
||||
}
|
||||
if (j == 8) {
|
||||
return 89;
|
||||
}
|
||||
return j == 512 ? 85 : 0;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long getActions() {
|
||||
return this.mActions;
|
||||
}
|
||||
|
||||
public long getActiveQueueItemId() {
|
||||
return this.mActiveItemId;
|
||||
}
|
||||
|
||||
public long getBufferedPosition() {
|
||||
return this.mBufferedPosition;
|
||||
}
|
||||
|
||||
public long getCurrentPosition(Long l) {
|
||||
return Math.max(0L, this.mPosition + ((long) (this.mSpeed * (l != null ? l.longValue() : SystemClock.elapsedRealtime() - this.mUpdateTime))));
|
||||
}
|
||||
|
||||
public List<CustomAction> getCustomActions() {
|
||||
return this.mCustomActions;
|
||||
}
|
||||
|
||||
public int getErrorCode() {
|
||||
return this.mErrorCode;
|
||||
}
|
||||
|
||||
public CharSequence getErrorMessage() {
|
||||
return this.mErrorMessage;
|
||||
}
|
||||
|
||||
public Bundle getExtras() {
|
||||
return this.mExtras;
|
||||
}
|
||||
|
||||
public long getLastPositionUpdateTime() {
|
||||
return this.mUpdateTime;
|
||||
}
|
||||
|
||||
public float getPlaybackSpeed() {
|
||||
return this.mSpeed;
|
||||
}
|
||||
|
||||
public Object getPlaybackState() {
|
||||
if (this.mStateObj == null && Build.VERSION.SDK_INT >= 21) {
|
||||
ArrayList arrayList = null;
|
||||
List<CustomAction> list = this.mCustomActions;
|
||||
if (list != null) {
|
||||
arrayList = new ArrayList(list.size());
|
||||
Iterator<CustomAction> it = this.mCustomActions.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(it.next().getCustomAction());
|
||||
}
|
||||
}
|
||||
ArrayList arrayList2 = arrayList;
|
||||
if (Build.VERSION.SDK_INT >= 22) {
|
||||
this.mStateObj = PlaybackStateCompatApi22.a(this.mState, this.mPosition, this.mBufferedPosition, this.mSpeed, this.mActions, this.mErrorMessage, this.mUpdateTime, arrayList2, this.mActiveItemId, this.mExtras);
|
||||
} else {
|
||||
this.mStateObj = PlaybackStateCompatApi21.a(this.mState, this.mPosition, this.mBufferedPosition, this.mSpeed, this.mActions, this.mErrorMessage, this.mUpdateTime, arrayList2, this.mActiveItemId);
|
||||
}
|
||||
}
|
||||
return this.mStateObj;
|
||||
}
|
||||
|
||||
public long getPosition() {
|
||||
return this.mPosition;
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return this.mState;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "PlaybackState {state=" + this.mState + ", position=" + this.mPosition + ", buffered position=" + this.mBufferedPosition + ", speed=" + this.mSpeed + ", updated=" + this.mUpdateTime + ", actions=" + this.mActions + ", error code=" + this.mErrorCode + ", error message=" + this.mErrorMessage + ", custom actions=" + this.mCustomActions + ", active item id=" + this.mActiveItemId + "}";
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(this.mState);
|
||||
parcel.writeLong(this.mPosition);
|
||||
parcel.writeFloat(this.mSpeed);
|
||||
parcel.writeLong(this.mUpdateTime);
|
||||
parcel.writeLong(this.mBufferedPosition);
|
||||
parcel.writeLong(this.mActions);
|
||||
TextUtils.writeToParcel(this.mErrorMessage, parcel, i);
|
||||
parcel.writeTypedList(this.mCustomActions);
|
||||
parcel.writeLong(this.mActiveItemId);
|
||||
parcel.writeBundle(this.mExtras);
|
||||
parcel.writeInt(this.mErrorCode);
|
||||
}
|
||||
|
||||
public static final class CustomAction implements Parcelable {
|
||||
public static final Parcelable.Creator<CustomAction> CREATOR = new Parcelable.Creator<CustomAction>() { // from class: android.support.v4.media.session.PlaybackStateCompat.CustomAction.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public CustomAction createFromParcel(Parcel parcel) {
|
||||
return new CustomAction(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public CustomAction[] newArray(int i) {
|
||||
return new CustomAction[i];
|
||||
}
|
||||
};
|
||||
private final String mAction;
|
||||
private Object mCustomActionObj;
|
||||
private final Bundle mExtras;
|
||||
private final int mIcon;
|
||||
private final CharSequence mName;
|
||||
|
||||
CustomAction(String str, CharSequence charSequence, int i, Bundle bundle) {
|
||||
this.mAction = str;
|
||||
this.mName = charSequence;
|
||||
this.mIcon = i;
|
||||
this.mExtras = bundle;
|
||||
}
|
||||
|
||||
public static CustomAction fromCustomAction(Object obj) {
|
||||
if (obj == null || Build.VERSION.SDK_INT < 21) {
|
||||
return null;
|
||||
}
|
||||
CustomAction customAction = new CustomAction(PlaybackStateCompatApi21.CustomAction.a(obj), PlaybackStateCompatApi21.CustomAction.d(obj), PlaybackStateCompatApi21.CustomAction.c(obj), PlaybackStateCompatApi21.CustomAction.b(obj));
|
||||
customAction.mCustomActionObj = obj;
|
||||
return customAction;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return this.mAction;
|
||||
}
|
||||
|
||||
public Object getCustomAction() {
|
||||
if (this.mCustomActionObj != null || Build.VERSION.SDK_INT < 21) {
|
||||
return this.mCustomActionObj;
|
||||
}
|
||||
this.mCustomActionObj = PlaybackStateCompatApi21.CustomAction.a(this.mAction, this.mName, this.mIcon, this.mExtras);
|
||||
return this.mCustomActionObj;
|
||||
}
|
||||
|
||||
public Bundle getExtras() {
|
||||
return this.mExtras;
|
||||
}
|
||||
|
||||
public int getIcon() {
|
||||
return this.mIcon;
|
||||
}
|
||||
|
||||
public CharSequence getName() {
|
||||
return this.mName;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Action:mName='" + ((Object) this.mName) + ", mIcon=" + this.mIcon + ", mExtras=" + this.mExtras;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeString(this.mAction);
|
||||
TextUtils.writeToParcel(this.mName, parcel, i);
|
||||
parcel.writeInt(this.mIcon);
|
||||
parcel.writeBundle(this.mExtras);
|
||||
}
|
||||
|
||||
CustomAction(Parcel parcel) {
|
||||
this.mAction = parcel.readString();
|
||||
this.mName = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
|
||||
this.mIcon = parcel.readInt();
|
||||
this.mExtras = parcel.readBundle(MediaSessionCompat.class.getClassLoader());
|
||||
}
|
||||
}
|
||||
|
||||
PlaybackStateCompat(Parcel parcel) {
|
||||
this.mState = parcel.readInt();
|
||||
this.mPosition = parcel.readLong();
|
||||
this.mSpeed = parcel.readFloat();
|
||||
this.mUpdateTime = parcel.readLong();
|
||||
this.mBufferedPosition = parcel.readLong();
|
||||
this.mActions = parcel.readLong();
|
||||
this.mErrorMessage = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
|
||||
this.mCustomActions = parcel.createTypedArrayList(CustomAction.CREATOR);
|
||||
this.mActiveItemId = parcel.readLong();
|
||||
this.mExtras = parcel.readBundle(MediaSessionCompat.class.getClassLoader());
|
||||
this.mErrorCode = parcel.readInt();
|
||||
}
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.media.session.PlaybackState;
|
||||
import android.os.Bundle;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class PlaybackStateCompatApi21 {
|
||||
|
||||
static final class CustomAction {
|
||||
public static String a(Object obj) {
|
||||
return ((PlaybackState.CustomAction) obj).getAction();
|
||||
}
|
||||
|
||||
public static Bundle b(Object obj) {
|
||||
return ((PlaybackState.CustomAction) obj).getExtras();
|
||||
}
|
||||
|
||||
public static int c(Object obj) {
|
||||
return ((PlaybackState.CustomAction) obj).getIcon();
|
||||
}
|
||||
|
||||
public static CharSequence d(Object obj) {
|
||||
return ((PlaybackState.CustomAction) obj).getName();
|
||||
}
|
||||
|
||||
public static Object a(String str, CharSequence charSequence, int i, Bundle bundle) {
|
||||
PlaybackState.CustomAction.Builder builder = new PlaybackState.CustomAction.Builder(str, charSequence, i);
|
||||
builder.setExtras(bundle);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
||||
public static long a(Object obj) {
|
||||
return ((PlaybackState) obj).getActions();
|
||||
}
|
||||
|
||||
public static long b(Object obj) {
|
||||
return ((PlaybackState) obj).getActiveQueueItemId();
|
||||
}
|
||||
|
||||
public static long c(Object obj) {
|
||||
return ((PlaybackState) obj).getBufferedPosition();
|
||||
}
|
||||
|
||||
public static List<Object> d(Object obj) {
|
||||
return ((PlaybackState) obj).getCustomActions();
|
||||
}
|
||||
|
||||
public static CharSequence e(Object obj) {
|
||||
return ((PlaybackState) obj).getErrorMessage();
|
||||
}
|
||||
|
||||
public static long f(Object obj) {
|
||||
return ((PlaybackState) obj).getLastPositionUpdateTime();
|
||||
}
|
||||
|
||||
public static float g(Object obj) {
|
||||
return ((PlaybackState) obj).getPlaybackSpeed();
|
||||
}
|
||||
|
||||
public static long h(Object obj) {
|
||||
return ((PlaybackState) obj).getPosition();
|
||||
}
|
||||
|
||||
public static int i(Object obj) {
|
||||
return ((PlaybackState) obj).getState();
|
||||
}
|
||||
|
||||
public static Object a(int i, long j, long j2, float f, long j3, CharSequence charSequence, long j4, List<Object> list, long j5) {
|
||||
PlaybackState.Builder builder = new PlaybackState.Builder();
|
||||
builder.setState(i, j, f, j4);
|
||||
builder.setBufferedPosition(j2);
|
||||
builder.setActions(j3);
|
||||
builder.setErrorMessage(charSequence);
|
||||
Iterator<Object> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
builder.addCustomAction((PlaybackState.CustomAction) it.next());
|
||||
}
|
||||
builder.setActiveQueueItemId(j5);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package android.support.v4.media.session;
|
||||
|
||||
import android.media.session.PlaybackState;
|
||||
import android.os.Bundle;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class PlaybackStateCompatApi22 {
|
||||
public static Bundle a(Object obj) {
|
||||
return ((PlaybackState) obj).getExtras();
|
||||
}
|
||||
|
||||
public static Object a(int i, long j, long j2, float f, long j3, CharSequence charSequence, long j4, List<Object> list, long j5, Bundle bundle) {
|
||||
PlaybackState.Builder builder = new PlaybackState.Builder();
|
||||
builder.setState(i, j, f, j4);
|
||||
builder.setBufferedPosition(j2);
|
||||
builder.setActions(j3);
|
||||
builder.setErrorMessage(charSequence);
|
||||
Iterator<Object> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
builder.addCustomAction((PlaybackState.CustomAction) it.next());
|
||||
}
|
||||
builder.setActiveQueueItemId(j5);
|
||||
builder.setExtras(bundle);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user