导航菜单

页面标题

页面副标题

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

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

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


package r3;

import G8.C1542i0;
import G8.InterfaceC1536f0;
import G8.InterfaceFutureC1565u0;
import X1.AbstractC2065h0;
import X1.C2047b0;
import X1.C2050c0;
import X1.C2052d;
import X1.C2096p;
import X1.F1;
import X1.InterfaceC2053d0;
import X1.N;
import a2.C2248D;
import a2.C2255a;
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.C6658b6;
import r3.C6728j4;
import s3.n;
import s3.o;

public class C6658b6 extends n.b {

    public static final String f93144r = "MediaSessionLegacyStub";

    public static final int f93145s;

    public static final String f93146t = "androidx.media3.session.id";

    public static final String f93147u = ".";

    public static final int f93148v = 300000;

    public final C6705h<o.e> f93149f;

    public final Y4 f93150g;

    public final s3.o f93151h;

    public final f f93152i;

    public final d f93153j;

    public final s3.n f93154k;

    @Nullable
    public final g f93155l;

    @Nullable
    public final ComponentName f93156m;

    @Nullable
    public s3.s f93157n;

    public volatile long f93158o;

    @Nullable
    public InterfaceC1536f0<Bitmap> f93159p;

    public int f93160q;

    @l.U(31)
    public static final class c {
        public static void a(s3.n nVar, ComponentName componentName) {
            try {
                Object g10 = nVar.g();
                g10.getClass();
                ((MediaSession) g10).setMediaButtonBroadcastReceiver(componentName);
            } catch (IllegalArgumentException e10) {
                if (!Build.MANUFACTURER.equals("motorola")) {
                    throw e10;
                }
                C2248D.e(C6658b6.f93144r, "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.", e10);
            }
        }
    }

    public static class d extends Handler {

        public static final int f93167b = 1001;

        public final C6705h<o.e> f93168a;

        public d(Looper looper, C6705h<o.e> c6705h) {
            super(looper);
            this.f93168a = c6705h;
        }

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

        @Override
        public void handleMessage(Message message) {
            C6728j4.h hVar = (C6728j4.h) message.obj;
            if (this.f93168a.n(hVar)) {
                try {
                    C6728j4.g gVar = hVar.f93912e;
                    C2255a.k(gVar);
                    gVar.b(0);
                } catch (RemoteException unused) {
                }
                this.f93168a.s(hVar);
            }
        }
    }

    public static final class e implements C6728j4.g {

        public final o.e f93169a;

