导航菜单

页面标题

页面副标题

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

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

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


package r3;

import X1.F1;
import X1.N;
import X1.d0;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.graphics.Bitmap;
import android.media.session.MediaSession;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.text.TextUtils;
import android.view.KeyEvent;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import r3.C1008b6;
import r3.C1078j4;
import s3.n;
import s3.o;

public class C1008b6 extends n.b {
    public static final String r = "MediaSessionLegacyStub";
    public static final int s;
    public static final String t = "androidx.media3.session.id";
    public static final String u = ".";
    public static final int v = 300000;
    public final C1055h<o.e> f;
    public final Y4 g;
    public final s3.o h;
    public final f i;
    public final d j;
    public final s3.n k;

    @Nullable
    public final g l;

    @Nullable
    public final ComponentName m;

    @Nullable
    public s3.s n;
    public volatile long o;

    @Nullable
    public G8.f0<Bitmap> p;
    public int q;

    @l.U(31)
    public static final class c {
        public static void a(s3.n nVar, ComponentName componentName) {
            try {
                Object g = nVar.g();
                g.getClass();
                ((MediaSession) g).setMediaButtonBroadcastReceiver(componentName);
            } catch (IllegalArgumentException e) {
                if (!Build.MANUFACTURER.equals("motorola")) {
                    throw e;
                }
                a2.D.e(C1008b6.r, "caught IllegalArgumentException on a motorola device when attempting to set the media button broadcast receiver. See https://github.com/androidx/media/issues/1730 for details.", e);
            }
        }
    }

    public static class d extends Handler {
        public static final int b = 1001;
        public final C1055h<o.e> a;

        public d(Looper looper, C1055h<o.e> c1055h) {
            super(looper);
            this.a = c1055h;
        }

        public void a(C1078j4.h hVar, long j) {
            removeMessages(1001, hVar);
            sendMessageDelayed(obtainMessage(1001, hVar), j);
        }

        @Override
        public void handleMessage(Message message) {
            C1078j4.h hVar = (C1078j4.h) message.obj;
            if (this.a.n(hVar)) {
                try {
                    C1078j4.g gVar = hVar.e;
                    a2.a.k(gVar);
                    gVar.b(0);
                } catch (RemoteException unused) {
                }
                this.a.s(hVar);
            }
        }
    }

    public static final class e implements C1078j4.g {
        public final o.e a;

        public e(o.e eVar) {
            this.a = eVar;
        }

        public boolean equals(@Nullable Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || obj.getClass() != e.class) {
                return false;
            }
            return Objects.equals(this.a, ((e) obj).a);
        }

