导航菜单

页面标题

页面副标题

All File Recovery v1.0.2 - f.java 源代码

正在查看: All File Recovery v1.0.2 应用的 f.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package T1;

import F.w;
import J0.s;
import K.C0412a;
import T1.h;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.browse.MediaBrowser;
import android.media.session.MediaSession;
import android.media.session.MediaSessionManager;
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.MediaSessionCompat;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import d0.C0965b;
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;
import l.InterfaceC1344i;
import l.J;
import l.U;
import l.Z;

public abstract class f extends Service {

    public static final String f6595i = "MBServiceCompat";

    public static final boolean f6596j = Log.isLoggable(f6595i, 3);

    public static final float f6597k = 1.0E-5f;

    public static final String f6598l = "android.media.browse.MediaBrowserService";

    @Z({Z.a.LIBRARY})
    public static final String f6599m = "media_item";

    @Z({Z.a.LIBRARY})
    public static final String f6600n = "search_results";

    public static final int f6601o = 1;

    public static final int f6602p = 2;

    public static final int f6603q = 4;

    @Z({Z.a.LIBRARY})
    public static final int f6604r = -1;

    @Z({Z.a.LIBRARY})
    public static final int f6605s = 0;

    @Z({Z.a.LIBRARY})
    public static final int f6606t = 1;

    public g f6607a;

    public C0088f f6612f;

    public MediaSessionCompat.Token f6614h;

    public final o f6608b = new o();

    public final C0088f f6609c = new C0088f(h.b.f6732b, -1, -1, null, null);

    public final ArrayList<C0088f> f6610d = new ArrayList<>();

    public final C0412a<IBinder, C0088f> f6611e = new C0412a<>();

    public final r f6613g = new r(this);

    public class a extends m<List<MediaBrowserCompat.MediaItem>> {

        public final C0088f f6615f;

        public final String f6616g;

        public final Bundle f6617h;

        public final Bundle f6618i;

        public a(Object obj, C0088f c0088f, String str, Bundle bundle, Bundle bundle2) {
            super(obj);
            this.f6615f = c0088f;
            this.f6616g = str;
            this.f6617h = bundle;
            this.f6618i = bundle2;
        }

        @Override
        public void g(@Nullable List<MediaBrowserCompat.MediaItem> list) {
            if (f.this.f6611e.get(this.f6615f.f6637f.asBinder()) != this.f6615f) {
                if (f.f6596j) {
                    Log.d(f.f6595i, "Not sending onLoadChildren result for connection that has been disconnected. pkg=" + this.f6615f.f6632a + " id=" + this.f6616g);
                    return;
                }
                return;
            }
            if ((c() & 1) != 0) {
                list = f.this.b(list, this.f6617h);
            }
            try {
                this.f6615f.f6637f.a(this.f6616g, list, this.f6617h, this.f6618i);
            } catch (RemoteException unused) {
                StringBuilder sb = new StringBuilder("Calling onLoadChildren() failed for id=");
                sb.append(this.f6616g);
                sb.append(" package=");
                C0965b.a(sb, this.f6615f.f6632a, f.f6595i);
            }
        }
    }

    public class b extends m<MediaBrowserCompat.MediaItem> {

        public final g.c f6620f;

        public b(Object obj, g.c cVar) {
            super(obj);
            this.f6620f = cVar;
        }

        @Override
        public void g(@Nullable MediaBrowserCompat.MediaItem mediaItem) {
            if ((c() & 2) != 0) {
                this.f6620f.b(-1, null);
                return;
            }
            Bundle bundle = new Bundle();
            bundle.putParcelable(f.f6599m, mediaItem);
            this.f6620f.b(0, bundle);
        }
    }

    public class c extends m<List<MediaBrowserCompat.MediaItem>> {

        public final g.c f6622f;

        public c(Object obj, g.c cVar) {
            super(obj);
            this.f6622f = cVar;
        }

        @Override
        public void g(@Nullable List<MediaBrowserCompat.MediaItem> list) {
            if ((c() & 4) != 0 || list == null) {
                this.f6622f.b(-1, null);
                return;
            }
            Bundle bundle = new Bundle();
            bundle.putParcelableArray(f.f6600n, (Parcelable[]) list.toArray(new MediaBrowserCompat.MediaItem[0]));
            this.f6622f.b(0, bundle);
        }
    }

    public class d extends m<Bundle> {

        public final g.c f6624f;

        public d(Object obj, g.c cVar) {
            super(obj);
            this.f6624f = cVar;
        }

        @Override
        public void e(@Nullable Bundle bundle) {
            this.f6624f.b(-1, bundle);
        }

        @Override
        public void f(@Nullable Bundle bundle) {
            this.f6624f.b(1, bundle);
        }

        @Override
        public void g(@Nullable Bundle bundle) {
            this.f6624f.b(0, bundle);
        }
    }

    public static final class e {

        public static final String f6626c = "android.service.media.extra.RECENT";

        public static final String f6627d = "android.service.media.extra.OFFLINE";

        public static final String f6628e = "android.service.media.extra.SUGGESTED";

        @Deprecated
        public static final String f6629f = "android.service.media.extra.SUGGESTION_KEYWORDS";

        public final String f6630a;

        public final Bundle f6631b;

        public e(@NonNull String str, @Nullable Bundle bundle) {
            if (str == null) {
                throw new IllegalArgumentException("The root id in BrowserRoot cannot be null. Use null for BrowserRoot instead");
            }
            this.f6630a = str;
            this.f6631b = bundle;
        }

        public Bundle c() {
            return this.f6631b;
        }

        public String d() {
            return this.f6630a;
        }
    }

    public class C0088f implements IBinder.DeathRecipient {

        public final String f6632a;

        public final int f6633b;

        public final int f6634c;

        public final h.b f6635d;

        public final Bundle f6636e;

        public final p f6637f;

        public final HashMap<String, List<s<IBinder, Bundle>>> f6638g = new HashMap<>();

        public e f6639h;

