CrackMe.apk
Download file
package androidx.media;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.browse.MediaBrowser;
import android.media.session.MediaSession;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.service.media.MediaBrowserService;
import android.support.v4.media.MediaBrowserCompat;
import android.support.v4.media.session.IMediaSession;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.os.ResultReceiver;
import android.text.TextUtils;
import android.util.Log;
import androidx.collection.ArrayMap;
import androidx.core.app.BundleCompat;
import androidx.core.util.Pair;
import androidx.media.MediaSessionManager;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public abstract class MediaBrowserServiceCompat extends Service {
static final boolean DEBUG = Log.isLoggable(TAG, 3);
private static final float EPSILON = 1.0E-5f;
public static final String KEY_MEDIA_ITEM = "media_item";
public static final String KEY_SEARCH_RESULTS = "search_results";
public static final int RESULT_ERROR = -1;
static final int RESULT_FLAG_ON_LOAD_ITEM_NOT_IMPLEMENTED = 2;
static final int RESULT_FLAG_ON_SEARCH_NOT_IMPLEMENTED = 4;
static final int RESULT_FLAG_OPTION_NOT_HANDLED = 1;
public static final int RESULT_OK = 0;
public static final int RESULT_PROGRESS_UPDATE = 1;
public static final String SERVICE_INTERFACE = "android.media.browse.MediaBrowserService";
static final String TAG = "MBServiceCompat";
final ConnectionRecord mConnectionFromFwk = new ConnectionRecord(MediaSessionManager.RemoteUserInfo.LEGACY_CONTROLLER, -1, -1, (Bundle) null, (ServiceCallbacks) null);
final ArrayMap<IBinder, ConnectionRecord> mConnections = new ArrayMap<>();
ConnectionRecord mCurConnection;
final ServiceHandler mHandler = new ServiceHandler();
private MediaBrowserServiceImpl mImpl;
final ArrayList<ConnectionRecord> mPendingConnections = new ArrayList<>();
MediaSessionCompat.Token mSession;
interface MediaBrowserServiceImpl {
Bundle getBrowserRootHints();
MediaSessionManager.RemoteUserInfo getCurrentBrowserInfo();
void notifyChildrenChanged(MediaSessionManager.RemoteUserInfo remoteUserInfo, String str, Bundle bundle);
void notifyChildrenChanged(String str, Bundle bundle);
IBinder onBind(Intent intent);
void onCreate();
void setSessionToken(MediaSessionCompat.Token token);
}
private interface ServiceCallbacks {
IBinder asBinder();
void onConnect(String str, MediaSessionCompat.Token token, Bundle bundle) throws RemoteException;
void onConnectFailed() throws RemoteException;
void onLoadChildren(String str, List<MediaBrowserCompat.MediaItem> list, Bundle bundle, Bundle bundle2) throws RemoteException;
}
public void dump(FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
}
public abstract BrowserRoot onGetRoot(String str, int i, Bundle bundle);
public abstract void onLoadChildren(String str, Result<List<MediaBrowserCompat.MediaItem>> result);
public void onSubscribe(String str, Bundle bundle) {
}
public void onUnsubscribe(String str) {
}
class MediaBrowserServiceImplBase implements MediaBrowserServiceImpl {
private Messenger mMessenger;
MediaBrowserServiceImplBase() {
}
public void onCreate() {
this.mMessenger = new Messenger(MediaBrowserServiceCompat.this.mHandler);
}
public IBinder onBind(Intent intent) {
if (MediaBrowserServiceCompat.SERVICE_INTERFACE.equals(intent.getAction())) {
return this.mMessenger.getBinder();
}
return null;
}
public void setSessionToken(final MediaSessionCompat.Token token) {
MediaBrowserServiceCompat.this.mHandler.post(new Runnable() {
public void run() {
Iterator<ConnectionRecord> it = MediaBrowserServiceCompat.this.mConnections.values().iterator();
while (it.hasNext()) {
ConnectionRecord next = it.next();
try {
next.callbacks.onConnect(next.root.getRootId(), token, next.root.getExtras());
} catch (RemoteException unused) {
Log.w(MediaBrowserServiceCompat.TAG, "Connection for " + next.pkg + " is no longer valid.");
it.remove();
}
}
}
});
}
public void notifyChildrenChanged(final String str, final Bundle bundle) {
MediaBrowserServiceCompat.this.mHandler.post(new Runnable() {
public void run() {
for (IBinder iBinder : MediaBrowserServiceCompat.this.mConnections.keySet()) {
ArrayMap<IBinder, ConnectionRecord> arrayMap = MediaBrowserServiceCompat.this.mConnections;
MediaBrowserServiceImplBase.this.notifyChildrenChangedOnHandler(arrayMap.get(iBinder), str, bundle);
}
}
});
}
public void notifyChildrenChanged(final MediaSessionManager.RemoteUserInfo remoteUserInfo, final String str, final Bundle bundle) {
MediaBrowserServiceCompat.this.mHandler.post(new Runnable() {
public void run() {
for (int i = 0; i < MediaBrowserServiceCompat.this.mConnections.size(); i++) {
ConnectionRecord valueAt = MediaBrowserServiceCompat.this.mConnections.valueAt(i);
if (valueAt.browserInfo.equals(remoteUserInfo)) {
MediaBrowserServiceImplBase.this.notifyChildrenChangedOnHandler(valueAt, str, bundle);
return;
}
}
}
});
}
/* access modifiers changed from: package-private */
public void notifyChildrenChangedOnHandler(ConnectionRecord connectionRecord, String str, Bundle bundle) {
List<Pair> list = connectionRecord.subscriptions.get(str);
if (list != null) {
for (Pair pair : list) {
if (MediaBrowserCompatUtils.hasDuplicatedItems(bundle, (Bundle) pair.second)) {
MediaBrowserServiceCompat.this.performLoadChildren(str, connectionRecord, (Bundle) pair.second, bundle);
}
}
}
}
public Bundle getBrowserRootHints() {
if (MediaBrowserServiceCompat.this.mCurConnection == null) {
throw new IllegalStateException("This should be called inside of onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
} else if (MediaBrowserServiceCompat.this.mCurConnection.rootHints == null) {
return null;
} else {
return new Bundle(MediaBrowserServiceCompat.this.mCurConnection.rootHints);
}
}
public MediaSessionManager.RemoteUserInfo getCurrentBrowserInfo() {
if (MediaBrowserServiceCompat.this.mCurConnection != null) {
return MediaBrowserServiceCompat.this.mCurConnection.browserInfo;
}
throw new IllegalStateException("This should be called inside of onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
}
}
class MediaBrowserServiceImplApi21 implements MediaBrowserServiceImpl {
Messenger mMessenger;
final List<Bundle> mRootExtrasList = new ArrayList();
MediaBrowserService mServiceFwk;
MediaBrowserServiceImplApi21() {
}
public void onCreate() {
MediaBrowserServiceApi21 mediaBrowserServiceApi21 = new MediaBrowserServiceApi21(MediaBrowserServiceCompat.this);
this.mServiceFwk = mediaBrowserServiceApi21;
mediaBrowserServiceApi21.onCreate();
}
public IBinder onBind(Intent intent) {
return this.mServiceFwk.onBind(intent);
}
public void setSessionToken(final MediaSessionCompat.Token token) {
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
MediaBrowserServiceImplApi21.this.setSessionTokenOnHandler(token);
}
});
}
/* access modifiers changed from: package-private */
public void setSessionTokenOnHandler(MediaSessionCompat.Token token) {
if (!this.mRootExtrasList.isEmpty()) {
IMediaSession extraBinder = token.getExtraBinder();
if (extraBinder != null) {
for (Bundle putBinder : this.mRootExtrasList) {
BundleCompat.putBinder(putBinder, MediaBrowserProtocol.EXTRA_SESSION_BINDER, extraBinder.asBinder());
}
}
this.mRootExtrasList.clear();
}
this.mServiceFwk.setSessionToken((MediaSession.Token) token.getToken());
}
public void notifyChildrenChanged(String str, Bundle bundle) {
notifyChildrenChangedForFramework(str, bundle);
notifyChildrenChangedForCompat(str, bundle);
}
public void notifyChildrenChanged(MediaSessionManager.RemoteUserInfo remoteUserInfo, String str, Bundle bundle) {
notifyChildrenChangedForCompat(remoteUserInfo, str, bundle);
}
public BrowserRoot onGetRoot(String str, int i, Bundle bundle) {
int i2;
Bundle bundle2;
IBinder iBinder;
if (bundle == null || bundle.getInt(MediaBrowserProtocol.EXTRA_CLIENT_VERSION, 0) == 0) {
bundle2 = null;
i2 = -1;
} else {
bundle.remove(MediaBrowserProtocol.EXTRA_CLIENT_VERSION);
this.mMessenger = new Messenger(MediaBrowserServiceCompat.this.mHandler);
bundle2 = new Bundle();
bundle2.putInt(MediaBrowserProtocol.EXTRA_SERVICE_VERSION, 2);
BundleCompat.putBinder(bundle2, MediaBrowserProtocol.EXTRA_MESSENGER_BINDER, this.mMessenger.getBinder());
if (MediaBrowserServiceCompat.this.mSession != null) {
IMediaSession extraBinder = MediaBrowserServiceCompat.this.mSession.getExtraBinder();
if (extraBinder == null) {
iBinder = null;
} else {
iBinder = extraBinder.asBinder();
}
BundleCompat.putBinder(bundle2, MediaBrowserProtocol.EXTRA_SESSION_BINDER, iBinder);
} else {
this.mRootExtrasList.add(bundle2);
}
int i3 = bundle.getInt(MediaBrowserProtocol.EXTRA_CALLING_PID, -1);
bundle.remove(MediaBrowserProtocol.EXTRA_CALLING_PID);
i2 = i3;
}
ConnectionRecord connectionRecord = new ConnectionRecord(str, i2, i, bundle, (ServiceCallbacks) null);
MediaBrowserServiceCompat.this.mCurConnection = connectionRecord;
BrowserRoot onGetRoot = MediaBrowserServiceCompat.this.onGetRoot(str, i, bundle);
MediaBrowserServiceCompat.this.mCurConnection = null;
if (onGetRoot == null) {
return null;
}
if (this.mMessenger != null) {
MediaBrowserServiceCompat.this.mPendingConnections.add(connectionRecord);
}
if (bundle2 == null) {
bundle2 = onGetRoot.getExtras();
} else if (onGetRoot.getExtras() != null) {
bundle2.putAll(onGetRoot.getExtras());
}
return new BrowserRoot(onGetRoot.getRootId(), bundle2);
}
public void onLoadChildren(String str, final ResultWrapper<List<Parcel>> resultWrapper) {
AnonymousClass2 r0 = new Result<List<MediaBrowserCompat.MediaItem>>(str) {
/* access modifiers changed from: package-private */
public void onResultSent(List<MediaBrowserCompat.MediaItem> list) {
ArrayList arrayList;
if (list != null) {
arrayList = new ArrayList();
for (MediaBrowserCompat.MediaItem writeToParcel : list) {
Parcel obtain = Parcel.obtain();
writeToParcel.writeToParcel(obtain, 0);
arrayList.add(obtain);
}
} else {
arrayList = null;
}
resultWrapper.sendResult(arrayList);
}
public void detach() {
resultWrapper.detach();
}
};
MediaBrowserServiceCompat mediaBrowserServiceCompat = MediaBrowserServiceCompat.this;
mediaBrowserServiceCompat.mCurConnection = mediaBrowserServiceCompat.mConnectionFromFwk;
MediaBrowserServiceCompat.this.onLoadChildren(str, r0);
MediaBrowserServiceCompat.this.mCurConnection = null;
}
/* access modifiers changed from: package-private */
public void notifyChildrenChangedForFramework(String str, Bundle bundle) {
this.mServiceFwk.notifyChildrenChanged(str);
}
/* access modifiers changed from: package-private */
public void notifyChildrenChangedForCompat(final String str, final Bundle bundle) {
MediaBrowserServiceCompat.this.mHandler.post(new Runnable() {
public void run() {
for (IBinder iBinder : MediaBrowserServiceCompat.this.mConnections.keySet()) {
ArrayMap<IBinder, ConnectionRecord> arrayMap = MediaBrowserServiceCompat.this.mConnections;
MediaBrowserServiceImplApi21.this.notifyChildrenChangedForCompatOnHandler(arrayMap.get(iBinder), str, bundle);
}
}
});
}
/* access modifiers changed from: package-private */
public void notifyChildrenChangedForCompat(final MediaSessionManager.RemoteUserInfo remoteUserInfo, final String str, final Bundle bundle) {
MediaBrowserServiceCompat.this.mHandler.post(new Runnable() {
public void run() {
for (int i = 0; i < MediaBrowserServiceCompat.this.mConnections.size(); i++) {
ConnectionRecord valueAt = MediaBrowserServiceCompat.this.mConnections.valueAt(i);
if (valueAt.browserInfo.equals(remoteUserInfo)) {
MediaBrowserServiceImplApi21.this.notifyChildrenChangedForCompatOnHandler(valueAt, str, bundle);
}
}
}
});
}
/* access modifiers changed from: package-private */
public void notifyChildrenChangedForCompatOnHandler(ConnectionRecord connectionRecord, String str, Bundle bundle) {
List<Pair> list = connectionRecord.subscriptions.get(str);
if (list != null) {
for (Pair pair : list) {
if (MediaBrowserCompatUtils.hasDuplicatedItems(bundle, (Bundle) pair.second)) {
MediaBrowserServiceCompat.this.performLoadChildren(str, connectionRecord, (Bundle) pair.second, bundle);
}
}
}
}
public Bundle getBrowserRootHints() {
if (this.mMessenger == null) {
return null;
}
if (MediaBrowserServiceCompat.this.mCurConnection == null) {
throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
} else if (MediaBrowserServiceCompat.this.mCurConnection.rootHints == null) {
return null;
} else {
return new Bundle(MediaBrowserServiceCompat.this.mCurConnection.rootHints);
}
}
public MediaSessionManager.RemoteUserInfo getCurrentBrowserInfo() {
if (MediaBrowserServiceCompat.this.mCurConnection != null) {
return MediaBrowserServiceCompat.this.mCurConnection.browserInfo;
}
throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
}
class MediaBrowserServiceApi21 extends MediaBrowserService {
MediaBrowserServiceApi21(Context context) {
attachBaseContext(context);
}
public MediaBrowserService.BrowserRoot onGetRoot(String str, int i, Bundle bundle) {
Bundle bundle2;
MediaSessionCompat.ensureClassLoader(bundle);
MediaBrowserServiceImplApi21 mediaBrowserServiceImplApi21 = MediaBrowserServiceImplApi21.this;
if (bundle == null) {
bundle2 = null;
} else {
bundle2 = new Bundle(bundle);
}
BrowserRoot onGetRoot = mediaBrowserServiceImplApi21.onGetRoot(str, i, bundle2);
if (onGetRoot == null) {
return null;
}
return new MediaBrowserService.BrowserRoot(onGetRoot.mRootId, onGetRoot.mExtras);
}
public void onLoadChildren(String str, MediaBrowserService.Result<List<MediaBrowser.MediaItem>> result) {
MediaBrowserServiceImplApi21.this.onLoadChildren(str, new ResultWrapper(result));
}
}
}
class MediaBrowserServiceImplApi23 extends MediaBrowserServiceImplApi21 {
MediaBrowserServiceImplApi23() {
super();
}
public void onCreate() {
this.mServiceFwk = new MediaBrowserServiceApi23(MediaBrowserServiceCompat.this);
this.mServiceFwk.onCreate();
}
public void onLoadItem(String str, final ResultWrapper<Parcel> resultWrapper) {
AnonymousClass1 r0 = new Result<MediaBrowserCompat.MediaItem>(str) {
/* access modifiers changed from: package-private */
public void onResultSent(MediaBrowserCompat.MediaItem mediaItem) {
if (mediaItem == null) {
resultWrapper.sendResult(null);
return;
}
Parcel obtain = Parcel.obtain();
mediaItem.writeToParcel(obtain, 0);
resultWrapper.sendResult(obtain);
}
public void detach() {
resultWrapper.detach();
}
};
MediaBrowserServiceCompat mediaBrowserServiceCompat = MediaBrowserServiceCompat.this;
mediaBrowserServiceCompat.mCurConnection = mediaBrowserServiceCompat.mConnectionFromFwk;
MediaBrowserServiceCompat.this.onLoadItem(str, r0);
MediaBrowserServiceCompat.this.mCurConnection = null;
}
class MediaBrowserServiceApi23 extends MediaBrowserServiceImplApi21.MediaBrowserServiceApi21 {
MediaBrowserServiceApi23(Context context) {
super(context);
}
public void onLoadItem(String str, MediaBrowserService.Result<MediaBrowser.MediaItem> result) {
MediaBrowserServiceImplApi23.this.onLoadItem(str, new ResultWrapper(result));
}
}
}
class MediaBrowserServiceImplApi26 extends MediaBrowserServiceImplApi23 {
MediaBrowserServiceImplApi26() {
super();
}
public void onCreate() {
this.mServiceFwk = new MediaBrowserServiceApi26(MediaBrowserServiceCompat.this);
this.mServiceFwk.onCreate();
}
public void onLoadChildren(String str, final ResultWrapper<List<Parcel>> resultWrapper, final Bundle bundle) {
AnonymousClass1 r0 = new Result<List<MediaBrowserCompat.MediaItem>>(str) {
/* access modifiers changed from: package-private */
public void onResultSent(List<MediaBrowserCompat.MediaItem> list) {
if (list == null) {
resultWrapper.sendResult(null);
return;
}
if ((getFlags() & 1) != 0) {
list = MediaBrowserServiceCompat.this.applyOptions(list, bundle);
}
ArrayList arrayList = new ArrayList();
for (MediaBrowserCompat.MediaItem writeToParcel : list) {
Parcel obtain = Parcel.obtain();
writeToParcel.writeToParcel(obtain, 0);
arrayList.add(obtain);
}
resultWrapper.sendResult(arrayList);
}
public void detach() {
resultWrapper.detach();
}
};
MediaBrowserServiceCompat mediaBrowserServiceCompat = MediaBrowserServiceCompat.this;
mediaBrowserServiceCompat.mCurConnection = mediaBrowserServiceCompat.mConnectionFromFwk;
MediaBrowserServiceCompat.this.onLoadChildren(str, r0, bundle);
MediaBrowserServiceCompat.this.mCurConnection = null;
}
public Bundle getBrowserRootHints() {
if (MediaBrowserServiceCompat.this.mCurConnection == null) {
throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
} else if (MediaBrowserServiceCompat.this.mCurConnection == MediaBrowserServiceCompat.this.mConnectionFromFwk) {
return this.mServiceFwk.getBrowserRootHints();
} else {
if (MediaBrowserServiceCompat.this.mCurConnection.rootHints == null) {
return null;
}
return new Bundle(MediaBrowserServiceCompat.this.mCurConnection.rootHints);
}
}
/* access modifiers changed from: package-private */
public void notifyChildrenChangedForFramework(String str, Bundle bundle) {
if (bundle != null) {
this.mServiceFwk.notifyChildrenChanged(str, bundle);
} else {
super.notifyChildrenChangedForFramework(str, bundle);
}
}
class MediaBrowserServiceApi26 extends MediaBrowserServiceImplApi23.MediaBrowserServiceApi23 {
MediaBrowserServiceApi26(Context context) {
super(context);
}
public void onLoadChildren(String str, MediaBrowserService.Result<List<MediaBrowser.MediaItem>> result, Bundle bundle) {
MediaSessionCompat.ensureClassLoader(bundle);
MediaBrowserServiceCompat.this.mCurConnection = MediaBrowserServiceCompat.this.mConnectionFromFwk;
MediaBrowserServiceImplApi26.this.onLoadChildren(str, new ResultWrapper(result), bundle);
MediaBrowserServiceCompat.this.mCurConnection = null;
}
}
}
class MediaBrowserServiceImplApi28 extends MediaBrowserServiceImplApi26 {
MediaBrowserServiceImplApi28() {
super();
}
public MediaSessionManager.RemoteUserInfo getCurrentBrowserInfo() {
if (MediaBrowserServiceCompat.this.mCurConnection == null) {
throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
} else if (MediaBrowserServiceCompat.this.mCurConnection == MediaBrowserServiceCompat.this.mConnectionFromFwk) {
return new MediaSessionManager.RemoteUserInfo(this.mServiceFwk.getCurrentBrowserInfo());
} else {
return MediaBrowserServiceCompat.this.mCurConnection.browserInfo;
}
}
}
private final class ServiceHandler extends Handler {
private final ServiceBinderImpl mServiceBinderImpl;
ServiceHandler() {
this.mServiceBinderImpl = new ServiceBinderImpl();
}
public void handleMessage(Message message) {
Bundle data = message.getData();
switch (message.what) {
case 1:
Bundle bundle = data.getBundle(MediaBrowserProtocol.DATA_ROOT_HINTS);
MediaSessionCompat.ensureClassLoader(bundle);
this.mServiceBinderImpl.connect(data.getString(MediaBrowserProtocol.DATA_PACKAGE_NAME), data.getInt(MediaBrowserProtocol.DATA_CALLING_PID), data.getInt(MediaBrowserProtocol.DATA_CALLING_UID), bundle, new ServiceCallbacksCompat(message.replyTo));
return;
case 2:
this.mServiceBinderImpl.disconnect(new ServiceCallbacksCompat(message.replyTo));
return;
case 3:
Bundle bundle2 = data.getBundle(MediaBrowserProtocol.DATA_OPTIONS);
MediaSessionCompat.ensureClassLoader(bundle2);
this.mServiceBinderImpl.addSubscription(data.getString(MediaBrowserProtocol.DATA_MEDIA_ITEM_ID), BundleCompat.getBinder(data, MediaBrowserProtocol.DATA_CALLBACK_TOKEN), bundle2, new ServiceCallbacksCompat(message.replyTo));
return;
case 4:
this.mServiceBinderImpl.removeSubscription(data.getString(MediaBrowserProtocol.DATA_MEDIA_ITEM_ID), BundleCompat.getBinder(data, MediaBrowserProtocol.DATA_CALLBACK_TOKEN), new ServiceCallbacksCompat(message.replyTo));
return;
case 5:
this.mServiceBinderImpl.getMediaItem(data.getString(MediaBrowserProtocol.DATA_MEDIA_ITEM_ID), (ResultReceiver) data.getParcelable(MediaBrowserProtocol.DATA_RESULT_RECEIVER), new ServiceCallbacksCompat(message.replyTo));
return;
case 6:
Bundle bundle3 = data.getBundle(MediaBrowserProtocol.DATA_ROOT_HINTS);
MediaSessionCompat.ensureClassLoader(bundle3);
ServiceBinderImpl serviceBinderImpl = this.mServiceBinderImpl;
ServiceCallbacksCompat serviceCallbacksCompat = new ServiceCallbacksCompat(message.replyTo);
serviceBinderImpl.registerCallbacks(serviceCallbacksCompat, data.getString(MediaBrowserProtocol.DATA_PACKAGE_NAME), data.getInt(MediaBrowserProtocol.DATA_CALLING_PID), data.getInt(MediaBrowserProtocol.DATA_CALLING_UID), bundle3);
return;
case 7:
this.mServiceBinderImpl.unregisterCallbacks(new ServiceCallbacksCompat(message.replyTo));
return;
case 8:
Bundle bundle4 = data.getBundle(MediaBrowserProtocol.DATA_SEARCH_EXTRAS);
MediaSessionCompat.ensureClassLoader(bundle4);
this.mServiceBinderImpl.search(data.getString(MediaBrowserProtocol.DATA_SEARCH_QUERY), bundle4, (ResultReceiver) data.getParcelable(MediaBrowserProtocol.DATA_RESULT_RECEIVER), new ServiceCallbacksCompat(message.replyTo));
return;
case 9:
Bundle bundle5 = data.getBundle(MediaBrowserProtocol.DATA_CUSTOM_ACTION_EXTRAS);
MediaSessionCompat.ensureClassLoader(bundle5);
this.mServiceBinderImpl.sendCustomAction(data.getString(MediaBrowserProtocol.DATA_CUSTOM_ACTION), bundle5, (ResultReceiver) data.getParcelable(MediaBrowserProtocol.DATA_RESULT_RECEIVER), new ServiceCallbacksCompat(message.replyTo));
return;
default:
Log.w(MediaBrowserServiceCompat.TAG, "Unhandled message: " + message + "\n Service version: " + 2 + "\n Client version: " + message.arg1);
return;
}
}
public boolean sendMessageAtTime(Message message, long j) {
Bundle data = message.getData();
data.setClassLoader(MediaBrowserCompat.class.getClassLoader());
data.putInt(MediaBrowserProtocol.DATA_CALLING_UID, Binder.getCallingUid());
int callingPid = Binder.getCallingPid();
if (callingPid > 0) {
data.putInt(MediaBrowserProtocol.DATA_CALLING_PID, callingPid);
} else if (!data.containsKey(MediaBrowserProtocol.DATA_CALLING_PID)) {
data.putInt(MediaBrowserProtocol.DATA_CALLING_PID, -1);
}
return super.sendMessageAtTime(message, j);
}
public void postOrRun(Runnable runnable) {
if (Thread.currentThread() == getLooper().getThread()) {
runnable.run();
} else {
post(runnable);
}
}
}
private class ConnectionRecord implements IBinder.DeathRecipient {
public final MediaSessionManager.RemoteUserInfo browserInfo;
public final ServiceCallbacks callbacks;
public final int pid;
public final String pkg;
public BrowserRoot root;
public final Bundle rootHints;
public final HashMap<String, List<Pair<IBinder, Bundle>>> subscriptions = new HashMap<>();
public final int uid;
ConnectionRecord(String str, int i, int i2, Bundle bundle, ServiceCallbacks serviceCallbacks) {
this.pkg = str;
this.pid = i;
this.uid = i2;
this.browserInfo = new MediaSessionManager.RemoteUserInfo(str, i, i2);
this.rootHints = bundle;
this.callbacks = serviceCallbacks;
}
public void binderDied() {
MediaBrowserServiceCompat.this.mHandler.post(new Runnable() {
public void run() {
MediaBrowserServiceCompat.this.mConnections.remove(ConnectionRecord.this.callbacks.asBinder());
}
});
}
}
public static class Result<T> {
private final Object mDebug;
private boolean mDetachCalled;
private int mFlags;
private boolean mSendErrorCalled;
private boolean mSendResultCalled;
/* access modifiers changed from: package-private */
public void onResultSent(T t) {
}
Result(Object obj) {
this.mDebug = obj;
}
public void sendResult(T t) {
if (this.mSendResultCalled || this.mSendErrorCalled) {
throw new IllegalStateException("sendResult() called when either sendResult() or sendError() had already been called for: " + this.mDebug);
}
this.mSendResultCalled = true;
onResultSent(t);
}
public void sendProgressUpdate(Bundle bundle) {
if (this.mSendResultCalled || this.mSendErrorCalled) {
throw new IllegalStateException("sendProgressUpdate() called when either sendResult() or sendError() had already been called for: " + this.mDebug);
}
checkExtraFields(bundle);
onProgressUpdateSent(bundle);
}
public void sendError(Bundle bundle) {
if (this.mSendResultCalled || this.mSendErrorCalled) {
throw new IllegalStateException("sendError() called when either sendResult() or sendError() had already been called for: " + this.mDebug);
}
this.mSendErrorCalled = true;
onErrorSent(bundle);
}
public void detach() {
if (this.mDetachCalled) {
throw new IllegalStateException("detach() called when detach() had already been called for: " + this.mDebug);
} else if (this.mSendResultCalled) {
throw new IllegalStateException("detach() called when sendResult() had already been called for: " + this.mDebug);
} else if (!this.mSendErrorCalled) {
this.mDetachCalled = true;
} else {
throw new IllegalStateException("detach() called when sendError() had already been called for: " + this.mDebug);
}
}
/* access modifiers changed from: package-private */
public boolean isDone() {
return this.mDetachCalled || this.mSendResultCalled || this.mSendErrorCalled;
}
/* access modifiers changed from: package-private */
public void setFlags(int i) {
this.mFlags = i;
}
/* access modifiers changed from: package-private */
public int getFlags() {
return this.mFlags;
}
/* access modifiers changed from: package-private */
public void onProgressUpdateSent(Bundle bundle) {
throw new UnsupportedOperationException("It is not supported to send an interim update for " + this.mDebug);
}
/* access modifiers changed from: package-private */
public void onErrorSent(Bundle bundle) {
throw new UnsupportedOperationException("It is not supported to send an error for " + this.mDebug);
}
private void checkExtraFields(Bundle bundle) {
if (bundle != null && bundle.containsKey(MediaBrowserCompat.EXTRA_DOWNLOAD_PROGRESS)) {
float f = bundle.getFloat(MediaBrowserCompat.EXTRA_DOWNLOAD_PROGRESS);
if (f < -1.0E-5f || f > 1.00001f) {
throw new IllegalArgumentException("The value of the EXTRA_DOWNLOAD_PROGRESS field must be a float number within [0.0, 1.0]");
}
}
}
}
private class ServiceBinderImpl {
ServiceBinderImpl() {
}
public void connect(String str, int i, int i2, Bundle bundle, ServiceCallbacks serviceCallbacks) {
if (MediaBrowserServiceCompat.this.isValidPackage(str, i2)) {
final ServiceCallbacks serviceCallbacks2 = serviceCallbacks;
final String str2 = str;
final int i3 = i;
final int i4 = i2;
final Bundle bundle2 = bundle;
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
IBinder asBinder = serviceCallbacks2.asBinder();
MediaBrowserServiceCompat.this.mConnections.remove(asBinder);
ConnectionRecord connectionRecord = new ConnectionRecord(str2, i3, i4, bundle2, serviceCallbacks2);
MediaBrowserServiceCompat.this.mCurConnection = connectionRecord;
connectionRecord.root = MediaBrowserServiceCompat.this.onGetRoot(str2, i4, bundle2);
MediaBrowserServiceCompat.this.mCurConnection = null;
if (connectionRecord.root == null) {
Log.i(MediaBrowserServiceCompat.TAG, "No root for client " + str2 + " from service " + getClass().getName());
try {
serviceCallbacks2.onConnectFailed();
} catch (RemoteException unused) {
Log.w(MediaBrowserServiceCompat.TAG, "Calling onConnectFailed() failed. Ignoring. pkg=" + str2);
}
} else {
try {
MediaBrowserServiceCompat.this.mConnections.put(asBinder, connectionRecord);
asBinder.linkToDeath(connectionRecord, 0);
if (MediaBrowserServiceCompat.this.mSession != null) {
serviceCallbacks2.onConnect(connectionRecord.root.getRootId(), MediaBrowserServiceCompat.this.mSession, connectionRecord.root.getExtras());
}
} catch (RemoteException unused2) {
Log.w(MediaBrowserServiceCompat.TAG, "Calling onConnect() failed. Dropping client. pkg=" + str2);
MediaBrowserServiceCompat.this.mConnections.remove(asBinder);
}
}
}
});
return;
}
throw new IllegalArgumentException("Package/uid mismatch: uid=" + i2 + " package=" + str);
}
public void disconnect(final ServiceCallbacks serviceCallbacks) {
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
ConnectionRecord remove = MediaBrowserServiceCompat.this.mConnections.remove(serviceCallbacks.asBinder());
if (remove != null) {
remove.callbacks.asBinder().unlinkToDeath(remove, 0);
}
}
});
}
public void addSubscription(String str, IBinder iBinder, Bundle bundle, ServiceCallbacks serviceCallbacks) {
final ServiceCallbacks serviceCallbacks2 = serviceCallbacks;
final String str2 = str;
final IBinder iBinder2 = iBinder;
final Bundle bundle2 = bundle;
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
ConnectionRecord connectionRecord = MediaBrowserServiceCompat.this.mConnections.get(serviceCallbacks2.asBinder());
if (connectionRecord == null) {
Log.w(MediaBrowserServiceCompat.TAG, "addSubscription for callback that isn't registered id=" + str2);
return;
}
MediaBrowserServiceCompat.this.addSubscription(str2, connectionRecord, iBinder2, bundle2);
}
});
}
public void removeSubscription(final String str, final IBinder iBinder, final ServiceCallbacks serviceCallbacks) {
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
ConnectionRecord connectionRecord = MediaBrowserServiceCompat.this.mConnections.get(serviceCallbacks.asBinder());
if (connectionRecord == null) {
Log.w(MediaBrowserServiceCompat.TAG, "removeSubscription for callback that isn't registered id=" + str);
} else if (!MediaBrowserServiceCompat.this.removeSubscription(str, connectionRecord, iBinder)) {
Log.w(MediaBrowserServiceCompat.TAG, "removeSubscription called for " + str + " which is not subscribed");
}
}
});
}
public void getMediaItem(final String str, final ResultReceiver resultReceiver, final ServiceCallbacks serviceCallbacks) {
if (!TextUtils.isEmpty(str) && resultReceiver != null) {
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
ConnectionRecord connectionRecord = MediaBrowserServiceCompat.this.mConnections.get(serviceCallbacks.asBinder());
if (connectionRecord == null) {
Log.w(MediaBrowserServiceCompat.TAG, "getMediaItem for callback that isn't registered id=" + str);
return;
}
MediaBrowserServiceCompat.this.performLoadItem(str, connectionRecord, resultReceiver);
}
});
}
}
public void registerCallbacks(ServiceCallbacks serviceCallbacks, String str, int i, int i2, Bundle bundle) {
final ServiceCallbacks serviceCallbacks2 = serviceCallbacks;
final int i3 = i2;
final String str2 = str;
final int i4 = i;
final Bundle bundle2 = bundle;
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
ConnectionRecord connectionRecord;
IBinder asBinder = serviceCallbacks2.asBinder();
MediaBrowserServiceCompat.this.mConnections.remove(asBinder);
Iterator<ConnectionRecord> it = MediaBrowserServiceCompat.this.mPendingConnections.iterator();
while (true) {
connectionRecord = null;
if (!it.hasNext()) {
break;
}
ConnectionRecord next = it.next();
if (next.uid == i3) {
if (TextUtils.isEmpty(str2) || i4 <= 0) {
connectionRecord = new ConnectionRecord(next.pkg, next.pid, next.uid, bundle2, serviceCallbacks2);
}
it.remove();
}
}
if (connectionRecord == null) {
connectionRecord = new ConnectionRecord(str2, i4, i3, bundle2, serviceCallbacks2);
}
MediaBrowserServiceCompat.this.mConnections.put(asBinder, connectionRecord);
try {
asBinder.linkToDeath(connectionRecord, 0);
} catch (RemoteException unused) {
Log.w(MediaBrowserServiceCompat.TAG, "IBinder is already dead.");
}
}
});
}
public void unregisterCallbacks(final ServiceCallbacks serviceCallbacks) {
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
IBinder asBinder = serviceCallbacks.asBinder();
ConnectionRecord remove = MediaBrowserServiceCompat.this.mConnections.remove(asBinder);
if (remove != null) {
asBinder.unlinkToDeath(remove, 0);
}
}
});
}
public void search(String str, Bundle bundle, ResultReceiver resultReceiver, ServiceCallbacks serviceCallbacks) {
if (!TextUtils.isEmpty(str) && resultReceiver != null) {
final ServiceCallbacks serviceCallbacks2 = serviceCallbacks;
final String str2 = str;
final Bundle bundle2 = bundle;
final ResultReceiver resultReceiver2 = resultReceiver;
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
ConnectionRecord connectionRecord = MediaBrowserServiceCompat.this.mConnections.get(serviceCallbacks2.asBinder());
if (connectionRecord == null) {
Log.w(MediaBrowserServiceCompat.TAG, "search for callback that isn't registered query=" + str2);
return;
}
MediaBrowserServiceCompat.this.performSearch(str2, bundle2, connectionRecord, resultReceiver2);
}
});
}
}
public void sendCustomAction(String str, Bundle bundle, ResultReceiver resultReceiver, ServiceCallbacks serviceCallbacks) {
if (!TextUtils.isEmpty(str) && resultReceiver != null) {
final ServiceCallbacks serviceCallbacks2 = serviceCallbacks;
final String str2 = str;
final Bundle bundle2 = bundle;
final ResultReceiver resultReceiver2 = resultReceiver;
MediaBrowserServiceCompat.this.mHandler.postOrRun(new Runnable() {
public void run() {
ConnectionRecord connectionRecord = MediaBrowserServiceCompat.this.mConnections.get(serviceCallbacks2.asBinder());
if (connectionRecord == null) {
Log.w(MediaBrowserServiceCompat.TAG, "sendCustomAction for callback that isn't registered action=" + str2 + ", extras=" + bundle2);
return;
}
MediaBrowserServiceCompat.this.performCustomAction(str2, bundle2, connectionRecord, resultReceiver2);
}
});
}
}
}
private static class ServiceCallbacksCompat implements ServiceCallbacks {
final Messenger mCallbacks;
ServiceCallbacksCompat(Messenger messenger) {
this.mCallbacks = messenger;
}
public IBinder asBinder() {
return this.mCallbacks.getBinder();
}
public void onConnect(String str, MediaSessionCompat.Token token, Bundle bundle) throws RemoteException {
if (bundle == null) {
bundle = new Bundle();
}
bundle.putInt(MediaBrowserProtocol.EXTRA_SERVICE_VERSION, 2);
Bundle bundle2 = new Bundle();
bundle2.putString(MediaBrowserProtocol.DATA_MEDIA_ITEM_ID, str);
bundle2.putParcelable(MediaBrowserProtocol.DATA_MEDIA_SESSION_TOKEN, token);
bundle2.putBundle(MediaBrowserProtocol.DATA_ROOT_HINTS, bundle);
sendRequest(1, bundle2);
}
public void onConnectFailed() throws RemoteException {
sendRequest(2, (Bundle) null);
}
public void onLoadChildren(String str, List<MediaBrowserCompat.MediaItem> list, Bundle bundle, Bundle bundle2) throws RemoteException {
Bundle bundle3 = new Bundle();
bundle3.putString(MediaBrowserProtocol.DATA_MEDIA_ITEM_ID, str);
bundle3.putBundle(MediaBrowserProtocol.DATA_OPTIONS, bundle);
bundle3.putBundle(MediaBrowserProtocol.DATA_NOTIFY_CHILDREN_CHANGED_OPTIONS, bundle2);
if (list != null) {
bundle3.putParcelableArrayList(MediaBrowserProtocol.DATA_MEDIA_ITEM_LIST, list instanceof ArrayList ? (ArrayList) list : new ArrayList(list));
}
sendRequest(3, bundle3);
}
private void sendRequest(int i, Bundle bundle) throws RemoteException {
Message obtain = Message.obtain();
obtain.what = i;
obtain.arg1 = 2;
obtain.setData(bundle);
this.mCallbacks.send(obtain);
}
}
static class ResultWrapper<T> {
MediaBrowserService.Result mResultFwk;
ResultWrapper(MediaBrowserService.Result result) {
this.mResultFwk = result;
}
public void sendResult(T t) {
if (t instanceof List) {
this.mResultFwk.sendResult(parcelListToItemList((List) t));
} else if (t instanceof Parcel) {
Parcel parcel = (Parcel) t;
parcel.setDataPosition(0);
this.mResultFwk.sendResult(MediaBrowser.MediaItem.CREATOR.createFromParcel(parcel));
parcel.recycle();
} else {
this.mResultFwk.sendResult((Object) null);
}
}
public void detach() {
this.mResultFwk.detach();
}
/* access modifiers changed from: package-private */
public List<MediaBrowser.MediaItem> parcelListToItemList(List<Parcel> list) {
if (list == null) {
return null;
}
ArrayList arrayList = new ArrayList();
for (Parcel next : list) {
next.setDataPosition(0);
arrayList.add((MediaBrowser.MediaItem) MediaBrowser.MediaItem.CREATOR.createFromParcel(next));
next.recycle();
}
return arrayList;
}
}
public void attachToBaseContext(Context context) {
attachBaseContext(context);
}
public void onCreate() {
super.onCreate();
if (Build.VERSION.SDK_INT >= 28) {
this.mImpl = new MediaBrowserServiceImplApi28();
} else if (Build.VERSION.SDK_INT >= 26) {
this.mImpl = new MediaBrowserServiceImplApi26();
} else if (Build.VERSION.SDK_INT >= 23) {
this.mImpl = new MediaBrowserServiceImplApi23();
} else if (Build.VERSION.SDK_INT >= 21) {
this.mImpl = new MediaBrowserServiceImplApi21();
} else {
this.mImpl = new MediaBrowserServiceImplBase();
}
this.mImpl.onCreate();
}
public IBinder onBind(Intent intent) {
return this.mImpl.onBind(intent);
}
public void onLoadChildren(String str, Result<List<MediaBrowserCompat.MediaItem>> result, Bundle bundle) {
result.setFlags(1);
onLoadChildren(str, result);
}
public void onLoadItem(String str, Result<MediaBrowserCompat.MediaItem> result) {
result.setFlags(2);
result.sendResult(null);
}
public void onSearch(String str, Bundle bundle, Result<List<MediaBrowserCompat.MediaItem>> result) {
result.setFlags(4);
result.sendResult(null);
}
public void onCustomAction(String str, Bundle bundle, Result<Bundle> result) {
result.sendError((Bundle) null);
}
public void setSessionToken(MediaSessionCompat.Token token) {
if (token == null) {
throw new IllegalArgumentException("Session token may not be null");
} else if (this.mSession == null) {
this.mSession = token;
this.mImpl.setSessionToken(token);
} else {
throw new IllegalStateException("The session token has already been set");
}
}
public MediaSessionCompat.Token getSessionToken() {
return this.mSession;
}
public final Bundle getBrowserRootHints() {
return this.mImpl.getBrowserRootHints();
}
public final MediaSessionManager.RemoteUserInfo getCurrentBrowserInfo() {
return this.mImpl.getCurrentBrowserInfo();
}
public void notifyChildrenChanged(String str) {
if (str != null) {
this.mImpl.notifyChildrenChanged(str, (Bundle) null);
return;
}
throw new IllegalArgumentException("parentId cannot be null in notifyChildrenChanged");
}
public void notifyChildrenChanged(String str, Bundle bundle) {
if (str == null) {
throw new IllegalArgumentException("parentId cannot be null in notifyChildrenChanged");
} else if (bundle != null) {
this.mImpl.notifyChildrenChanged(str, bundle);
} else {
throw new IllegalArgumentException("options cannot be null in notifyChildrenChanged");
}
}
public void notifyChildrenChanged(MediaSessionManager.RemoteUserInfo remoteUserInfo, String str, Bundle bundle) {
if (remoteUserInfo == null) {
throw new IllegalArgumentException("remoteUserInfo cannot be null in notifyChildrenChanged");
} else if (str == null) {
throw new IllegalArgumentException("parentId cannot be null in notifyChildrenChanged");
} else if (bundle != null) {
this.mImpl.notifyChildrenChanged(remoteUserInfo, str, bundle);
} else {
throw new IllegalArgumentException("options cannot be null in notifyChildrenChanged");
}
}
/* access modifiers changed from: package-private */
public boolean isValidPackage(String str, int i) {
if (str == null) {
return false;
}
for (String equals : getPackageManager().getPackagesForUid(i)) {
if (equals.equals(str)) {
return true;
}
}
return false;
}
/* access modifiers changed from: package-private */
public void addSubscription(String str, ConnectionRecord connectionRecord, IBinder iBinder, Bundle bundle) {
List<Pair> list = connectionRecord.subscriptions.get(str);
if (list == null) {
list = new ArrayList<>();
}
for (Pair pair : list) {
if (iBinder == pair.first && MediaBrowserCompatUtils.areSameOptions(bundle, (Bundle) pair.second)) {
return;
}
}
list.add(new Pair(iBinder, bundle));
connectionRecord.subscriptions.put(str, list);
performLoadChildren(str, connectionRecord, bundle, (Bundle) null);
this.mCurConnection = connectionRecord;
onSubscribe(str, bundle);
this.mCurConnection = null;
}
/* access modifiers changed from: package-private */
public boolean removeSubscription(String str, ConnectionRecord connectionRecord, IBinder iBinder) {
boolean z = true;
boolean z2 = false;
if (iBinder == null) {
try {
if (connectionRecord.subscriptions.remove(str) == null) {
z = false;
}
return z;
} finally {
this.mCurConnection = connectionRecord;
onUnsubscribe(str);
this.mCurConnection = null;
}
} else {
List list = connectionRecord.subscriptions.get(str);
if (list != null) {
Iterator it = list.iterator();
while (it.hasNext()) {
if (iBinder == ((Pair) it.next()).first) {
it.remove();
z2 = true;
}
}
if (list.size() == 0) {
connectionRecord.subscriptions.remove(str);
}
}
this.mCurConnection = connectionRecord;
onUnsubscribe(str);
this.mCurConnection = null;
return z2;
}
}
/* access modifiers changed from: package-private */
public void performLoadChildren(String str, ConnectionRecord connectionRecord, Bundle bundle, Bundle bundle2) {
final ConnectionRecord connectionRecord2 = connectionRecord;
final String str2 = str;
final Bundle bundle3 = bundle;
final Bundle bundle4 = bundle2;
AnonymousClass1 r0 = new Result<List<MediaBrowserCompat.MediaItem>>(str) {
/* access modifiers changed from: package-private */
public void onResultSent(List<MediaBrowserCompat.MediaItem> list) {
if (MediaBrowserServiceCompat.this.mConnections.get(connectionRecord2.callbacks.asBinder()) == connectionRecord2) {
if ((getFlags() & 1) != 0) {
list = MediaBrowserServiceCompat.this.applyOptions(list, bundle3);
}
try {
connectionRecord2.callbacks.onLoadChildren(str2, list, bundle3, bundle4);
} catch (RemoteException unused) {
Log.w(MediaBrowserServiceCompat.TAG, "Calling onLoadChildren() failed for id=" + str2 + " package=" + connectionRecord2.pkg);
}
} else if (MediaBrowserServiceCompat.DEBUG) {
Log.d(MediaBrowserServiceCompat.TAG, "Not sending onLoadChildren result for connection that has been disconnected. pkg=" + connectionRecord2.pkg + " id=" + str2);
}
}
};
this.mCurConnection = connectionRecord;
if (bundle == null) {
onLoadChildren(str, r0);
} else {
onLoadChildren(str, r0, bundle);
}
this.mCurConnection = null;
if (!r0.isDone()) {
throw new IllegalStateException("onLoadChildren must call detach() or sendResult() before returning for package=" + connectionRecord.pkg + " id=" + str);
}
}
/* access modifiers changed from: package-private */
public List<MediaBrowserCompat.MediaItem> applyOptions(List<MediaBrowserCompat.MediaItem> list, Bundle bundle) {
if (list == null) {
return null;
}
int i = bundle.getInt(MediaBrowserCompat.EXTRA_PAGE, -1);
int i2 = bundle.getInt(MediaBrowserCompat.EXTRA_PAGE_SIZE, -1);
if (i == -1 && i2 == -1) {
return list;
}
int i3 = i2 * i;
int i4 = i3 + i2;
if (i < 0 || i2 < 1 || i3 >= list.size()) {
return Collections.emptyList();
}
if (i4 > list.size()) {
i4 = list.size();
}
return list.subList(i3, i4);
}
/* access modifiers changed from: package-private */
public void performLoadItem(String str, ConnectionRecord connectionRecord, final ResultReceiver resultReceiver) {
AnonymousClass2 r0 = new Result<MediaBrowserCompat.MediaItem>(str) {
/* access modifiers changed from: package-private */
public void onResultSent(MediaBrowserCompat.MediaItem mediaItem) {
if ((getFlags() & 2) != 0) {
resultReceiver.send(-1, (Bundle) null);
return;
}
Bundle bundle = new Bundle();
bundle.putParcelable(MediaBrowserServiceCompat.KEY_MEDIA_ITEM, mediaItem);
resultReceiver.send(0, bundle);
}
};
this.mCurConnection = connectionRecord;
onLoadItem(str, r0);
this.mCurConnection = null;
if (!r0.isDone()) {
throw new IllegalStateException("onLoadItem must call detach() or sendResult() before returning for id=" + str);
}
}
/* access modifiers changed from: package-private */
public void performSearch(String str, Bundle bundle, ConnectionRecord connectionRecord, final ResultReceiver resultReceiver) {
AnonymousClass3 r0 = new Result<List<MediaBrowserCompat.MediaItem>>(str) {
/* access modifiers changed from: package-private */
public void onResultSent(List<MediaBrowserCompat.MediaItem> list) {
if ((getFlags() & 4) != 0 || list == null) {
resultReceiver.send(-1, (Bundle) null);
return;
}
Bundle bundle = new Bundle();
bundle.putParcelableArray(MediaBrowserServiceCompat.KEY_SEARCH_RESULTS, (Parcelable[]) list.toArray(new MediaBrowserCompat.MediaItem[0]));
resultReceiver.send(0, bundle);
}
};
this.mCurConnection = connectionRecord;
onSearch(str, bundle, r0);
this.mCurConnection = null;
if (!r0.isDone()) {
throw new IllegalStateException("onSearch must call detach() or sendResult() before returning for query=" + str);
}
}
/* access modifiers changed from: package-private */
public void performCustomAction(String str, Bundle bundle, ConnectionRecord connectionRecord, final ResultReceiver resultReceiver) {
AnonymousClass4 r0 = new Result<Bundle>(str) {
/* access modifiers changed from: package-private */
public void onResultSent(Bundle bundle) {
resultReceiver.send(0, bundle);
}
/* access modifiers changed from: package-private */
public void onProgressUpdateSent(Bundle bundle) {
resultReceiver.send(1, bundle);
}
/* access modifiers changed from: package-private */
public void onErrorSent(Bundle bundle) {
resultReceiver.send(-1, bundle);
}
};
this.mCurConnection = connectionRecord;
onCustomAction(str, bundle, r0);
this.mCurConnection = null;
if (!r0.isDone()) {
throw new IllegalStateException("onCustomAction must call detach() or sendResult() or sendError() before returning for action=" + str + " extras=" + bundle);
}
}
public static final class BrowserRoot {
public static final String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE";
public static final String EXTRA_RECENT = "android.service.media.extra.RECENT";
public static final String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";
@Deprecated
public static final String EXTRA_SUGGESTION_KEYWORDS = "android.service.media.extra.SUGGESTION_KEYWORDS";
/* access modifiers changed from: private */
public final Bundle mExtras;
/* access modifiers changed from: private */
public final String mRootId;
public BrowserRoot(String str, Bundle bundle) {
if (str != null) {
this.mRootId = str;
this.mExtras = bundle;
return;
}
throw new IllegalArgumentException("The root id in BrowserRoot cannot be null. Use null for BrowserRoot instead");
}
public String getRootId() {
return this.mRootId;
}
public Bundle getExtras() {
return this.mExtras;
}
}
}
Download file