        public e(o.e eVar) {
            this.f93169a = 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.f93169a, ((e) obj).f93169a);
        }

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

    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) {
                C6658b6.this.f93154k.e().d(keyEvent);
            }
        }

        public g(C6658b6 c6658b6, a aVar) {
            this();
        }
    }

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

    static {
        f93145s = a2.u0.f25517a >= 31 ? 33554432 : 0;
    }

    public C6658b6(Y4 y42, Uri uri, Handler handler, Bundle bundle) {
        ComponentName D02;
        boolean z10;
        PendingIntent foregroundService;
        this.f93150g = y42;
        Context n02 = y42.n0();
        this.f93151h = s3.o.b(n02);
        this.f93152i = new f();
        C6705h<o.e> c6705h = new C6705h<>(y42);
        this.f93149f = c6705h;
        this.f93158o = 300000L;
        this.f93153j = new d(y42.j0().getLooper(), c6705h);
        ComponentName M02 = M0(n02);
        this.f93156m = M02;
        if (M02 == null || a2.u0.f25517a < 31) {
            D02 = D0(n02, AbstractServiceC6834v3.f94300l);
            D02 = D02 == null ? D0(n02, AbstractServiceC6730j6.f93919i) : D02;
            z10 = (D02 == null || D02.equals(M02)) ? false : true;
        } else {
            z10 = false;
            D02 = M02;
        }
        Intent intent = new Intent("android.intent.action.MEDIA_BUTTON", uri);
        if (D02 == null) {
            g gVar = new g();
            this.f93155l = gVar;
            IntentFilter intentFilter = new IntentFilter("android.intent.action.MEDIA_BUTTON");
            intentFilter.addDataScheme(uri.getScheme());
            a2.u0.S1(n02, gVar, intentFilter);
            intent.setPackage(n02.getPackageName());
            foregroundService = PendingIntent.getBroadcast(n02, 0, intent, f93145s);
            D02 = new ComponentName(n02, n02.getClass());
        } else {
            intent.setComponent(D02);
            foregroundService = z10 ? a2.u0.f25517a >= 26 ? PendingIntent.getForegroundService(n02, 0, intent, f93145s) : PendingIntent.getService(n02, 0, intent, f93145s) : PendingIntent.getBroadcast(n02, 0, intent, f93145s);
            this.f93155l = null;
        }
        String join = TextUtils.join(".", new String[]{f93146t, y42.q0()});
        ComponentName componentName = D02;
        int i10 = a2.u0.f25517a;
        s3.n nVar = new s3.n(n02, join, i10 >= 31 ? null : componentName, i10 < 31 ? foregroundService : null, bundle, null);
        this.f93154k = nVar;
        if (i10 >= 31 && M02 != null) {
            c.a(nVar, M02);
        }
        PendingIntent w02 = y42.w0();
        if (w02 != null) {
            nVar.E(w02);
        }
        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(C6658b6 c6658b6, a8 a8Var) {
        c6658b6.f93154k.w(a8Var.D1());
        c6658b6.f93152i.S(a8Var.N().c(17) ? a8Var.getCurrentTimeline() : X1.F1.f20894a);
    }

    public static void H(h hVar, C6728j4.h hVar2) {
        try {
            hVar.a(hVar2);
        } catch (RemoteException e10) {
            C2248D.o(f93144r, "Exception in " + hVar2, e10);
        }
    }

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

    public static void J(C6658b6 c6658b6, s3.l lVar, C6728j4.h hVar) {
        c6658b6.getClass();
        String str = lVar.f95139a;
        if (TextUtils.isEmpty(str)) {
            C2248D.n(f93144r, "onRemoveQueueItem(): Media ID shouldn't be null");
            return;
        }
        a8 v02 = c6658b6.f93150g.v0();
        if (!v02.S0(17)) {
            C2248D.n(f93144r, "Can't remove item by ID without COMMAND_GET_TIMELINE being available");
            return;
        }
        X1.F1 currentTimeline = v02.getCurrentTimeline();
        F1.d dVar = new F1.d();
        for (int i10 = 0; i10 < currentTimeline.v(); i10++) {
            if (TextUtils.equals(currentTimeline.u(i10, dVar, 0L).f20932c.f21115a, str)) {
                v02.u(i10);
                return;
            }
        }
    }

    public static void M(C6658b6 c6658b6, f8 f8Var, Bundle bundle, C6728j4.h hVar) {
        Y4 y42 = c6658b6.f93150g;
        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 InterfaceFutureC1565u0<j8> interfaceFutureC1565u0) {
        interfaceFutureC1565u0.addListener(new Runnable() {
            @Override
            public final void run() {
                C6658b6.f0(InterfaceFutureC1565u0.this, resultReceiver);
            }
        }, G8.M.INSTANCE);
    }

    public static void P(C6658b6 c6658b6, f8 f8Var, Bundle bundle, ResultReceiver resultReceiver, C6728j4.h hVar) {
        Y4 y42 = c6658b6.f93150g;
        if (bundle == null) {
            bundle = Bundle.EMPTY;
        }
        InterfaceFutureC1565u0<j8> O02 = y42.O0(hVar, f8Var, bundle);
        if (resultReceiver != null) {
            O0(resultReceiver, O02);
        }
    }

    public static void Q(C6658b6 c6658b6, s3.l lVar, int i10, C6728j4.h hVar) {
        c6658b6.getClass();
        if (TextUtils.isEmpty(lVar.f95139a)) {
            C2248D.n(f93144r, "onAddQueueItem(): Media ID shouldn't be empty");
        } else {
            C1542i0.c(c6658b6.f93150g.M0(hVar, v8.M2.y(C6857y.B(lVar))), c6658b6.new b(hVar, i10), G8.M.INSTANCE);
        }
    }

    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(C6658b6 c6658b6, AbstractC2065h0 abstractC2065h0, C6728j4.h hVar) {
        X1.N M12 = c6658b6.f93150g.v0().M1();
        if (M12 == null) {
            return;
        }
        c6658b6.f93150g.Z0(hVar, M12.f21115a, abstractC2065h0);
    }

    public static void b0(C6658b6 c6658b6, f8 f8Var, int i10, o.e eVar, h hVar) {
        if (c6658b6.f93150g.J0()) {
            return;
        }
        if (!c6658b6.f93154k.k()) {
            StringBuilder sb2 = new StringBuilder("Ignore incoming session command before initialization. command=");
            sb2.append(f8Var == null ? Integer.valueOf(i10) : f8Var.f93721b);
            sb2.append(", pid=");
            sb2.append(eVar.f95379a.b());
            C2248D.n(f93144r, sb2.toString());
            return;
        }
        C6728j4.h V02 = c6658b6.V0(eVar);
        if (V02 == null) {
            return;
        }
        if (f8Var != null) {
            if (!c6658b6.f93149f.q(V02, f8Var)) {
                return;
            }
        } else if (!c6658b6.f93149f.p(V02, i10)) {
            return;
        }
        try {
            hVar.a(V02);
        } catch (RemoteException e10) {
            C2248D.o(f93144r, "Exception in " + V02, e10);
        }
    }

    public static void c0(C6658b6 c6658b6, X1.N n10, boolean z10, C6728j4.h hVar) {
        C1542i0.c(c6658b6.f93150g.X0(hVar, v8.M2.y(n10), -1, -9223372036854775807L), c6658b6.new a(hVar, z10), G8.M.INSTANCE);
    }

    public static void f0(InterfaceFutureC1565u0 interfaceFutureC1565u0, ResultReceiver resultReceiver) {
        j8 j8Var;
        try {
            j8Var = (j8) interfaceFutureC1565u0.get();
            C2255a.h(j8Var, "SessionResult must not be null");
        } catch (InterruptedException e10) {
            e = e10;
            C2248D.o(f93144r, "Custom command failed", e);
            j8Var = new j8(-1);
        } catch (CancellationException e11) {
            C2248D.o(f93144r, "Custom command cancelled", e11);
            j8Var = new j8(1);
        } catch (ExecutionException e12) {
            e = e12;
            C2248D.o(f93144r, "Custom command failed", e);
            j8Var = new j8(-1);
        }
        resultReceiver.send(j8Var.f93962a, j8Var.f93963b);
    }

    public static void g0(C6658b6 c6658b6, int i10, o.e eVar, final h hVar, boolean z10) {
        if (c6658b6.f93150g.J0()) {
            return;
        }
        if (!c6658b6.f93154k.k()) {
            StringBuilder a10 = android.support.v4.media.a.a("Ignore incoming player command before initialization. command=", i10, ", pid=");
            a10.append(eVar.f95379a.b());
            C2248D.n(f93144r, a10.toString());
            return;
        }
        final C6728j4.h V02 = c6658b6.V0(eVar);
        if (V02 == null) {
            return;
        }
        if (!c6658b6.f93149f.o(V02, i10)) {
            if (i10 != 1 || c6658b6.f93150g.v0().getPlayWhenReady()) {
                return;
            }
            C2248D.n(f93144r, "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 (c6658b6.f93150g.U0(V02, i10) != 0) {
            return;
        }
        ((H4) c6658b6.f93150g.Y(V02, new Runnable() {
            @Override
            public final void run() {
                C6658b6.H(C6658b6.h.this, V02);
            }
        })).run();
        if (z10) {
            Y4 y42 = c6658b6.f93150g;
            InterfaceC2053d0.c.a aVar = new InterfaceC2053d0.c.a();
            aVar.f21870a.a(i10);
            y42.V0(V02, 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.f21128a = str;
        N.i.a aVar = new N.i.a();
        aVar.f21231a = uri;
        aVar.f21232b = str2;
        aVar.f21233c = bundle;
        cVar.f21141n = new N.i(aVar);
        return cVar.a();
    }

    @Override
    public void A() {
        if (this.f93150g.v0().S0(9)) {
            w0(9, new h() {
                @Override
                public final void a(C6728j4.h hVar) {
                    C6658b6.this.f93150g.v0().K();
                }
            }, this.f93154k.f95241a.p(), true);
        } else {
            w0(8, new h() {
                @Override
                public final void a(C6728j4.h hVar) {
                    C6658b6.this.f93150g.v0().A();
                }
            }, this.f93154k.f95241a.p(), true);
        }
    }

    @Override
    public void B() {
        if (this.f93150g.v0().S0(7)) {
            w0(7, new h() {
                @Override
                public final void a(C6728j4.h hVar) {
                    C6658b6.this.f93150g.v0().w();
                }
            }, this.f93154k.f95241a.p(), true);
        } else {
            w0(6, new h() {
                @Override
                public final void a(C6728j4.h hVar) {
                    C6658b6.this.f93150g.v0().p();
                }
            }, this.f93154k.f95241a.p(), true);
        }
    }

    public C6705h<o.e> B0() {
        return this.f93149f;
    }

    @Override
    public void C(final long j10) {
        if (j10 < 0) {
            return;
        }
        w0(10, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.this.f93150g.v0().seekToDefaultPosition((int) j10);
            }
        }, this.f93154k.f95241a.p(), true);
    }

    public C6728j4.g C0() {
        return this.f93152i;
    }

    @Override
    public void D() {
        w0(3, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.this.f93150g.v0().stop();
            }
        }, this.f93154k.f95241a.p(), true);
    }

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

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

    public final void G0(final X1.N n10, final boolean z10) {
        w0(31, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.c0(C6658b6.this, n10, z10, hVar);
            }
        }, this.f93154k.f95241a.p(), false);
    }

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

    public final boolean K0() {
        a8 v02 = this.f93150g.v0();
        return v02.f93111i1.c(17) && v02.N().c(17);
    }

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

    public void N0() {
        if (a2.u0.f25517a < 31) {
            if (this.f93156m == null) {
                this.f93154k.u(null);
            } else {
                Intent intent = new Intent("android.intent.action.MEDIA_BUTTON", this.f93150g.B0());
                intent.setComponent(this.f93156m);
                this.f93154k.u(PendingIntent.getBroadcast(this.f93150g.n0(), 0, intent, f93145s));
            }
        }
        if (this.f93155l != null) {
            this.f93150g.n0().unregisterReceiver(this.f93155l);
        }
        this.f93154k.l();
    }

    public void P0(long j10) {
        this.f93158o = j10;
    }

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

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

    @Nullable
    public final C6728j4.h V0(o.e eVar) {
        C6728j4.h k10 = this.f93149f.k(eVar);
        if (k10 == null) {
            C6728j4.h hVar = new C6728j4.h(eVar, 0, 0, this.f93151h.c(eVar), new e(eVar), Bundle.EMPTY, 0);
            C6728j4.f N02 = this.f93150g.N0(hVar);
            if (!N02.f93892a) {
                return null;
            }
            this.f93149f.e(eVar, hVar, N02.f93893b, N02.f93894c);
            k10 = hVar;
        }
        this.f93153j.a(k10, this.f93158o);
        return k10;
    }

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

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

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

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

    @Override
    public void d(String str, @Nullable final Bundle bundle, @Nullable final ResultReceiver resultReceiver) {
        C2255a.k(str);
        if (str.equals(O.f92624I)) {
            return;
        }
        if (str.equals(O.f92623H) && resultReceiver != null) {
            resultReceiver.send(0, this.f93150g.A0().z());
        } else {
            final f8 f8Var = new f8(str, Bundle.EMPTY);
            y0(f8Var, new h() {
                @Override
                public final void a(C6728j4.h hVar) {
                    C6658b6.P(C6658b6.this, f8Var, bundle, resultReceiver, hVar);
                }
            });
        }
    }

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

    @Override
    public void f() {
        w0(12, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.this.f93150g.v0().m0();
            }
        }, this.f93154k.f95241a.p(), true);
    }

    @Override
    public boolean g(Intent intent) {
        Y4 y42 = this.f93150g;
        o.e p10 = this.f93154k.f95241a.p();
        p10.getClass();
        return y42.R0(new C6728j4.h(p10, 0, 0, false, null, Bundle.EMPTY, 0), intent);
    }

    @Override
    public void h() {
        w0(1, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                a2.u0.S0(C6658b6.this.f93150g.v0());
            }
        }, this.f93154k.f95241a.p(), true);
    }

    @Override
    public void i() {
        w0(1, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.this.f93150g.D0(hVar, true);
            }
        }, this.f93154k.f95241a.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(C6728j4.h hVar) {
                C6658b6.this.f93150g.v0().d();
            }
        }, this.f93154k.f95241a.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(C6728j4.h hVar) {
                C6658b6.J(C6658b6.this, lVar, hVar);
            }
        }, this.f93154k.f95241a.p(), true);
    }

    @Override
    public void s() {
        w0(11, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.this.f93150g.v0().n0();
            }
        }, this.f93154k.f95241a.p(), true);
    }

    @Override
    public void t(final long j10) {
        w0(5, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.this.f93150g.v0().seekTo(j10);
            }
        }, this.f93154k.f95241a.p(), true);
    }

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

    @Override
    public void v(final float f10) {
        if (f10 <= 0.0f) {
            return;
        }
        w0(13, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.this.f93150g.v0().a(f10);
            }
        }, this.f93154k.f95241a.p(), true);
    }

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

    public final void w0(final int i10, final h hVar, @Nullable final o.e eVar, final boolean z10) {
        if (this.f93150g.J0()) {
            return;
        }
        if (eVar != null) {
            a2.u0.O1(this.f93150g.j0(), new Runnable() {
                @Override
                public final void run() {
                    C6658b6.g0(C6658b6.this, i10, eVar, hVar, z10);
                }
            });
            return;
        }
        C2248D.b(f93144r, "RemoteUserInfo is null, ignoring command=" + i10);
    }

    @Override
    public void x(@Nullable s3.r rVar, @Nullable Bundle bundle) {
        final AbstractC2065h0 X10 = C6857y.X(rVar);
        if (X10 != null) {
            x0(f8.f93707e, new h() {
                @Override
                public final void a(C6728j4.h hVar) {
                    C6658b6.V(C6658b6.this, X10, hVar);
                }
            });
            return;
        }
        C2248D.n(f93144r, "Ignoring invalid RatingCompat " + rVar);
    }

    public final void x0(int i10, h hVar) {
        z0(null, i10, hVar, this.f93154k.f95241a.p());
    }

    @Override
    public void y(final int i10) {
        w0(15, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.this.f93150g.v0().setRepeatMode(C6857y.Z(i10));
            }
        }, this.f93154k.f95241a.p(), true);
    }

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

    @Override
    public void z(final int i10) {
        w0(14, new h() {
            @Override
            public final void a(C6728j4.h hVar) {
                C6658b6.this.f93150g.v0().setShuffleModeEnabled(C6857y.f0(i10));
            }
        }, this.f93154k.f95241a.p(), true);
    }

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

    public class a implements InterfaceC1536f0<C6728j4.j> {

        public final C6728j4.h f93161a;

        public final boolean f93162b;

        public a(C6728j4.h hVar, boolean z10) {
            this.f93161a = hVar;
            this.f93162b = z10;
        }

        public static void a(a aVar, C6728j4.j jVar, boolean z10, C6728j4.h hVar) {
            a8 v02 = C6658b6.this.f93150g.v0();
            W7.k(v02, jVar);
            int playbackState = v02.getPlaybackState();
            if (playbackState == 1) {
                v02.b2();
            } else if (playbackState == 4) {
                v02.c2();
            }
            if (z10) {
                v02.a2();
            }
            Y4 y42 = C6658b6.this.f93150g;
            InterfaceC2053d0.c.a aVar2 = new InterfaceC2053d0.c.a();
            aVar2.f21870a.c(31, 2);
            aVar2.f21870a.d(1, z10);
            y42.V0(hVar, aVar2.f());
        }

        @Override
        public void onSuccess(final C6728j4.j jVar) {
            Handler j02 = C6658b6.this.f93150g.j0();
            Y4 y42 = C6658b6.this.f93150g;
            final C6728j4.h hVar = this.f93161a;
            final boolean z10 = this.f93162b;
            a2.u0.O1(j02, y42.Y(hVar, new Runnable() {
                @Override
                public final void run() {
                    C6658b6.a.a(C6658b6.a.this, jVar, z10, hVar);
                }
            }));
        }

        @Override
        public void onFailure(Throwable th) {
        }
    }

    public class b implements InterfaceC1536f0<List<X1.N>> {

        public final C6728j4.h f93164a;

        public final int f93165b;

        public b(C6728j4.h hVar, int i10) {
            this.f93164a = hVar;
            this.f93165b = i10;
        }

        public static void a(b bVar, int i10, List list, C6728j4.h hVar) {
            if (i10 == -1) {
                C6658b6.this.f93150g.v0().g0(list);
            } else {
                C6658b6.this.f93150g.v0().Z(i10, list);
            }
            Y4 y42 = C6658b6.this.f93150g;
            InterfaceC2053d0.c.a aVar = new InterfaceC2053d0.c.a();
            aVar.f21870a.a(20);
            y42.V0(hVar, aVar.f());
        }

        @Override
        public void onSuccess(final List<X1.N> list) {
            Handler j02 = C6658b6.this.f93150g.j0();
            Y4 y42 = C6658b6.this.f93150g;
            final C6728j4.h hVar = this.f93164a;
            final int i10 = this.f93165b;
            a2.u0.O1(j02, y42.Y(hVar, new Runnable() {
                @Override
                public final void run() {
                    C6658b6.b.a(C6658b6.b.this, i10, list, hVar);
                }
            }));
        }

        @Override
        public void onFailure(Throwable th) {
        }
    }

    public final class f implements C6728j4.g {

        @Nullable
        public Uri f93172c;

        public X1.U f93170a = X1.U.f21353X0;

        public String f93171b = "";

        public long f93173d = -9223372036854775807L;

        public class a implements InterfaceC1536f0<Bitmap> {

            public final X1.U f93175a;

            public final String f93176b;

            public final Uri f93177c;

            public final long f93178d;

            public a(X1.U u10, String str, Uri uri, long j10) {
                this.f93175a = u10;
                this.f93176b = str;
                this.f93177c = uri;
                this.f93178d = j10;
            }

            @Override
            public void onSuccess(Bitmap bitmap) {
                if (this != C6658b6.this.f93159p) {
                    return;
                }
                C6658b6.this.f93154k.v(C6857y.K(this.f93175a, this.f93176b, this.f93177c, this.f93178d, bitmap));
                C6658b6.this.f93150g.S0();
            }

            @Override
            public void onFailure(Throwable th) {
                if (this != C6658b6.this.f93159p) {
                    return;
                }
                C2248D.n(C6658b6.f93144r, C6658b6.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 i10, f8 f8Var, Bundle bundle) {
            C6658b6.this.f93154k.n(f8Var.f93721b, bundle);
        }

        @Override
        public void C(int i10, h8 h8Var) {
            a8 v02 = C6658b6.this.f93150g.v0();
            v02.f2(false, C6857y.u(h8Var.f93795a), h8Var.f93796b, h8Var.f93797c);
            C6658b6.this.f93154k.w(v02.D1());
            v02.f93106d1 = null;
            C6658b6.this.f93154k.w(v02.D1());
        }

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

        @Override
        public void G(int i10, @Nullable X1.N n10, int i11) throws RemoteException {
            R();
            if (n10 == null) {
                C6658b6.this.f93154k.B(0);
            } else {
                C6658b6.this.f93154k.B(C6857y.o0(n10.f21119e.f21428i));
            }
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void H(int i10, int i11) throws RemoteException {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void J(int i10, C2050c0 c2050c0) throws RemoteException {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void K(int i10, X1.F1 f12, int i11) throws RemoteException {
            S(f12);
            R();
        }

        @Override
        public void L(int i10, int i11, @Nullable C2047b0 c2047b0) throws RemoteException {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void M(int i10, C2096p c2096p) {
            a8 v02 = C6658b6.this.f93150g.v0();
            C6658b6.this.f93157n = v02.H1();
            C6658b6 c6658b6 = C6658b6.this;
            s3.s sVar = c6658b6.f93157n;
            if (sVar != null) {
                c6658b6.f93154k.y(sVar);
            } else {
                C6658b6.this.f93154k.x(C6857y.n0(v02.I1()));
            }
        }

        public final void Q(List<InterfaceFutureC1565u0<Bitmap>> list, List<X1.N> list2) {
            Bitmap bitmap;
            ArrayList arrayList = new ArrayList();
            for (int i10 = 0; i10 < list.size(); i10++) {
                InterfaceFutureC1565u0<Bitmap> interfaceFutureC1565u0 = list.get(i10);
                if (interfaceFutureC1565u0 != null) {
                    try {
                        bitmap = (Bitmap) C1542i0.j(interfaceFutureC1565u0);
                    } catch (CancellationException | ExecutionException e10) {
                        C2248D.c(C6658b6.f93144r, "Failed to get bitmap", e10);
                    }
                    arrayList.add(C6857y.V(list2.get(i10), i10, bitmap));
                }
                bitmap = null;
                arrayList.add(C6857y.V(list2.get(i10), i10, bitmap));
            }
            C6658b6.this.f93154k.z(arrayList);
        }

        public final void R() {
            X1.U u10;
            Uri uri;
            f fVar;
            Bitmap bitmap;
            N.h hVar;
            a8 v02 = C6658b6.this.f93150g.v0();
            X1.N M12 = v02.M1();
            X1.U V12 = v02.V1();
            long R12 = v02.Y1() ? -9223372036854775807L : v02.R1();
            String str = M12 != null ? M12.f21115a : "";
            Uri uri2 = (M12 == null || (hVar = M12.f21116b) == null) ? null : hVar.f21214a;
            if (Objects.equals(this.f93170a, V12) && Objects.equals(this.f93171b, str) && Objects.equals(this.f93172c, uri2) && this.f93173d == R12) {
                return;
            }
            this.f93171b = str;
            this.f93172c = uri2;
            this.f93170a = V12;
            this.f93173d = R12;
            InterfaceFutureC1565u0<Bitmap> b10 = C6658b6.this.f93150g.k0().b(V12);
            if (b10 != null) {
                C6658b6.this.f93159p = null;
                if (b10.isDone()) {
                    try {
                        Uri uri3 = uri2;
                        u10 = V12;
                        uri = uri3;
                        fVar = this;
                        bitmap = (Bitmap) C1542i0.j(b10);
                    } catch (CancellationException | ExecutionException e10) {
                        C2248D.n(C6658b6.f93144r, C6658b6.A0(e10));
                    }
                    C6658b6.this.f93154k.v(C6857y.K(u10, str, uri, R12, bitmap));
                }
                C6658b6 c6658b6 = C6658b6.this;
                Uri uri4 = uri2;
                u10 = V12;
                a aVar = new a(u10, str, uri4, R12);
                fVar = this;
                str = str;
                uri = uri4;
                R12 = R12;
                c6658b6.f93159p = aVar;
                Handler j02 = c6658b6.f93150g.j0();
                Objects.requireNonNull(j02);
                C1542i0.c(b10, aVar, new androidx.emoji2.text.a(j02));
                bitmap = null;
                C6658b6.this.f93154k.v(C6857y.K(u10, str, uri, R12, bitmap));
            }
            Uri uri5 = uri2;
            u10 = V12;
            uri = uri5;
            fVar = this;
            bitmap = null;
            C6658b6.this.f93154k.v(C6857y.K(u10, str, uri, R12, bitmap));
        }

        public final void S(X1.F1 f12) {
            if (!C6658b6.this.K0() || f12.w()) {
                C6658b6.this.f93154k.z(null);
                return;
            }
            final List<X1.N> F10 = C6857y.F(f12);
            final ArrayList arrayList = new ArrayList();
            int i10 = 0;
            final AtomicInteger atomicInteger = new AtomicInteger(0);
            Runnable runnable = new Runnable() {
                @Override
                public final void run() {
                    C6658b6.f.O(C6658b6.f.this, atomicInteger, F10, arrayList);
                }
            };
            while (true) {
                ArrayList arrayList2 = (ArrayList) F10;
                if (i10 >= arrayList2.size()) {
                    return;
                }
                X1.U u10 = ((X1.N) arrayList2.get(i10)).f21119e;
                if (u10.f21430k == null) {
                    arrayList.add(null);
                    runnable.run();
                } else {
                    InterfaceFutureC1565u0<Bitmap> d10 = C6658b6.this.f93150g.k0().d(u10.f21430k);
                    arrayList.add(d10);
                    Handler j02 = C6658b6.this.f93150g.j0();
                    Objects.requireNonNull(j02);
                    d10.addListener(runnable, new androidx.emoji2.text.a(j02));
                }
                i10++;
            }
        }

        @Override
        public void c(int i10, C2052d c2052d) {
            if (C6658b6.this.f93150g.v0().getDeviceInfo().f22216a == 0) {
                C6658b6.this.f93154k.x(C6857y.n0(c2052d));
            }
        }

        @Override
        public void d(int i10, InterfaceC2053d0.c cVar) {
            a8 v02 = C6658b6.this.f93150g.v0();
            C6658b6.this.L0(v02);
            C6658b6.this.W0(v02);
        }

        @Override
        public void f(int i10, List<C6660c> list) {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void i(int i10, int i11) throws RemoteException {
            C6658b6.this.f93154k.D(C6857y.R(i11));
        }

        @Override
        public void j(int i10, @Nullable C2047b0 c2047b0) {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void k(int i10, List<C6660c> list) {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void m(int i10, boolean z10, int i11) throws RemoteException {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void n(int i10, int i11, boolean z10) {
            if (C6658b6.this.f93157n != null) {
                s3.s sVar = C6658b6.this.f93157n;
                if (z10) {
                    i11 = 0;
                }
                sVar.i(i11);
            }
        }

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

        @Override
        public void p(int i10, X1.U u10) throws RemoteException {
            CharSequence j10 = C6658b6.this.f93154k.e().f95082a.j();
            CharSequence charSequence = u10.f21420a;
            if (TextUtils.equals(j10, charSequence)) {
                return;
            }
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.T0(c6658b6.f93154k, charSequence);
        }

        @Override
        public void q(int i10, Bundle bundle) {
            a8 v02 = C6658b6.this.f93150g.v0();
            v02.g2(bundle);
            C6658b6.this.f93154k.s(v02.f93107e1);
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.f93154k.w(c6658b6.f93150g.v0().D1());
        }

        @Override
        public void u(int i10, boolean z10) throws RemoteException {
            s3.n nVar = C6658b6.this.f93154k;
            C6857y.S(z10);
            nVar.F(z10 ? 1 : 0);
        }

        @Override
        public void w(int i10, boolean z10) throws RemoteException {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void x(int i10, InterfaceC2053d0.k kVar, InterfaceC2053d0.k kVar2, int i11) throws RemoteException {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void y(int i10, i8 i8Var, boolean z10, boolean z11, int i11) throws RemoteException {
            C6658b6 c6658b6 = C6658b6.this;
            c6658b6.W0(c6658b6.f93150g.v0());
        }

        @Override
        public void z(int i10, @Nullable PendingIntent pendingIntent) {
            C6658b6.this.f93154k.E(pendingIntent);
        }

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

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

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