        public class a implements Runnable {
            public a() {
            }

            @Override
            public void run() {
                C0088f c0088f = C0088f.this;
                f.this.f6611e.remove(c0088f.f6637f.asBinder());
            }
        }

        public C0088f(String str, int i4, int i5, Bundle bundle, p pVar) {
            this.f6632a = str;
            this.f6633b = i4;
            this.f6634c = i5;
            this.f6635d = new h.b(str, i4, i5);
            this.f6636e = bundle;
            this.f6637f = pVar;
        }

        @Override
        public void binderDied() {
            f.this.f6613g.post(new a());
        }
    }

    public interface g {
        h.b a();

        void b(String str, Bundle bundle);

        Bundle c();

        void d(MediaSessionCompat.Token token);

        void e(h.b bVar, String str, Bundle bundle);

        IBinder onBind(Intent intent);

        void onCreate();
    }

    @U(21)
    public class h implements g {

        public final List<Bundle> f6642a = new ArrayList();

        public MediaBrowserService f6643b;

        public Messenger f6644c;

        public class a implements Runnable {

            public final MediaSessionCompat.Token f6646a;

            public a(MediaSessionCompat.Token token) {
                this.f6646a = token;
            }

            @Override
            public void run() {
                h.this.l(this.f6646a);
            }
        }

        public class b extends m<List<MediaBrowserCompat.MediaItem>> {

            public final n f6648f;

            public b(Object obj, n nVar) {
                super(obj);
                this.f6648f = nVar;
            }

            @Override
            public void b() {
                this.f6648f.a();
            }

            @Override
            public void g(@Nullable List<MediaBrowserCompat.MediaItem> list) {
                ArrayList arrayList;
                if (list == null) {
                    arrayList = null;
                } else {
                    ArrayList arrayList2 = new ArrayList(list.size());
                    for (MediaBrowserCompat.MediaItem mediaItem : list) {
                        Parcel obtain = Parcel.obtain();
                        mediaItem.writeToParcel(obtain, 0);
                        arrayList2.add(obtain);
                    }
                    arrayList = arrayList2;
                }
                this.f6648f.c(arrayList);
            }
        }

        public class c implements Runnable {

            public final String f6650a;

            public final Bundle f6651b;

            public c(String str, Bundle bundle) {
                this.f6650a = str;
                this.f6651b = bundle;
            }

            @Override
            public void run() {
                Iterator it = ((C0412a.c) f.this.f6611e.keySet()).iterator();
                while (it.hasNext()) {
                    h.this.h(f.this.f6611e.get((IBinder) it.next()), this.f6650a, this.f6651b);
                }
            }
        }

        public class d implements Runnable {

            public final h.b f6653a;

            public final String f6654b;

            public final Bundle f6655c;

            public d(h.b bVar, String str, Bundle bundle) {
                this.f6653a = bVar;
                this.f6654b = str;
                this.f6655c = bundle;
            }

            @Override
            public void run() {
                for (int i4 = 0; i4 < f.this.f6611e.size(); i4++) {
                    C0088f n4 = f.this.f6611e.n(i4);
                    if (n4.f6635d.equals(this.f6653a)) {
                        h.this.h(n4, this.f6654b, this.f6655c);
                    }
                }
            }
        }

        @U(21)
        public class e extends MediaBrowserService {
            public e(Context context) {
                attachBaseContext(context);
            }

            @Override
            public MediaBrowserService.BrowserRoot onGetRoot(String str, int i4, Bundle bundle) {
                MediaSessionCompat.b(bundle);
                e j4 = h.this.j(str, i4, bundle == null ? null : new Bundle(bundle));
                if (j4 == null) {
                    return null;
                }
                return new MediaBrowserService.BrowserRoot(j4.f6630a, j4.f6631b);
            }

            @Override
            public void onLoadChildren(String str, MediaBrowserService.Result<List<MediaBrowser.MediaItem>> result) {
                h.this.k(str, new n<>(result));
            }
        }

        public h() {
        }

        @Override
        public h.b a() {
            C0088f c0088f = f.this.f6612f;
            if (c0088f != null) {
                return c0088f.f6635d;
            }
            throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
        }

        @Override
        public void b(String str, Bundle bundle) {
            i(str, bundle);
            g(str, bundle);
        }

        @Override
        public Bundle c() {
            if (this.f6644c == null) {
                return null;
            }
            C0088f c0088f = f.this.f6612f;
            if (c0088f == null) {
                throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
            }
            if (c0088f.f6636e == null) {
                return null;
            }
            return new Bundle(f.this.f6612f.f6636e);
        }

        @Override
        public void d(MediaSessionCompat.Token token) {
            f.this.f6613g.a(new a(token));
        }

        @Override
        public void e(h.b bVar, String str, Bundle bundle) {
            f(bVar, str, bundle);
        }

        public void f(h.b bVar, String str, Bundle bundle) {
            f.this.f6613g.post(new d(bVar, str, bundle));
        }

        public void g(String str, Bundle bundle) {
            f.this.f6613g.post(new c(str, bundle));
        }

        public void h(C0088f c0088f, String str, Bundle bundle) {
            List<s<IBinder, Bundle>> list = c0088f.f6638g.get(str);
            if (list != null) {
                for (s<IBinder, Bundle> sVar : list) {
                    if (T1.d.b(bundle, sVar.f3059b)) {
                        f.this.u(str, c0088f, sVar.f3059b, bundle);
                    }
                }
            }
        }

        public void i(String str, Bundle bundle) {
            this.f6643b.notifyChildrenChanged(str);
        }