        public int hashCode() {
            return Objects.hash(this.a);
        }
    }

    public final class g extends BroadcastReceiver {
        public g() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            KeyEvent keyEvent;
            if (Objects.equals(intent.getAction(), "android.intent.action.MEDIA_BUTTON") && (keyEvent = (KeyEvent) intent.getParcelableExtra("android.intent.extra.KEY_EVENT")) != null) {
                C1008b6.this.k.e().d(keyEvent);
            }
        }

        public g(C1008b6 c1008b6, a aVar) {
            this();
        }
    }

    public interface h {
        void a(C1078j4.h hVar) throws RemoteException;
    }

    static {
        s = a2.u0.a >= 31 ? 33554432 : 0;
    }

    public C1008b6(Y4 y42, Uri uri, Handler handler, Bundle bundle) {
        ComponentName D0;
        boolean z;
        PendingIntent foregroundService;
        this.g = y42;
        Context n0 = y42.n0();
        this.h = s3.o.b(n0);
        this.i = new f();
        C1055h<o.e> c1055h = new C1055h<>(y42);
        this.f = c1055h;
        this.o = androidx.work.z.h;
        this.j = new d(y42.j0().getLooper(), c1055h);
        ComponentName M0 = M0(n0);
        this.m = M0;
        if (M0 == null || a2.u0.a < 31) {
            D0 = D0(n0, AbstractServiceC1184v3.l);
            D0 = D0 == null ? D0(n0, AbstractServiceC1080j6.i) : D0;
            z = (D0 == null || D0.equals(M0)) ? false : true;
        } else {
            z = false;
            D0 = M0;
        }
        Intent intent = new Intent("android.intent.action.MEDIA_BUTTON", uri);
        if (D0 == null) {
            g gVar = new g();
            this.l = gVar;
            IntentFilter intentFilter = new IntentFilter("android.intent.action.MEDIA_BUTTON");
            intentFilter.addDataScheme(uri.getScheme());
            a2.u0.S1(n0, gVar, intentFilter);
            intent.setPackage(n0.getPackageName());
            foregroundService = PendingIntent.getBroadcast(n0, 0, intent, s);
            D0 = new ComponentName(n0, n0.getClass());
        } else {
            intent.setComponent(D0);
            foregroundService = z ? a2.u0.a >= 26 ? PendingIntent.getForegroundService(n0, 0, intent, s) : PendingIntent.getService(n0, 0, intent, s) : PendingIntent.getBroadcast(n0, 0, intent, s);
            this.l = null;
        }
        String join = TextUtils.join(u, new String[]{t, y42.q0()});
        ComponentName componentName = D0;
        int i = a2.u0.a;
        s3.n nVar = new s3.n(n0, join, i >= 31 ? null : componentName, i < 31 ? foregroundService : null, bundle, null);
        this.k = nVar;
        if (i >= 31 && M0 != null) {
            c.a(nVar, M0);
        }
        PendingIntent w0 = y42.w0();
        if (w0 != null) {
            nVar.E(w0);
        }
        nVar.q(this, handler);
    }

    public static String A0(Throwable th) {
        return C2.p.a(th, new StringBuilder("Failed to load bitmap: "));
    }

    @Nullable
    public static ComponentName D0(Context context, String str) {
        PackageManager packageManager = context.getPackageManager();
        Intent intent = new Intent(str);
        intent.setPackage(context.getPackageName());
        List<ResolveInfo> queryIntentServices = packageManager.queryIntentServices(intent, 0);
        if (queryIntentServices == null || queryIntentServices.isEmpty()) {
            return null;
        }
        ServiceInfo serviceInfo = queryIntentServices.get(0).serviceInfo;
        return new ComponentName(serviceInfo.packageName, serviceInfo.name);
    }

    public static void G(C1008b6 c1008b6, a8 a8Var) {
        c1008b6.k.w(a8Var.D1());
        c1008b6.i.S(a8Var.N().c(17) ? a8Var.getCurrentTimeline() : X1.F1.a);
    }

    public static void H(h hVar, C1078j4.h hVar2) {
        try {
            hVar.a(hVar2);
        } catch (RemoteException e2) {
            a2.D.o(r, "Exception in " + hVar2, e2);
        }
    }

    public static boolean I0(@Nullable a8 a8Var, a8 a8Var2) {
        if (a8Var == null) {
            return true;
        }
        Bundle bundle = a8Var.e1;
        boolean z = bundle.getBoolean("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS", false);
        boolean z2 = bundle.getBoolean("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT", false);
        Bundle bundle2 = a8Var2.e1;
        return (z == bundle2.getBoolean("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS", false) && z2 == bundle2.getBoolean("android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT", false)) ? false : true;
    }

    public static void J(C1008b6 c1008b6, s3.l lVar, C1078j4.h hVar) {
        c1008b6.getClass();
        String str = lVar.a;
        if (TextUtils.isEmpty(str)) {
            a2.D.n(r, "onRemoveQueueItem(): Media ID shouldn't be null");
            return;
        }
        a8 v0 = c1008b6.g.v0();
        if (!v0.S0(17)) {
            a2.D.n(r, "Can't remove item by ID without COMMAND_GET_TIMELINE being available");
            return;
        }
        X1.F1 currentTimeline = v0.getCurrentTimeline();
        F1.d dVar = new F1.d();
        for (int i = 0; i < currentTimeline.v(); i++) {
            if (TextUtils.equals(currentTimeline.u(i, dVar, 0L).c.a, str)) {
                v0.u(i);
                return;
            }
        }
    }

    public static void M(C1008b6 c1008b6, f8 f8Var, Bundle bundle, C1078j4.h hVar) {
        Y4 y42 = c1008b6.g;
        if (bundle == null) {
            bundle = Bundle.EMPTY;
        }
        y42.O0(hVar, f8Var, bundle);
    }

    @Nullable
    public static ComponentName M0(Context context) {
        PackageManager packageManager = context.getPackageManager();
        Intent intent = new Intent("android.intent.action.MEDIA_BUTTON");
        intent.setPackage(context.getPackageName());
        List<ResolveInfo> queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, 0);
        if (queryBroadcastReceivers.size() == 1) {
            ActivityInfo activityInfo = queryBroadcastReceivers.get(0).activityInfo;
            return new ComponentName(activityInfo.packageName, activityInfo.name);
        }
        if (queryBroadcastReceivers.isEmpty()) {
            return null;
        }
        throw new IllegalStateException("Expected 1 broadcast receiver that handles android.intent.action.MEDIA_BUTTON, found " + queryBroadcastReceivers.size());
    }

    public static void O0(final ResultReceiver resultReceiver, final G8.u0<j8> u0Var) {
        u0Var.addListener(new Runnable() {
            @Override
            public final void run() {
                C1008b6.f0(u0Var, resultReceiver);
            }
        }, G8.M.a);
    }

    public static void P(C1008b6 c1008b6, f8 f8Var, Bundle bundle, ResultReceiver resultReceiver, C1078j4.h hVar) {
        Y4 y42 = c1008b6.g;
        if (bundle == null) {
            bundle = Bundle.EMPTY;
        }
        G8.u0<j8> O0 = y42.O0(hVar, f8Var, bundle);
        if (resultReceiver != null) {
            O0(resultReceiver, O0);
        }
    }

    public static void Q(C1008b6 c1008b6, s3.l lVar, int i, C1078j4.h hVar) {
        c1008b6.getClass();
        if (TextUtils.isEmpty(lVar.a)) {
            a2.D.n(r, "onAddQueueItem(): Media ID shouldn't be empty");
        } else {
            G8.i0.c(c1008b6.g.M0(hVar, v8.M2.y(C1207y.B(lVar))), c1008b6.new b(hVar, i), G8.M.a);
        }
    }

    public static void Q0(s3.n nVar, @Nullable PendingIntent pendingIntent) {
        nVar.u(pendingIntent);
    }

    public static void R0(s3.n nVar, @Nullable s3.m mVar) {
        nVar.v(mVar);
    }

    public static void S0(s3.n nVar, @Nullable List<n.l> list) {
        nVar.z(list);
    }

    public static void V(C1008b6 c1008b6, X1.h0 h0Var, C1078j4.h hVar) {
        X1.N M1 = c1008b6.g.v0().M1();
        if (M1 == null) {
            return;
        }
        c1008b6.g.Z0(hVar, M1.a, h0Var);
    }

    public static void b0(C1008b6 c1008b6, f8 f8Var, int i, o.e eVar, h hVar) {
        if (c1008b6.g.J0()) {
            return;
        }
        if (!c1008b6.k.k()) {
            StringBuilder sb = new StringBuilder("Ignore incoming session command before initialization. command=");
            sb.append(f8Var == null ? Integer.valueOf(i) : f8Var.b);
            sb.append(", pid=");
            sb.append(eVar.a.b());
            a2.D.n(r, sb.toString());
            return;
        }
        C1078j4.h V0 = c1008b6.V0(eVar);
        if (V0 == null) {
            return;
        }
        if (f8Var != null) {
            if (!c1008b6.f.q(V0, f8Var)) {
                return;
            }
        } else if (!c1008b6.f.p(V0, i)) {
            return;
        }
        try {
            hVar.a(V0);
        } catch (RemoteException e2) {
            a2.D.o(r, "Exception in " + V0, e2);
        }
    }

    public static void c0(C1008b6 c1008b6, X1.N n, boolean z, C1078j4.h hVar) {
        G8.i0.c(c1008b6.g.X0(hVar, v8.M2.y(n), -1, -9223372036854775807L), c1008b6.new a(hVar, z), G8.M.a);
    }

    public static void f0(G8.u0 u0Var, ResultReceiver resultReceiver) {
        j8 j8Var;
        try {
            j8Var = (j8) u0Var.get();
            a2.a.h(j8Var, "SessionResult must not be null");
        } catch (InterruptedException e2) {
            e = e2;
            a2.D.o(r, "Custom command failed", e);
            j8Var = new j8(-1);
        } catch (CancellationException e3) {
            a2.D.o(r, "Custom command cancelled", e3);
            j8Var = new j8(1);
        } catch (ExecutionException e6) {
            e = e6;
            a2.D.o(r, "Custom command failed", e);
            j8Var = new j8(-1);
        }
        resultReceiver.send(j8Var.a, j8Var.b);
    }

    public static void g0(C1008b6 c1008b6, int i, o.e eVar, final h hVar, boolean z) {
        if (c1008b6.g.J0()) {
            return;
        }
        if (!c1008b6.k.k()) {
            StringBuilder a2 = android.support.v4.media.a.a("Ignore incoming player command before initialization. command=", i, ", pid=");
            a2.append(eVar.a.b());
            a2.D.n(r, a2.toString());
            return;
        }
        final C1078j4.h V0 = c1008b6.V0(eVar);
        if (V0 == null) {
            return;
        }
        if (!c1008b6.f.o(V0, i)) {
            if (i != 1 || c1008b6.g.v0().getPlayWhenReady()) {
                return;
            }
            a2.D.n(r, "Calling play() omitted due to COMMAND_PLAY_PAUSE not being available. If this play command has started the service for instance for playback resumption, this may prevent the service from being started into the foreground.");
            return;
        }
        if (c1008b6.g.U0(V0, i) != 0) {
            return;
        }
        ((H4) c1008b6.g.Y(V0, new Runnable() {
            @Override
            public final void run() {
                C1008b6.H(C1008b6.h.this, V0);
            }
        })).run();
        if (z) {
            Y4 y42 = c1008b6.g;
            d0.c.a aVar = new d0.c.a();
            aVar.a.a(i);
            y42.V0(V0, aVar.f());
        }
    }

    public static void j0(s3.n nVar, s3.m mVar) {
        nVar.v(mVar);
    }

    public static void o0(s3.n nVar, List list) {
        nVar.z(list);
    }

    public static X1.N v0(@Nullable String str, @Nullable Uri uri, @Nullable String str2, @Nullable Bundle bundle) {
        N.c cVar = new N.c();
        if (str == null) {
            str = "";
        }
        cVar.a = str;
        N.i.a aVar = new N.i.a();
        aVar.a = uri;
        aVar.b = str2;
        aVar.c = bundle;
        cVar.n = new N.i(aVar);
        return cVar.a();
    }

    @Override
    public void A() {
        if (this.g.v0().S0(9)) {
            w0(9, new h() {
                @Override
                public final void a(C1078j4.h hVar) {
                    C1008b6.this.g.v0().K();
                }
            }, this.k.a.p(), true);
        } else {
            w0(8, new h() {
                @Override
                public final void a(C1078j4.h hVar) {
                    C1008b6.this.g.v0().A();
                }
            }, this.k.a.p(), true);
        }
    }

    @Override
    public void B() {
        if (this.g.v0().S0(7)) {
            w0(7, new h() {
                @Override
                public final void a(C1078j4.h hVar) {
                    C1008b6.this.g.v0().w();
                }
            }, this.k.a.p(), true);
        } else {
            w0(6, new h() {
                @Override
                public final void a(C1078j4.h hVar) {
                    C1008b6.this.g.v0().p();
                }
            }, this.k.a.p(), true);
        }
    }

    public C1055h<o.e> B0() {
        return this.f;
    }

    @Override
    public void C(final long j) {
        if (j < 0) {
            return;
        }
        w0(10, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.v0().seekToDefaultPosition((int) j);
            }
        }, this.k.a.p(), true);
    }

    public C1078j4.g C0() {
        return this.i;
    }

    @Override
    public void D() {
        w0(3, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.v0().stop();
            }
        }, this.k.a.p(), true);
    }

    public s3.n E0() {
        return this.k;
    }

    public void F0(o.e eVar) {
        w0(1, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                a2.u0.V0(r0.g.v0(), C1008b6.this.g.x1());
            }
        }, eVar, true);
    }

    public final void G0(final X1.N n, final boolean z) {
        w0(31, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.c0(C1008b6.this, n, z, hVar);
            }
        }, this.k.a.p(), false);
    }

    public final void H0(@Nullable final s3.l lVar, final int i) {
        if (lVar != null) {
            if (i == -1 || i >= 0) {
                w0(20, new h() {
                    @Override
                    public final void a(C1078j4.h hVar) {
                        C1008b6.Q(C1008b6.this, lVar, i, hVar);
                    }
                }, this.k.a.p(), false);
            }
        }
    }

    public final boolean K0() {
        a8 v0 = this.g.v0();
        return v0.i1.c(17) && v0.N().c(17);
    }

    public final void L0(a8 a8Var) {
        int i = a8Var.S0(20) ? 4 : 0;
        if (this.q != i) {
            this.q = i;
            this.k.t(i);
        }
    }

    public void N0() {
        if (a2.u0.a < 31) {
            if (this.m == null) {
                this.k.u(null);
            } else {
                Intent intent = new Intent("android.intent.action.MEDIA_BUTTON", this.g.B0());
                intent.setComponent(this.m);
                this.k.u(PendingIntent.getBroadcast(this.g.n0(), 0, intent, s));
            }
        }
        if (this.l != null) {
            this.g.n0().unregisterReceiver(this.l);
        }
        this.k.l();
    }

    public void P0(long j) {
        this.o = j;
    }

    public final void T0(s3.n nVar, @Nullable CharSequence charSequence) {
        if (!K0()) {
            charSequence = null;
        }
        nVar.A(charSequence);
    }

    public void U0() {
        this.k.o(true);
    }

    @Nullable
    public final C1078j4.h V0(o.e eVar) {
        C1078j4.h k = this.f.k(eVar);
        if (k == null) {
            C1078j4.h hVar = new C1078j4.h(eVar, 0, 0, this.h.c(eVar), new e(eVar), Bundle.EMPTY, 0);
            C1078j4.f N0 = this.g.N0(hVar);
            if (!N0.a) {
                return null;
            }
            this.f.e(eVar, hVar, N0.b, N0.c);
            k = hVar;
        }
        this.j.a(k, this.o);
        return k;
    }

    public void W0(final a8 a8Var) {
        a2.u0.O1(this.g.j0(), new Runnable() {
            @Override
            public final void run() {
                C1008b6.this.k.w(a8Var.D1());
            }
        });
    }

    public void X0(final a8 a8Var) {
        a2.u0.O1(this.g.j0(), new Runnable() {
            @Override
            public final void run() {
                C1008b6.G(C1008b6.this, a8Var);
            }
        });
    }

    @Override
    public void b(@Nullable s3.l lVar) {
        H0(lVar, -1);
    }

    @Override
    public void c(@Nullable s3.l lVar, int i) {
        H0(lVar, i);
    }

    @Override
    public void d(String str, @Nullable final Bundle bundle, @Nullable final ResultReceiver resultReceiver) {
        a2.a.k(str);
        if (str.equals(O.I)) {
            return;
        }
        if (str.equals(O.H) && resultReceiver != null) {
            resultReceiver.send(0, this.g.A0().z());
        } else {
            final f8 f8Var = new f8(str, Bundle.EMPTY);
            y0(f8Var, new h() {
                @Override
                public final void a(C1078j4.h hVar) {
                    C1008b6.P(C1008b6.this, f8Var, bundle, resultReceiver, hVar);
                }
            });
        }
    }

    @Override
    public void e(String str, @Nullable final Bundle bundle) {
        if (str.equals(O.I)) {
            return;
        }
        final f8 f8Var = new f8(str, Bundle.EMPTY);
        y0(f8Var, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.M(C1008b6.this, f8Var, bundle, hVar);
            }
        });
    }

    @Override
    public void f() {
        w0(12, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.v0().m0();
            }
        }, this.k.a.p(), true);
    }

    @Override
    public boolean g(Intent intent) {
        Y4 y42 = this.g;
        o.e p = this.k.a.p();
        p.getClass();
        return y42.R0(new C1078j4.h(p, 0, 0, false, null, Bundle.EMPTY, 0), intent);
    }

    @Override
    public void h() {
        w0(1, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                a2.u0.S0(C1008b6.this.g.v0());
            }
        }, this.k.a.p(), true);
    }

    @Override
    public void i() {
        w0(1, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.D0(hVar, true);
            }
        }, this.k.a.p(), false);
    }

    @Override
    public void j(@Nullable String str, @Nullable Bundle bundle) {
        G0(v0(str, null, null, bundle), true);
    }

    @Override
    public void k(@Nullable String str, @Nullable Bundle bundle) {
        G0(v0(null, null, str, bundle), true);
    }

    @Override
    public void l(@Nullable Uri uri, @Nullable Bundle bundle) {
        G0(v0(null, uri, null, bundle), true);
    }

    @Override
    public void m() {
        w0(2, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.v0().d();
            }
        }, this.k.a.p(), true);
    }

    @Override
    public void n(@Nullable String str, @Nullable Bundle bundle) {
        G0(v0(str, null, null, bundle), false);
    }

    @Override
    public void o(@Nullable String str, @Nullable Bundle bundle) {
        G0(v0(null, null, str, bundle), false);
    }

    @Override
    public void p(@Nullable Uri uri, @Nullable Bundle bundle) {
        G0(v0(null, uri, null, bundle), false);
    }

    @Override
    public void q(@Nullable final s3.l lVar) {
        if (lVar == null) {
            return;
        }
        w0(20, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.J(C1008b6.this, lVar, hVar);
            }
        }, this.k.a.p(), true);
    }

    @Override
    public void s() {
        w0(11, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.v0().n0();
            }
        }, this.k.a.p(), true);
    }

    @Override
    public void t(final long j) {
        w0(5, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.v0().seekTo(j);
            }
        }, this.k.a.p(), true);
    }

    public boolean u0() {
        return this.m != null;
    }

    @Override
    public void v(final float f2) {
        if (f2 <= 0.0f) {
            return;
        }
        w0(13, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.v0().a(f2);
            }
        }, this.k.a.p(), true);
    }

    @Override
    public void w(@Nullable s3.r rVar) {
        x(rVar, null);
    }

    public final void w0(final int i, final h hVar, @Nullable final o.e eVar, final boolean z) {
        if (this.g.J0()) {
            return;
        }
        if (eVar != null) {
            a2.u0.O1(this.g.j0(), new Runnable() {
                @Override
                public final void run() {
                    C1008b6.g0(C1008b6.this, i, eVar, hVar, z);
                }
            });
            return;
        }
        a2.D.b(r, "RemoteUserInfo is null, ignoring command=" + i);
    }

    @Override
    public void x(@Nullable s3.r rVar, @Nullable Bundle bundle) {
        final X1.h0 X = C1207y.X(rVar);
        if (X != null) {
            x0(f8.e, new h() {
                @Override
                public final void a(C1078j4.h hVar) {
                    C1008b6.V(C1008b6.this, X, hVar);
                }
            });
            return;
        }
        a2.D.n(r, "Ignoring invalid RatingCompat " + rVar);
    }

    public final void x0(int i, h hVar) {
        z0(null, i, hVar, this.k.a.p());
    }

    @Override
    public void y(final int i) {
        w0(15, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.v0().setRepeatMode(C1207y.Z(i));
            }
        }, this.k.a.p(), true);
    }

    public final void y0(f8 f8Var, h hVar) {
        z0(f8Var, 0, hVar, this.k.a.p());
    }

    @Override
    public void z(final int i) {
        w0(14, new h() {
            @Override
            public final void a(C1078j4.h hVar) {
                C1008b6.this.g.v0().setShuffleModeEnabled(C1207y.f0(i));
            }
        }, this.k.a.p(), true);
    }

    public final void z0(@Nullable final f8 f8Var, final int i, final h hVar, @Nullable final o.e eVar) {
        if (eVar != null) {
            a2.u0.O1(this.g.j0(), new Runnable() {
                @Override
                public final void run() {
                    C1008b6.b0(C1008b6.this, f8Var, i, eVar, hVar);
                }
            });
            return;
        }
        StringBuilder sb = new StringBuilder("RemoteUserInfo is null, ignoring command=");
        Object obj = f8Var;
        if (f8Var == null) {
            obj = Integer.valueOf(i);
        }
        sb.append(obj);
        a2.D.b(r, sb.toString());
    }

    public class a implements G8.f0<C1078j4.j> {
        public final C1078j4.h a;
        public final boolean b;

        public a(C1078j4.h hVar, boolean z) {
            this.a = hVar;
            this.b = z;
        }

        public static void a(a aVar, C1078j4.j jVar, boolean z, C1078j4.h hVar) {
            a8 v0 = C1008b6.this.g.v0();
            W7.k(v0, jVar);
            int playbackState = v0.getPlaybackState();
            if (playbackState == 1) {
                v0.b2();
            } else if (playbackState == 4) {
                v0.c2();
            }
            if (z) {
                v0.a2();
            }
            Y4 y42 = C1008b6.this.g;
            d0.c.a aVar2 = new d0.c.a();
            aVar2.a.c(new int[]{31, 2});
            aVar2.a.d(1, z);
            y42.V0(hVar, aVar2.f());
        }

        public void onSuccess(final C1078j4.j jVar) {
            Handler j0 = C1008b6.this.g.j0();
            Y4 y42 = C1008b6.this.g;
            final C1078j4.h hVar = this.a;
            final boolean z = this.b;
            a2.u0.O1(j0, y42.Y(hVar, new Runnable() {
                @Override
                public final void run() {
                    C1008b6.a.a(C1008b6.a.this, jVar, z, hVar);
                }
            }));
        }

        public void onFailure(Throwable th) {
        }
    }

    public class b implements G8.f0<List<X1.N>> {
        public final C1078j4.h a;
        public final int b;

        public b(C1078j4.h hVar, int i) {
            this.a = hVar;
            this.b = i;
        }

        public static void a(b bVar, int i, List list, C1078j4.h hVar) {
            if (i == -1) {
                C1008b6.this.g.v0().g0(list);
            } else {
                C1008b6.this.g.v0().Z(i, list);
            }
            Y4 y42 = C1008b6.this.g;
            d0.c.a aVar = new d0.c.a();
            aVar.a.a(20);
            y42.V0(hVar, aVar.f());
        }

        public void onSuccess(final List<X1.N> list) {
            Handler j0 = C1008b6.this.g.j0();
            Y4 y42 = C1008b6.this.g;
            final C1078j4.h hVar = this.a;
            final int i = this.b;
            a2.u0.O1(j0, y42.Y(hVar, new Runnable() {
                @Override
                public final void run() {
                    C1008b6.b.a(C1008b6.b.this, i, list, hVar);
                }
            }));
        }

        public void onFailure(Throwable th) {
        }
    }

    public final class f implements C1078j4.g {

        @Nullable
        public Uri c;
        public X1.U a = X1.U.X0;
        public String b = "";
        public long d = -9223372036854775807L;

        public class a implements G8.f0<Bitmap> {
            public final X1.U a;
            public final String b;
            public final Uri c;
            public final long d;

            public a(X1.U u, String str, Uri uri, long j) {
                this.a = u;
                this.b = str;
                this.c = uri;
                this.d = j;
            }

            public void onSuccess(Bitmap bitmap) {
                if (this != C1008b6.this.p) {
                    return;
                }
                C1008b6.this.k.v(C1207y.K(this.a, this.b, this.c, this.d, bitmap));
                C1008b6.this.g.S0();
            }

            public void onFailure(Throwable th) {
                if (this != C1008b6.this.p) {
                    return;
                }
                a2.D.n(C1008b6.r, C1008b6.A0(th));
            }
        }

        public f() {
        }

        public static void O(f fVar, AtomicInteger atomicInteger, List list, List list2) {
            fVar.getClass();
            if (atomicInteger.incrementAndGet() == list.size()) {
                fVar.Q(list2, list);
            }
        }

        @Override
        public void A(int i, f8 f8Var, Bundle bundle) {
            C1008b6.this.k.n(f8Var.b, bundle);
        }

        @Override
        public void C(int i, h8 h8Var) {
            a8 v0 = C1008b6.this.g.v0();
            v0.f2(false, C1207y.u(h8Var.a), h8Var.b, h8Var.c);
            C1008b6.this.k.w(v0.D1());
            v0.d1 = null;
            C1008b6.this.k.w(v0.D1());
        }

        @Override
        public void D(int i, X1.U u) {
            R();
        }

        @Override
        public void G(int i, @Nullable X1.N n, int i2) throws RemoteException {
            R();
            if (n == null) {
                C1008b6.this.k.B(0);
            } else {
                C1008b6.this.k.B(C1207y.o0(n.e.i));
            }
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void H(int i, int i2) throws RemoteException {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void J(int i, X1.c0 c0Var) throws RemoteException {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void K(int i, X1.F1 f1, int i2) throws RemoteException {
            S(f1);
            R();
        }

        @Override
        public void L(int i, int i2, @Nullable X1.b0 b0Var) throws RemoteException {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void M(int i, X1.p pVar) {
            a8 v0 = C1008b6.this.g.v0();
            C1008b6.this.n = v0.H1();
            C1008b6 c1008b6 = C1008b6.this;
            s3.s sVar = c1008b6.n;
            if (sVar != null) {
                c1008b6.k.y(sVar);
            } else {
                C1008b6.this.k.x(C1207y.n0(v0.I1()));
            }
        }

        public final void Q(List<G8.u0<Bitmap>> list, List<X1.N> list2) {
            Bitmap bitmap;
            ArrayList arrayList = new ArrayList();
            for (int i = 0; i < list.size(); i++) {
                G8.u0<Bitmap> u0Var = list.get(i);
                if (u0Var != null) {
                    try {
                        bitmap = (Bitmap) G8.i0.j(u0Var);
                    } catch (CancellationException | ExecutionException e) {
                        a2.D.c(C1008b6.r, "Failed to get bitmap", e);
                    }
                    arrayList.add(C1207y.V(list2.get(i), i, bitmap));
                }
                bitmap = null;
                arrayList.add(C1207y.V(list2.get(i), i, bitmap));
            }
            C1008b6.this.k.z(arrayList);
        }

        public final void R() {
            X1.U u;
            Uri uri;
            f fVar;
            Bitmap bitmap;
            N.h hVar;
            a8 v0 = C1008b6.this.g.v0();
            X1.N M1 = v0.M1();
            X1.U V1 = v0.V1();
            long R1 = v0.Y1() ? -9223372036854775807L : v0.R1();
            String str = M1 != null ? M1.a : "";
            Uri uri2 = (M1 == null || (hVar = M1.b) == null) ? null : hVar.a;
            if (Objects.equals(this.a, V1) && Objects.equals(this.b, str) && Objects.equals(this.c, uri2) && this.d == R1) {
                return;
            }
            this.b = str;
            this.c = uri2;
            this.a = V1;
            this.d = R1;
            G8.u0 b = C1008b6.this.g.k0().b(V1);
            if (b != null) {
                C1008b6.this.p = null;
                if (b.isDone()) {
                    try {
                        Uri uri3 = uri2;
                        u = V1;
                        uri = uri3;
                        fVar = this;
                        bitmap = (Bitmap) G8.i0.j(b);
                    } catch (CancellationException | ExecutionException e) {
                        a2.D.n(C1008b6.r, C1008b6.A0(e));
                    }
                    C1008b6.this.k.v(C1207y.K(u, str, uri, R1, bitmap));
                }
                C1008b6 c1008b6 = C1008b6.this;
                Uri uri4 = uri2;
                u = V1;
                a aVar = new a(u, str, uri4, R1);
                fVar = this;
                str = str;
                uri = uri4;
                R1 = R1;
                c1008b6.p = aVar;
                Handler j0 = c1008b6.g.j0();
                Objects.requireNonNull(j0);
                G8.i0.c(b, aVar, new androidx.emoji2.text.a(j0));
                bitmap = null;
                C1008b6.this.k.v(C1207y.K(u, str, uri, R1, bitmap));
            }
            Uri uri5 = uri2;
            u = V1;
            uri = uri5;
            fVar = this;
            bitmap = null;
            C1008b6.this.k.v(C1207y.K(u, str, uri, R1, bitmap));
        }

        public final void S(X1.F1 f1) {
            if (!C1008b6.this.K0() || f1.w()) {
                C1008b6.this.k.z(null);
                return;
            }
            final List<X1.N> F = C1207y.F(f1);
            final ArrayList arrayList = new ArrayList();
            int i = 0;
            final AtomicInteger atomicInteger = new AtomicInteger(0);
            Runnable runnable = new Runnable() {
                @Override
                public final void run() {
                    C1008b6.f.O(C1008b6.f.this, atomicInteger, F, arrayList);
                }
            };
            while (true) {
                ArrayList arrayList2 = (ArrayList) F;
                if (i >= arrayList2.size()) {
                    return;
                }
                X1.U u = ((X1.N) arrayList2.get(i)).e;
                if (u.k == null) {
                    arrayList.add(null);
                    runnable.run();
                } else {
                    G8.u0 d = C1008b6.this.g.k0().d(u.k);
                    arrayList.add(d);
                    Handler j0 = C1008b6.this.g.j0();
                    Objects.requireNonNull(j0);
                    d.addListener(runnable, new androidx.emoji2.text.a(j0));
                }
                i++;
            }
        }

        @Override
        public void c(int i, X1.d dVar) {
            if (C1008b6.this.g.v0().getDeviceInfo().a == 0) {
                C1008b6.this.k.x(C1207y.n0(dVar));
            }
        }

        @Override
        public void d(int i, d0.c cVar) {
            a8 v0 = C1008b6.this.g.v0();
            C1008b6.this.L0(v0);
            C1008b6.this.W0(v0);
        }

        @Override
        public void f(int i, List<C1010c> list) {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void i(int i, int i2) throws RemoteException {
            C1008b6.this.k.D(C1207y.R(i2));
        }

        @Override
        public void j(int i, @Nullable X1.b0 b0Var) {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void k(int i, List<C1010c> list) {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void m(int i, boolean z, int i2) throws RemoteException {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void n(int i, int i2, boolean z) {
            if (C1008b6.this.n != null) {
                s3.s sVar = C1008b6.this.n;
                if (z) {
                    i2 = 0;
                }
                sVar.i(i2);
            }
        }

        @Override
        public void o(int i, @Nullable a8 a8Var, a8 a8Var2) throws RemoteException {
            X1.F1 N1 = a8Var2.N1();
            if (a8Var == null || !Objects.equals(a8Var.N1(), N1)) {
                K(i, N1, 0);
            }
            X1.U W1 = a8Var2.W1();
            if (a8Var == null || !Objects.equals(a8Var.W1(), W1)) {
                p(i, W1);
            }
            X1.U V1 = a8Var2.V1();
            if (a8Var == null || !Objects.equals(a8Var.V1(), V1)) {
                R();
            }
            if (a8Var == null || a8Var.getShuffleModeEnabled() != a8Var2.getShuffleModeEnabled()) {
                u(i, a8Var2.getShuffleModeEnabled());
            }
            if (a8Var == null || a8Var.getRepeatMode() != a8Var2.getRepeatMode()) {
                i(i, a8Var2.getRepeatMode());
            }
            M(i, a8Var2.getDeviceInfo());
            if (C1008b6.I0(a8Var, a8Var2)) {
                C1008b6.this.k.s(a8Var2.e1);
            }
            C1008b6.this.L0(a8Var2);
            X1.N M1 = a8Var2.M1();
            if (a8Var == null || !Objects.equals(a8Var.M1(), M1)) {
                G(i, M1, 3);
            } else {
                C1008b6.this.W0(a8Var2);
            }
        }

        @Override
        public void p(int i, X1.U u) throws RemoteException {
            CharSequence j = C1008b6.this.k.e().a.j();
            CharSequence charSequence = u.a;
            if (TextUtils.equals(j, charSequence)) {
                return;
            }
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.T0(c1008b6.k, charSequence);
        }

        @Override
        public void q(int i, Bundle bundle) {
            a8 v0 = C1008b6.this.g.v0();
            v0.g2(bundle);
            C1008b6.this.k.s(v0.e1);
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.k.w(c1008b6.g.v0().D1());
        }

        @Override
        public void u(int i, boolean z) throws RemoteException {
            s3.n nVar = C1008b6.this.k;
            C1207y.S(z);
            nVar.F(z ? 1 : 0);
        }

        @Override
        public void w(int i, boolean z) throws RemoteException {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void x(int i, d0.k kVar, d0.k kVar2, int i2) throws RemoteException {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void y(int i, i8 i8Var, boolean z, boolean z2, int i2) throws RemoteException {
            C1008b6 c1008b6 = C1008b6.this;
            c1008b6.W0(c1008b6.g.v0());
        }

        @Override
        public void z(int i, @Nullable PendingIntent pendingIntent) {
            C1008b6.this.k.E(pendingIntent);
        }

        @Override
        public void b(int i) throws RemoteException {
        }
    }

    public static <T> void J0(Future<T> future) {
    }

    @Override
    public void u(boolean z) {
    }
}