package X6FRs_4.WwEq_13;

import android.content.Context;
import android.content.Intent;
import android.media.browse.MediaBrowser;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.service.media.MediaBrowserService;
import android.support.v4.media.session.MediaSessionCompat;
import java.util.ArrayList;
import java.util.List;
/* compiled from: MediaBrowserServiceCompatApi21.java */
/* loaded from: classes.dex */
public class X6FRs_4 {

    /* compiled from: MediaBrowserServiceCompatApi21.java */
    /* loaded from: classes.dex */
    public static class KQgRr5e_0 {
        public final Bundle KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final String f1105KQgRr5e_0;
    }

    /* compiled from: MediaBrowserServiceCompatApi21.java */
    /* loaded from: classes.dex */
    public interface Mqv2r_3 {
        KQgRr5e_0 KQgRr5e_0(String str, int i, Bundle bundle);

        void KQgRr5e_0(String str, PGPF6hQ_2<List<Parcel>> pGPF6hQ_2);
    }

    /* compiled from: MediaBrowserServiceCompatApi21.java */
    /* loaded from: classes.dex */
    public static class QxJ9d_1 extends MediaBrowserService {
        public final Mqv2r_3 KQgRr5e_0;

        public QxJ9d_1(Context context, Mqv2r_3 mqv2r_3) {
            attachBaseContext(context);
            this.KQgRr5e_0 = mqv2r_3;
        }

        @Override // android.service.media.MediaBrowserService
        public MediaBrowserService.BrowserRoot onGetRoot(String str, int i, Bundle bundle) {
            MediaSessionCompat.KQgRr5e_0(bundle);
            KQgRr5e_0 KQgRr5e_0 = this.KQgRr5e_0.KQgRr5e_0(str, i, bundle == null ? null : new Bundle(bundle));
            if (KQgRr5e_0 == null) {
                return null;
            }
            return new MediaBrowserService.BrowserRoot(KQgRr5e_0.f1105KQgRr5e_0, KQgRr5e_0.KQgRr5e_0);
        }

        @Override // android.service.media.MediaBrowserService
        public void onLoadChildren(String str, MediaBrowserService.Result<List<MediaBrowser.MediaItem>> result) {
            this.KQgRr5e_0.KQgRr5e_0(str, new PGPF6hQ_2<>(result));
        }
    }

    public static Object KQgRr5e_0(Context context, Mqv2r_3 mqv2r_3) {
        return new QxJ9d_1(context, mqv2r_3);
    }

    public static void KQgRr5e_0(Object obj) {
        ((MediaBrowserService) obj).onCreate();
    }

    public static IBinder KQgRr5e_0(Object obj, Intent intent) {
        return ((MediaBrowserService) obj).onBind(intent);
    }

    /* compiled from: MediaBrowserServiceCompatApi21.java */
    /* loaded from: classes.dex */
    public static class PGPF6hQ_2<T> {
        public MediaBrowserService.Result KQgRr5e_0;

        public PGPF6hQ_2(MediaBrowserService.Result result) {
            this.KQgRr5e_0 = result;
        }

        /* JADX WARN: Multi-variable type inference failed */
        public void KQgRr5e_0(T t) {
            if (t instanceof List) {
                this.KQgRr5e_0.sendResult(KQgRr5e_0((List) t));
            } else if (t instanceof Parcel) {
                Parcel parcel = (Parcel) t;
                parcel.setDataPosition(0);
                this.KQgRr5e_0.sendResult(MediaBrowser.MediaItem.CREATOR.createFromParcel(parcel));
                parcel.recycle();
            } else {
                this.KQgRr5e_0.sendResult(null);
            }
        }

        public List<MediaBrowser.MediaItem> KQgRr5e_0(List<Parcel> list) {
            if (list == null) {
                return null;
            }
            ArrayList arrayList = new ArrayList();
            for (Parcel parcel : list) {
                parcel.setDataPosition(0);
                arrayList.add(MediaBrowser.MediaItem.CREATOR.createFromParcel(parcel));
                parcel.recycle();
            }
            return arrayList;
        }
    }
}