        public e j(String str, int i4, Bundle bundle) {
            Bundle bundle2;
            int i5 = -1;
            if (bundle == null || bundle.getInt(T1.e.f6584p, 0) == 0) {
                bundle2 = null;
            } else {
                bundle.remove(T1.e.f6584p);
                this.f6644c = new Messenger(f.this.f6613g);
                bundle2 = new Bundle();
                bundle2.putInt(T1.e.f6586r, 2);
                bundle2.putBinder(T1.e.f6587s, this.f6644c.getBinder());
                MediaSessionCompat.Token token = f.this.f6614h;
                if (token != null) {
                    android.support.v4.media.session.b d4 = token.d();
                    bundle2.putBinder(T1.e.f6588t, d4 == null ? null : d4.asBinder());
                } else {
                    this.f6642a.add(bundle2);
                }
                i5 = bundle.getInt(T1.e.f6585q, -1);
                bundle.remove(T1.e.f6585q);
            }
            C0088f c0088f = f.this.new C0088f(str, i5, i4, bundle, null);
            f fVar = f.this;
            fVar.f6612f = c0088f;
            e m4 = fVar.m(str, i4, bundle);
            f fVar2 = f.this;
            fVar2.f6612f = null;
            if (m4 == null) {
                return null;
            }
            if (this.f6644c != null) {
                fVar2.f6610d.add(c0088f);
            }
            if (bundle2 == null) {
                bundle2 = m4.f6631b;
            } else {
                Bundle bundle3 = m4.f6631b;
                if (bundle3 != null) {
                    bundle2.putAll(bundle3);
                }
            }
            return new e(m4.f6630a, bundle2);
        }

        public void k(String str, n<List<Parcel>> nVar) {
            b bVar = new b(str, nVar);
            f fVar = f.this;
            fVar.f6612f = fVar.f6609c;
            fVar.n(str, bVar);
            f.this.f6612f = null;
        }

        public void l(MediaSessionCompat.Token token) {
            if (!this.f6642a.isEmpty()) {
                android.support.v4.media.session.b d4 = token.d();
                if (d4 != null) {
                    Iterator<Bundle> it = this.f6642a.iterator();
                    while (it.hasNext()) {
                        it.next().putBinder(T1.e.f6588t, d4.asBinder());
                    }
                }
                this.f6642a.clear();
            }
            this.f6643b.setSessionToken((MediaSession.Token) token.f12029b);
        }

        @Override
        public IBinder onBind(Intent intent) {
            return this.f6643b.onBind(intent);
        }

        @Override
        public void onCreate() {
            e eVar = new e(f.this);
            this.f6643b = eVar;
            eVar.onCreate();
        }
    }

    @U(23)
    public class i extends h {

        public class a extends m<MediaBrowserCompat.MediaItem> {

            public final n f6659f;

            public a(Object obj, n nVar) {
                super(obj);
                this.f6659f = nVar;
            }

            @Override
            public void b() {
                this.f6659f.a();
            }

            @Override
            public void g(@Nullable MediaBrowserCompat.MediaItem mediaItem) {
                if (mediaItem == null) {
                    this.f6659f.c(null);
                    return;
                }
                Parcel obtain = Parcel.obtain();
                mediaItem.writeToParcel(obtain, 0);
                this.f6659f.c(obtain);
            }
        }

        public class b extends h.e {
            public b(Context context) {
                super(context);
            }

            @Override
            public void onLoadItem(String str, MediaBrowserService.Result<MediaBrowser.MediaItem> result) {
                i.this.m(str, new n<>(result));
            }
        }

        public i() {
            super();
        }

        public void m(String str, n<Parcel> nVar) {
            a aVar = new a(str, nVar);
            f fVar = f.this;
            fVar.f6612f = fVar.f6609c;
            fVar.p(str, aVar);
            f.this.f6612f = null;
        }

        @Override
        public void onCreate() {
            b bVar = new b(f.this);
            this.f6643b = bVar;
            bVar.onCreate();
        }
    }

    @U(26)
    public class j extends i {

        public class a extends m<List<MediaBrowserCompat.MediaItem>> {

            public final n f6663f;

            public final Bundle f6664g;

            public a(Object obj, n nVar, Bundle bundle) {
                super(obj);
                this.f6663f = nVar;
                this.f6664g = bundle;
            }

            @Override
            public void b() {
                this.f6663f.a();
            }

            @Override
            public void g(@Nullable List<MediaBrowserCompat.MediaItem> list) {
                if (list == null) {
                    this.f6663f.c(null);
                    return;
                }
                if ((c() & 1) != 0) {
                    list = f.this.b(list, this.f6664g);
                }
                ArrayList arrayList = new ArrayList(list.size());
                for (MediaBrowserCompat.MediaItem mediaItem : list) {
                    Parcel obtain = Parcel.obtain();
                    mediaItem.writeToParcel(obtain, 0);
                    arrayList.add(obtain);
                }
                this.f6663f.c(arrayList);
            }
        }

        public class b extends i.b {
            public b(Context context) {
                super(context);
            }

            @Override
            public void onLoadChildren(String str, MediaBrowserService.Result<List<MediaBrowser.MediaItem>> result, Bundle bundle) {
                MediaSessionCompat.b(bundle);
                j jVar = j.this;
                f fVar = f.this;
                fVar.f6612f = fVar.f6609c;
                jVar.n(str, new n<>(result), bundle);
                f.this.f6612f = null;
            }
        }

        public j() {
            super();
        }

        @Override
        public Bundle c() {
            f fVar = f.this;
            C0088f c0088f = fVar.f6612f;
            if (c0088f == null) {
                throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
            }
            if (c0088f == fVar.f6609c) {
                return this.f6643b.getBrowserRootHints();
            }
            if (c0088f.f6636e == null) {
                return null;
            }
            return new Bundle(f.this.f6612f.f6636e);
        }

        @Override
        public void i(String str, Bundle bundle) {
            if (bundle != null) {
                this.f6643b.notifyChildrenChanged(str, bundle);
            } else {
                super.i(str, bundle);
            }
        }

        public void n(String str, n<List<Parcel>> nVar, Bundle bundle) {
            a aVar = new a(str, nVar, bundle);
            f fVar = f.this;
            fVar.f6612f = fVar.f6609c;
            fVar.o(str, aVar, bundle);
            f.this.f6612f = null;
        }

        @Override
        public void onCreate() {
            b bVar = new b(f.this);
            this.f6643b = bVar;
            bVar.onCreate();
        }
    }

    @U(28)
    public class k extends j {
        public k() {
            super();
        }

        @Override
        public h.b a() {
            MediaSessionManager.RemoteUserInfo currentBrowserInfo;
            f fVar = f.this;
            C0088f c0088f = fVar.f6612f;
            if (c0088f == null) {
                throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
            }
            if (c0088f != fVar.f6609c) {
                return c0088f.f6635d;
            }
            currentBrowserInfo = this.f6643b.getCurrentBrowserInfo();
            return new h.b(currentBrowserInfo);
        }
    }

    public class l implements g {

        public Messenger f6668a;

        public class a implements Runnable {

            public final MediaSessionCompat.Token f6670a;

            public a(MediaSessionCompat.Token token) {
                this.f6670a = token;
            }

            @Override
            public void run() {
                Iterator it = ((C0412a.e) f.this.f6611e.values()).iterator();
                while (it.hasNext()) {
                    C0088f c0088f = (C0088f) it.next();
                    try {
                        p pVar = c0088f.f6637f;
                        e eVar = c0088f.f6639h;
                        pVar.c(eVar.f6630a, this.f6670a, eVar.f6631b);
                    } catch (RemoteException unused) {
                        Log.w(f.f6595i, "Connection for " + c0088f.f6632a + " is no longer valid.");
                        it.remove();
                    }
                }
            }
        }

        public class b implements Runnable {

            public final String f6672a;

            public final Bundle f6673b;

            public b(String str, Bundle bundle) {
                this.f6672a = str;
                this.f6673b = bundle;
            }

            @Override
            public void run() {
                Iterator it = ((C0412a.c) f.this.f6611e.keySet()).iterator();
                while (it.hasNext()) {
                    l.this.f(f.this.f6611e.get((IBinder) it.next()), this.f6672a, this.f6673b);
                }
            }
        }

        public class c implements Runnable {

            public final h.b f6675a;

            public final String f6676b;

            public final Bundle f6677c;

            public c(h.b bVar, String str, Bundle bundle) {
                this.f6675a = bVar;
                this.f6676b = str;
                this.f6677c = bundle;
            }

            @Override
            public void run() {
                for (int i4 = 0; i4 < f.this.f6611e.size(); i4++) {
                    C0088f n4 = f.this.f6611e.n(i4);
                    if (n4.f6635d.equals(this.f6675a)) {
                        l.this.f(n4, this.f6676b, this.f6677c);
                        return;
                    }
                }
            }
        }

        public l() {
        }

        @Override
        public h.b a() {
            C0088f c0088f = f.this.f6612f;
            if (c0088f != null) {
                return c0088f.f6635d;
            }
            throw new IllegalStateException("This should be called inside of onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
        }

        @Override
        public void b(@NonNull String str, Bundle bundle) {
            f.this.f6613g.post(new b(str, bundle));
        }

        @Override
        public Bundle c() {
            C0088f c0088f = f.this.f6612f;
            if (c0088f == null) {
                throw new IllegalStateException("This should be called inside of onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
            }
            if (c0088f.f6636e == null) {
                return null;
            }
            return new Bundle(f.this.f6612f.f6636e);
        }

        @Override
        public void d(MediaSessionCompat.Token token) {
            f.this.f6613g.post(new a(token));
        }

        @Override
        public void e(@NonNull h.b bVar, @NonNull String str, Bundle bundle) {
            f.this.f6613g.post(new c(bVar, str, bundle));
        }

        public void f(C0088f c0088f, String str, Bundle bundle) {
            List<s<IBinder, Bundle>> list = c0088f.f6638g.get(str);
            if (list != null) {
                for (s<IBinder, Bundle> sVar : list) {
                    if (T1.d.b(bundle, sVar.f3059b)) {
                        f.this.u(str, c0088f, sVar.f3059b, bundle);
                    }
                }
            }
        }

        @Override
        public IBinder onBind(Intent intent) {
            if (f.f6598l.equals(intent.getAction())) {
                return this.f6668a.getBinder();
            }
            return null;
        }

        @Override
        public void onCreate() {
            this.f6668a = new Messenger(f.this.f6613g);
        }
    }

    @U(21)
    public static class n<T> {

        public MediaBrowserService.Result f6684a;

        public n(MediaBrowserService.Result result) {
            this.f6684a = result;
        }

        public void a() {
            this.f6684a.detach();
        }

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

        public void c(T t3) {
            if (t3 instanceof List) {
                this.f6684a.sendResult(b((List) t3));
                return;
            }
            if (!(t3 instanceof Parcel)) {
                this.f6684a.sendResult(null);
                return;
            }
            Parcel parcel = (Parcel) t3;
            parcel.setDataPosition(0);
            this.f6684a.sendResult(MediaBrowser.MediaItem.CREATOR.createFromParcel(parcel));
            parcel.recycle();
        }
    }

    public class o {

        public class a implements Runnable {

            public final p f6686a;

            public final String f6687b;

            public final int f6688c;

            public final int f6689d;

            public final Bundle f6690e;

            public a(p pVar, String str, int i4, int i5, Bundle bundle) {
                this.f6686a = pVar;
                this.f6687b = str;
                this.f6688c = i4;
                this.f6689d = i5;
                this.f6690e = bundle;
            }

            @Override
            public void run() {
                IBinder asBinder = this.f6686a.asBinder();
                f.this.f6611e.remove(asBinder);
                C0088f c0088f = f.this.new C0088f(this.f6687b, this.f6688c, this.f6689d, this.f6690e, this.f6686a);
                f fVar = f.this;
                fVar.f6612f = c0088f;
                e m4 = fVar.m(this.f6687b, this.f6689d, this.f6690e);
                c0088f.f6639h = m4;
                f fVar2 = f.this;
                fVar2.f6612f = null;
                if (m4 == null) {
                    Log.i(f.f6595i, "No root for client " + this.f6687b + " from service " + getClass().getName());
                    try {
                        this.f6686a.b();
                        return;
                    } catch (RemoteException unused) {
                        C0965b.a(new StringBuilder("Calling onConnectFailed() failed. Ignoring. pkg="), this.f6687b, f.f6595i);
                        return;
                    }
                }
                try {
                    fVar2.f6611e.put(asBinder, c0088f);
                    asBinder.linkToDeath(c0088f, 0);
                    MediaSessionCompat.Token token = f.this.f6614h;
                    if (token != null) {
                        p pVar = this.f6686a;
                        e eVar = c0088f.f6639h;
                        pVar.c(eVar.f6630a, token, eVar.f6631b);
                    }
                } catch (RemoteException unused2) {
                    C0965b.a(new StringBuilder("Calling onConnect() failed. Dropping client. pkg="), this.f6687b, f.f6595i);
                    f.this.f6611e.remove(asBinder);
                }
            }
        }

        public class b implements Runnable {

            public final p f6692a;

            public b(p pVar) {
                this.f6692a = pVar;
            }

            @Override
            public void run() {
                C0088f remove = f.this.f6611e.remove(this.f6692a.asBinder());
                if (remove != null) {
                    remove.f6637f.asBinder().unlinkToDeath(remove, 0);
                }
            }
        }

        public class c implements Runnable {

            public final p f6694a;

            public final String f6695b;

            public final IBinder f6696c;

            public final Bundle f6697d;

            public c(p pVar, String str, IBinder iBinder, Bundle bundle) {
                this.f6694a = pVar;
                this.f6695b = str;
                this.f6696c = iBinder;
                this.f6697d = bundle;
            }

            @Override
            public void run() {
                C0088f c0088f = f.this.f6611e.get(this.f6694a.asBinder());
                if (c0088f == null) {
                    C0965b.a(new StringBuilder("addSubscription for callback that isn't registered id="), this.f6695b, f.f6595i);
                } else {
                    f.this.a(this.f6695b, c0088f, this.f6696c, this.f6697d);
                }
            }
        }

        public class d implements Runnable {

            public final p f6699a;

            public final String f6700b;

            public final IBinder f6701c;

            public d(p pVar, String str, IBinder iBinder) {
                this.f6699a = pVar;
                this.f6700b = str;
                this.f6701c = iBinder;
            }

            @Override
            public void run() {
                C0088f c0088f = f.this.f6611e.get(this.f6699a.asBinder());
                if (c0088f == null) {
                    C0965b.a(new StringBuilder("removeSubscription for callback that isn't registered id="), this.f6700b, f.f6595i);
                } else {
                    if (f.this.x(this.f6700b, c0088f, this.f6701c)) {
                        return;
                    }
                    Log.w(f.f6595i, "removeSubscription called for " + this.f6700b + " which is not subscribed");
                }
            }
        }

        public class e implements Runnable {

            public final p f6703a;

            public final String f6704b;

            public final g.c f6705c;

            public e(p pVar, String str, g.c cVar) {
                this.f6703a = pVar;
                this.f6704b = str;
                this.f6705c = cVar;
            }

            @Override
            public void run() {
                C0088f c0088f = f.this.f6611e.get(this.f6703a.asBinder());
                if (c0088f == null) {
                    C0965b.a(new StringBuilder("getMediaItem for callback that isn't registered id="), this.f6704b, f.f6595i);
                } else {
                    f.this.v(this.f6704b, c0088f, this.f6705c);
                }
            }
        }

        public class RunnableC0089f implements Runnable {

            public final p f6707a;

            public final int f6708b;

            public final String f6709c;

            public final int f6710d;

            public final Bundle f6711e;

            public RunnableC0089f(p pVar, int i4, String str, int i5, Bundle bundle) {
                this.f6707a = pVar;
                this.f6708b = i4;
                this.f6709c = str;
                this.f6710d = i5;
                this.f6711e = bundle;
            }

            @Override
            public void run() {
                C0088f c0088f;
                IBinder asBinder = this.f6707a.asBinder();
                f.this.f6611e.remove(asBinder);
                Iterator<C0088f> it = f.this.f6610d.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        break;
                    }
                    C0088f next = it.next();
                    if (next.f6634c == this.f6708b) {
                        c0088f = (TextUtils.isEmpty(this.f6709c) || this.f6710d <= 0) ? f.this.new C0088f(next.f6632a, next.f6633b, next.f6634c, this.f6711e, this.f6707a) : null;
                        it.remove();
                    }
                }
                if (c0088f == null) {
                    c0088f = f.this.new C0088f(this.f6709c, this.f6710d, this.f6708b, this.f6711e, this.f6707a);
                }
                f.this.f6611e.put(asBinder, c0088f);
                try {
                    asBinder.linkToDeath(c0088f, 0);
                } catch (RemoteException unused) {
                    Log.w(f.f6595i, "IBinder is already dead.");
                }
            }
        }

        public class g implements Runnable {

            public final p f6713a;

            public g(p pVar) {
                this.f6713a = pVar;
            }

            @Override
            public void run() {
                IBinder asBinder = this.f6713a.asBinder();
                C0088f remove = f.this.f6611e.remove(asBinder);
                if (remove != null) {
                    asBinder.unlinkToDeath(remove, 0);
                }
            }
        }

        public class h implements Runnable {

            public final p f6715a;

            public final String f6716b;

            public final Bundle f6717c;

            public final g.c f6718d;

            public h(p pVar, String str, Bundle bundle, g.c cVar) {
                this.f6715a = pVar;
                this.f6716b = str;
                this.f6717c = bundle;
                this.f6718d = cVar;
            }

            @Override
            public void run() {
                C0088f c0088f = f.this.f6611e.get(this.f6715a.asBinder());
                if (c0088f == null) {
                    C0965b.a(new StringBuilder("search for callback that isn't registered query="), this.f6716b, f.f6595i);
                } else {
                    f.this.w(this.f6716b, this.f6717c, c0088f, this.f6718d);
                }
            }
        }

        public class i implements Runnable {

            public final p f6720a;

            public final String f6721b;

            public final Bundle f6722c;

            public final g.c f6723d;

            public i(p pVar, String str, Bundle bundle, g.c cVar) {
                this.f6720a = pVar;
                this.f6721b = str;
                this.f6722c = bundle;
                this.f6723d = cVar;
            }

            @Override
            public void run() {
                C0088f c0088f = f.this.f6611e.get(this.f6720a.asBinder());
                if (c0088f != null) {
                    f.this.t(this.f6721b, this.f6722c, c0088f, this.f6723d);
                    return;
                }
                Log.w(f.f6595i, "sendCustomAction for callback that isn't registered action=" + this.f6721b + ", extras=" + this.f6722c);
            }
        }

        public o() {
        }

        public void a(String str, IBinder iBinder, Bundle bundle, p pVar) {
            f.this.f6613g.a(new c(pVar, str, iBinder, bundle));
        }

        public void b(String str, int i4, int i5, Bundle bundle, p pVar) {
            if (f.this.h(str, i5)) {
                f.this.f6613g.a(new a(pVar, str, i4, i5, bundle));
                return;
            }
            throw new IllegalArgumentException("Package/uid mismatch: uid=" + i5 + " package=" + str);
        }

        public void c(p pVar) {
            f.this.f6613g.a(new b(pVar));
        }

        public void d(String str, g.c cVar, p pVar) {
            if (TextUtils.isEmpty(str) || cVar == null) {
                return;
            }
            f.this.f6613g.a(new e(pVar, str, cVar));
        }

        public void e(p pVar, String str, int i4, int i5, Bundle bundle) {
            f.this.f6613g.a(new RunnableC0089f(pVar, i5, str, i4, bundle));
        }

        public void f(String str, IBinder iBinder, p pVar) {
            f.this.f6613g.a(new d(pVar, str, iBinder));
        }

        public void g(String str, Bundle bundle, g.c cVar, p pVar) {
            if (TextUtils.isEmpty(str) || cVar == null) {
                return;
            }
            f.this.f6613g.a(new h(pVar, str, bundle, cVar));
        }

        public void h(String str, Bundle bundle, g.c cVar, p pVar) {
            if (TextUtils.isEmpty(str) || cVar == null) {
                return;
            }
            f.this.f6613g.a(new i(pVar, str, bundle, cVar));
        }

        public void i(p pVar) {
            f.this.f6613g.a(new g(pVar));
        }
    }

    public interface p {
        void a(String str, List<MediaBrowserCompat.MediaItem> list, Bundle bundle, Bundle bundle2) throws RemoteException;

        IBinder asBinder();

        void b() throws RemoteException;

        void c(String str, MediaSessionCompat.Token token, Bundle bundle) throws RemoteException;
    }

    public static class q implements p {

        public final Messenger f6725a;

        public q(Messenger messenger) {
            this.f6725a = messenger;
        }

        @Override
        public void a(String str, List<MediaBrowserCompat.MediaItem> list, Bundle bundle, Bundle bundle2) throws RemoteException {
            Bundle bundle3 = new Bundle();
            bundle3.putString(T1.e.f6572d, str);
            bundle3.putBundle(T1.e.f6575g, bundle);
            bundle3.putBundle(T1.e.f6576h, bundle2);
            if (list != null) {
                bundle3.putParcelableArrayList(T1.e.f6573e, list instanceof ArrayList ? (ArrayList) list : new ArrayList<>(list));
            }
            d(3, bundle3);
        }

        @Override
        public IBinder asBinder() {
            return this.f6725a.getBinder();
        }

        @Override
        public void b() throws RemoteException {
            d(2, null);
        }

        @Override
        public void c(String str, MediaSessionCompat.Token token, Bundle bundle) throws RemoteException {
            if (bundle == null) {
                bundle = new Bundle();
            }
            bundle.putInt(T1.e.f6586r, 2);
            Bundle bundle2 = new Bundle();
            bundle2.putString(T1.e.f6572d, str);
            bundle2.putParcelable(T1.e.f6574f, token);
            bundle2.putBundle(T1.e.f6579k, bundle);
            d(1, bundle2);
        }

        public final void d(int i4, Bundle bundle) throws RemoteException {
            Message obtain = Message.obtain();
            obtain.what = i4;
            obtain.arg1 = 2;
            obtain.setData(bundle);
            this.f6725a.send(obtain);
        }
    }

    public static final class r extends Handler {

        @Nullable
        public f f6726a;

        @J
        public r(@NonNull f fVar) {
            this.f6726a = fVar;
        }

        public void a(Runnable runnable) {
            if (Thread.currentThread() == getLooper().getThread()) {
                runnable.run();
            } else {
                post(runnable);
            }
        }

        @J
        public void b() {
            this.f6726a = null;
        }

        @Override
        @J
        public void handleMessage(@NonNull Message message) {
            f fVar = this.f6726a;
            if (fVar != null) {
                fVar.g(message);
            } else {
                removeCallbacksAndMessages(null);
            }
        }

        @Override
        public boolean sendMessageAtTime(Message message, long j4) {
            Bundle data = message.getData();
            data.setClassLoader(MediaBrowserCompat.class.getClassLoader());
            data.putInt("data_calling_uid", Binder.getCallingUid());
            int callingPid = Binder.getCallingPid();
            if (callingPid > 0) {
                data.putInt("data_calling_pid", callingPid);
            } else if (!data.containsKey("data_calling_pid")) {
                data.putInt("data_calling_pid", -1);
            }
            return super.sendMessageAtTime(message, j4);
        }
    }

    public void a(String str, C0088f c0088f, IBinder iBinder, Bundle bundle) {
        List<s<IBinder, Bundle>> list = c0088f.f6638g.get(str);
        if (list == null) {
            list = new ArrayList<>();
        }
        for (s<IBinder, Bundle> sVar : list) {
            if (iBinder == sVar.f3058a && T1.d.a(bundle, sVar.f3059b)) {
                return;
            }
        }
        list.add(new s<>(iBinder, bundle));
        c0088f.f6638g.put(str, list);
        u(str, c0088f, bundle, null);
        this.f6612f = null;
    }

    public List<MediaBrowserCompat.MediaItem> b(List<MediaBrowserCompat.MediaItem> list, Bundle bundle) {
        if (list == null) {
            return null;
        }
        int i4 = bundle.getInt(MediaBrowserCompat.f11730d, -1);
        int i5 = bundle.getInt(MediaBrowserCompat.f11731e, -1);
        if (i4 == -1 && i5 == -1) {
            return list;
        }
        int i7 = i5 * i4;
        int i8 = i7 + i5;
        if (i4 < 0 || i5 < 1 || i7 >= list.size()) {
            return Collections.EMPTY_LIST;
        }
        if (i8 > list.size()) {
            i8 = list.size();
        }
        return list.subList(i7, i8);
    }

    @Z({Z.a.LIBRARY_GROUP_PREFIX})
    public void c(Context context) {
        attachBaseContext(context);
    }

    public final Bundle d() {
        return this.f6607a.c();
    }

    @NonNull
    public final h.b e() {
        return this.f6607a.a();
    }

    @Nullable
    public MediaSessionCompat.Token f() {
        return this.f6614h;
    }

    public void g(Message message) {
        Bundle data = message.getData();
        switch (message.what) {
            case 1:
                Bundle bundle = data.getBundle(T1.e.f6579k);
                MediaSessionCompat.b(bundle);
                this.f6608b.b(data.getString(T1.e.f6577i), data.getInt("data_calling_pid"), data.getInt("data_calling_uid"), bundle, new q(message.replyTo));
                break;
            case 2:
                this.f6608b.c(new q(message.replyTo));
                break;
            case 3:
                Bundle bundle2 = data.getBundle(T1.e.f6575g);
                MediaSessionCompat.b(bundle2);
                this.f6608b.a(data.getString(T1.e.f6572d), data.getBinder(T1.e.f6569a), bundle2, new q(message.replyTo));
                break;
            case 4:
                this.f6608b.f(data.getString(T1.e.f6572d), data.getBinder(T1.e.f6569a), new q(message.replyTo));
                break;
            case 5:
                this.f6608b.d(data.getString(T1.e.f6572d), (g.c) data.getParcelable(T1.e.f6578j), new q(message.replyTo));
                break;
            case 6:
                Bundle bundle3 = data.getBundle(T1.e.f6579k);
                MediaSessionCompat.b(bundle3);
                this.f6608b.e(new q(message.replyTo), data.getString(T1.e.f6577i), data.getInt("data_calling_pid"), data.getInt("data_calling_uid"), bundle3);
                break;
            case 7:
                this.f6608b.i(new q(message.replyTo));
                break;
            case 8:
                Bundle bundle4 = data.getBundle(T1.e.f6580l);
                MediaSessionCompat.b(bundle4);
                this.f6608b.g(data.getString(T1.e.f6581m), bundle4, (g.c) data.getParcelable(T1.e.f6578j), new q(message.replyTo));
                break;
            case 9:
                Bundle bundle5 = data.getBundle(T1.e.f6583o);
                MediaSessionCompat.b(bundle5);
                this.f6608b.h(data.getString(T1.e.f6582n), bundle5, (g.c) data.getParcelable(T1.e.f6578j), new q(message.replyTo));
                break;
            default:
                Log.w(f6595i, "Unhandled message: " + message + "\n  Service version: 2\n  Client version: " + message.arg1);
                break;
        }
    }

    public boolean h(String str, int i4) {
        if (str == null) {
            return false;
        }
        for (String str2 : getPackageManager().getPackagesForUid(i4)) {
            if (str2.equals(str)) {
                return true;
            }
        }
        return false;
    }

    @Z({Z.a.LIBRARY_GROUP_PREFIX})
    public void i(@NonNull h.b bVar, @NonNull String str, @NonNull Bundle bundle) {
        if (bVar == null) {
            throw new IllegalArgumentException("remoteUserInfo cannot be null in notifyChildrenChanged");
        }
        if (str == null) {
            throw new IllegalArgumentException("parentId cannot be null in notifyChildrenChanged");
        }
        if (bundle == null) {
            throw new IllegalArgumentException("options cannot be null in notifyChildrenChanged");
        }
        this.f6607a.e(bVar, str, bundle);
    }

    public void j(@NonNull String str) {
        if (str == null) {
            throw new IllegalArgumentException("parentId cannot be null in notifyChildrenChanged");
        }
        this.f6607a.b(str, null);
    }

    public void k(@NonNull String str, @NonNull Bundle bundle) {
        if (str == null) {
            throw new IllegalArgumentException("parentId cannot be null in notifyChildrenChanged");
        }
        if (bundle == null) {
            throw new IllegalArgumentException("options cannot be null in notifyChildrenChanged");
        }
        this.f6607a.b(str, bundle);
    }

    public void l(@NonNull String str, Bundle bundle, @NonNull m<Bundle> mVar) {
        mVar.h(null);
    }

    @Nullable
    public abstract e m(@NonNull String str, int i4, @Nullable Bundle bundle);

    public abstract void n(@NonNull String str, @NonNull m<List<MediaBrowserCompat.MediaItem>> mVar);

    public void o(@NonNull String str, @NonNull m<List<MediaBrowserCompat.MediaItem>> mVar, @NonNull Bundle bundle) {
        mVar.k(1);
        n(str, mVar);
    }

    @Override
    public IBinder onBind(Intent intent) {
        return this.f6607a.onBind(intent);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        int i4 = Build.VERSION.SDK_INT;
        if (i4 >= 28) {
            this.f6607a = new k();
        } else if (i4 >= 26) {
            this.f6607a = new j();
        } else {
            this.f6607a = new i();
        }
        this.f6607a.onCreate();
    }

    @Override
    @J
    @InterfaceC1344i
    public void onDestroy() {
        this.f6613g.f6726a = null;
    }

    public void p(String str, @NonNull m<MediaBrowserCompat.MediaItem> mVar) {
        mVar.k(2);
        mVar.j(null);
    }

    public void q(@NonNull String str, Bundle bundle, @NonNull m<List<MediaBrowserCompat.MediaItem>> mVar) {
        mVar.k(4);
        mVar.j(null);
    }

    public void t(String str, Bundle bundle, C0088f c0088f, g.c cVar) {
        d dVar = new d(str, cVar);
        this.f6612f = c0088f;
        l(str, bundle, dVar);
        this.f6612f = null;
        if (dVar.d()) {
            return;
        }
        throw new IllegalStateException("onCustomAction must call detach() or sendResult() or sendError() before returning for action=" + str + " extras=" + bundle);
    }

    public void u(String str, C0088f c0088f, Bundle bundle, Bundle bundle2) {
        a aVar = new a(str, c0088f, str, bundle, bundle2);
        this.f6612f = c0088f;
        if (bundle == null) {
            n(str, aVar);
        } else {
            o(str, aVar, bundle);
        }
        this.f6612f = null;
        if (!aVar.d()) {
            throw new IllegalStateException(g1.c.a(new StringBuilder("onLoadChildren must call detach() or sendResult() before returning for package="), c0088f.f6632a, " id=", str));
        }
    }

    public void v(String str, C0088f c0088f, g.c cVar) {
        b bVar = new b(str, cVar);
        this.f6612f = c0088f;
        p(str, bVar);
        this.f6612f = null;
        if (!bVar.d()) {
            throw new IllegalStateException(w.a("onLoadItem must call detach() or sendResult() before returning for id=", str));
        }
    }

    public void w(String str, Bundle bundle, C0088f c0088f, g.c cVar) {
        c cVar2 = new c(str, cVar);
        this.f6612f = c0088f;
        q(str, bundle, cVar2);
        this.f6612f = null;
        if (!cVar2.d()) {
            throw new IllegalStateException(w.a("onSearch must call detach() or sendResult() before returning for query=", str));
        }
    }

    public boolean x(String str, C0088f c0088f, IBinder iBinder) {
        try {
            if (iBinder == null) {
                return c0088f.f6638g.remove(str) != null;
            }
            List<s<IBinder, Bundle>> list = c0088f.f6638g.get(str);
            if (list != null) {
                Iterator<s<IBinder, Bundle>> it = list.iterator();
                while (it.hasNext()) {
                    if (iBinder == it.next().f3058a) {
                        it.remove();
                        r0 = true;
                    }
                }
                if (list.size() == 0) {
                    c0088f.f6638g.remove(str);
                }
            }
            return r0;
        } finally {
            this.f6612f = null;
        }
    }

    public void y(MediaSessionCompat.Token token) {
        if (token == null) {
            throw new IllegalArgumentException("Session token may not be null");
        }
        if (this.f6614h != null) {
            throw new IllegalStateException("The session token has already been set");
        }
        this.f6614h = token;
        this.f6607a.d(token);
    }

    public static class m<T> {

        public final Object f6679a;

        public boolean f6680b;

        public boolean f6681c;

        public boolean f6682d;

        public int f6683e;

        public m(Object obj) {
            this.f6679a = obj;
        }

        public final void a(@Nullable Bundle bundle) {
            if (bundle != null && bundle.containsKey(MediaBrowserCompat.f11733g)) {
                float f4 = bundle.getFloat(MediaBrowserCompat.f11733g);
                if (f4 < -1.0E-5f || f4 > 1.00001f) {
                    throw new IllegalArgumentException("The value of the EXTRA_DOWNLOAD_PROGRESS field must be a float number within [0.0, 1.0]");
                }
            }
        }

        public void b() {
            if (this.f6680b) {
                throw new IllegalStateException("detach() called when detach() had already been called for: " + this.f6679a);
            }
            if (this.f6681c) {
                throw new IllegalStateException("detach() called when sendResult() had already been called for: " + this.f6679a);
            }
            if (!this.f6682d) {
                this.f6680b = true;
            } else {
                throw new IllegalStateException("detach() called when sendError() had already been called for: " + this.f6679a);
            }
        }

        public int c() {
            return this.f6683e;
        }

        public boolean d() {
            return this.f6680b || this.f6681c || this.f6682d;
        }

        public void e(@Nullable Bundle bundle) {
            throw new UnsupportedOperationException("It is not supported to send an error for " + this.f6679a);
        }

        public void f(@Nullable Bundle bundle) {
            throw new UnsupportedOperationException("It is not supported to send an interim update for " + this.f6679a);
        }

        public void h(@Nullable Bundle bundle) {
            if (this.f6681c || this.f6682d) {
                throw new IllegalStateException("sendError() called when either sendResult() or sendError() had already been called for: " + this.f6679a);
            }
            this.f6682d = true;
            e(bundle);
        }

        public void i(@Nullable Bundle bundle) {
            if (this.f6681c || this.f6682d) {
                throw new IllegalStateException("sendProgressUpdate() called when either sendResult() or sendError() had already been called for: " + this.f6679a);
            }
            a(bundle);
            f(bundle);
        }

        public void j(@Nullable T t3) {
            if (this.f6681c || this.f6682d) {
                throw new IllegalStateException("sendResult() called when either sendResult() or sendError() had already been called for: " + this.f6679a);
            }
            this.f6681c = true;
            g(t3);
        }

        public void k(int i4) {
            this.f6683e = i4;
        }

        public void g(@Nullable T t3) {
        }
    }

    @Z({Z.a.LIBRARY_GROUP_PREFIX})
    public void s(String str) {
    }

    @Z({Z.a.LIBRARY_GROUP_PREFIX})
    public void r(String str, Bundle bundle) {
    }

    @Override
    public void dump(FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
    }
}