导航菜单

页面标题

页面副标题

Perplexity v2.48.1 - G0.java 源代码

正在查看: Perplexity v2.48.1 应用的 G0.java JAVA 源代码文件

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


package e9;

import B4.C0009j;
import Z7.C1208w;
import Z7.C1210y;
import ai.perplexity.app.android.ui.tts.TtsMediaSessionService;
import android.app.PendingIntent;
import android.content.ComponentName;
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.media.MediaMetadata;
import android.media.session.MediaSession;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseBooleanArray;
import c8.AbstractC1763a;
import c8.AbstractC1764b;
import f9.C2304H;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;

public final class G0 extends f9.L {

    public static final int f27288r;

    public final qf.m f27289f;

    public final C2123v0 f27290g;

    public final f9.b0 f27291h;

    public final A4.c f27292i;

    public final Lf.a0 f27293j;

    public final f9.U f27294k;

    public final J3.D f27295l;

    public final ComponentName f27296m;

    public m1 f27297n;

    public volatile long f27298o;

    public A4.c f27299p;

    public int f27300q;

    static {
        f27288r = c8.y.f25148a >= 31 ? 33554432 : 0;
    }

    public G0(C2123v0 c2123v0, Uri uri, Handler handler, Bundle bundle) {
        ComponentName componentName;
        ComponentName I10;
        PendingIntent foregroundService;
        this.f27290g = c2123v0;
        TtsMediaSessionService ttsMediaSessionService = c2123v0.f27780f;
        this.f27291h = f9.b0.a(ttsMediaSessionService);
        A4.c cVar = new A4.c();
        cVar.f127X = this;
        cVar.f129x = Z7.K.f18248K;
        cVar.f130y = "";
        cVar.f128w = -9223372036854775807L;
        this.f27292i = cVar;
        qf.m mVar = new qf.m(c2123v0);
        this.f27289f = mVar;
        this.f27298o = 300000L;
        this.f27293j = new Lf.a0(c2123v0.f27786l.getLooper(), mVar);
        PackageManager packageManager = ttsMediaSessionService.getPackageManager();
        Intent intent = new Intent("android.intent.action.MEDIA_BUTTON");
        intent.setPackage(ttsMediaSessionService.getPackageName());
        List<ResolveInfo> queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, 0);
        boolean z10 = true;
        if (queryBroadcastReceivers.size() == 1) {
            ActivityInfo activityInfo = queryBroadcastReceivers.get(0).activityInfo;
            componentName = new ComponentName(activityInfo.packageName, activityInfo.name);
        } else {
            if (!queryBroadcastReceivers.isEmpty()) {
                throw new IllegalStateException("Expected 1 broadcast receiver that handles android.intent.action.MEDIA_BUTTON, found " + queryBroadcastReceivers.size());
            }
            componentName = null;
        }
        this.f27296m = componentName;
        if (componentName == null || c8.y.f25148a < 31) {
            I10 = I(ttsMediaSessionService, "androidx.media3.session.MediaLibraryService");
            I10 = I10 == null ? I(ttsMediaSessionService, "androidx.media3.session.MediaSessionService") : I10;
            if (I10 == null || I10.equals(componentName)) {
                z10 = false;
            }
        } else {
            z10 = false;
            I10 = componentName;
        }
        Intent intent2 = new Intent("android.intent.action.MEDIA_BUTTON", uri);
        if (I10 == null) {
            J3.D d7 = new J3.D(this, 4);
            this.f27295l = d7;
            IntentFilter intentFilter = new IntentFilter("android.intent.action.MEDIA_BUTTON");
            intentFilter.addDataScheme(uri.getScheme());
            if (c8.y.f25148a < 33) {
                ttsMediaSessionService.registerReceiver(d7, intentFilter);
            } else {
                ttsMediaSessionService.registerReceiver(d7, intentFilter, 4);
            }
            intent2.setPackage(ttsMediaSessionService.getPackageName());
            foregroundService = PendingIntent.getBroadcast(ttsMediaSessionService, 0, intent2, f27288r);
            I10 = new ComponentName(ttsMediaSessionService, (Class<?>) TtsMediaSessionService.class);
        } else {
            intent2.setComponent(I10);
            foregroundService = z10 ? c8.y.f25148a >= 26 ? PendingIntent.getForegroundService(ttsMediaSessionService, 0, intent2, f27288r) : PendingIntent.getService(ttsMediaSessionService, 0, intent2, f27288r) : PendingIntent.getBroadcast(ttsMediaSessionService, 0, intent2, f27288r);
            this.f27295l = null;
        }
        String join = TextUtils.join(".", new String[]{"androidx.media3.session.id", c2123v0.f27783i});
        ComponentName componentName2 = I10;
        int i10 = c8.y.f25148a;
        f9.U u10 = new f9.U(ttsMediaSessionService, join, i10 >= 31 ? null : componentName2, i10 < 31 ? foregroundService : null, bundle);
        this.f27294k = u10;
        if (i10 >= 31 && componentName != null) {
            try {
                MediaSession mediaSession = ((f9.N) u10.f29046x).f29022a;
                mediaSession.getClass();
                mediaSession.setMediaButtonBroadcastReceiver(componentName);
            } catch (IllegalArgumentException e10) {
                if (!Build.MANUFACTURER.equals("motorola")) {
                    throw e10;
                }
                AbstractC1763a.i("MediaSessionLegacyStub", "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);
            }
        }
        PendingIntent pendingIntent = c2123v0.f27795u;
        if (pendingIntent != null) {
            ((f9.N) this.f27294k.f29046x).f29022a.setSessionActivity(pendingIntent);
        }
        ((f9.N) this.f27294k.f29046x).e(this, handler);
    }

    public static void C(f9.U u10, f9.I i10) {
        f9.N n5 = (f9.N) u10.f29046x;
        n5.f29030i = i10;
        MediaMetadata mediaMetadata = i10.f29013x;
        if (mediaMetadata == null) {
            Parcel obtain = Parcel.obtain();
            try {
                i10.writeToParcel(obtain, 0);
                obtain.setDataPosition(0);
                MediaMetadata mediaMetadata2 = (MediaMetadata) MediaMetadata.CREATOR.createFromParcel(obtain);
                i10.f29013x = mediaMetadata2;
                obtain.recycle();
                mediaMetadata = mediaMetadata2;
            } catch (Throwable th) {
                obtain.recycle();
                throw th;
            }
        }
        n5.f29022a.setMetadata(mediaMetadata);
    }

    public static void D(G0 g02, o1 o1Var) {
        g02.getClass();
        int i10 = o1Var.b0(20) ? 4 : 0;
        if (g02.f27300q != i10) {
            g02.f27300q = i10;
            ((f9.N) g02.f27294k.f29046x).f29022a.setFlags(i10 | 3);
        }
    }

    public static void E(f9.U u10, ArrayList arrayList) {
        if (arrayList != null) {
            u10.getClass();
            HashSet hashSet = new HashSet();
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                f9.Q q7 = (f9.Q) it.next();
                if (q7 == null) {
                    throw new IllegalArgumentException("queue shouldn't have null items");
                }
                long j10 = q7.f29036x;
                if (hashSet.contains(Long.valueOf(j10))) {
                    Log.e("MediaSessionCompat", nn.j.e(j10, "Found duplicate queue id: "), new IllegalArgumentException("id of each queue item should be unique"));
                }
                hashSet.add(Long.valueOf(j10));
            }
        }
        f9.N n5 = (f9.N) u10.f29046x;
        n5.f29029h = arrayList;
        MediaSession mediaSession = n5.f29022a;
        if (arrayList == null) {
            mediaSession.setQueue(null);
            return;
        }
        ArrayList arrayList2 = new ArrayList(arrayList.size());
        Iterator it2 = arrayList.iterator();
        while (it2.hasNext()) {
            f9.Q q10 = (f9.Q) it2.next();
            MediaSession.QueueItem queueItem = q10.f29037y;
            if (queueItem == null) {
                MediaSession.QueueItem queueItem2 = new MediaSession.QueueItem(q10.f29035w.e(), q10.f29036x);
                q10.f29037y = queueItem2;
                queueItem = queueItem2;
            }
            arrayList2.add(queueItem);
        }
        mediaSession.setQueue(arrayList2);
    }

    public static Z7.H F(String str, Uri uri, String str2, Bundle bundle) {
        C1208w c1208w = new C1208w();
        re.K k9 = re.N.x;
        re.m0 m0Var = re.m0.X;
        List list = Collections.EMPTY_LIST;
        re.m0 m0Var2 = re.m0.X;
        Z7.B b6 = new Z7.B();
        Z7.E e10 = Z7.E.f18177d;
        if (str == null) {
            str = "";
        }
        String str3 = str;
        W9.m mVar = new W9.m(20, false);
        mVar.f16704x = uri;
        mVar.f16705y = str2;
        mVar.f16706z = bundle;
        return new Z7.H(str3, new C1210y(c1208w), null, new Z7.C(b6), Z7.K.f18248K, new Z7.E(mVar));
    }

    public static ComponentName I(TtsMediaSessionService ttsMediaSessionService, String str) {
        PackageManager packageManager = ttsMediaSessionService.getPackageManager();
        Intent intent = new Intent(str);
        intent.setPackage(ttsMediaSessionService.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);
    }

    @Override
    public final void A(long j10) {
        if (j10 < 0) {
            return;
        }
        G(10, new C2127x0(this, j10, 0), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final void B() {
        G(3, new C2125w0(this, 6), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    public final void G(final int i10, final F0 f02, final f9.a0 a0Var, final boolean z10) {
        C2123v0 c2123v0 = this.f27290g;
        if (c2123v0.i()) {
            return;
        }
        if (a0Var != null) {
            c8.y.I(c2123v0.f27786l, new Runnable() {
                @Override
                public final void run() {
                    G0 g02 = G0.this;
                    C2123v0 c2123v02 = g02.f27290g;
                    if (c2123v02.i()) {
                        return;
                    }
                    boolean isActive = ((f9.N) g02.f27294k.f29046x).f29022a.isActive();
                    int i11 = i10;
                    f9.a0 a0Var2 = a0Var;
                    if (!isActive) {
                        StringBuilder l4 = nn.j.l(i11, "Ignore incoming player command before initialization. command=", ", pid=");
                        l4.append(a0Var2.f29056a.f29053b);
                        AbstractC1763a.o("MediaSessionLegacyStub", l4.toString());
                        return;
                    }
                    C2106m0 K3 = g02.K(a0Var2);
                    if (!g02.f27289f.u(K3, i11)) {
                        if (i11 != 1 || c2123v02.f27794t.k()) {
                            return;
                        }
                        AbstractC1763a.o("MediaSessionLegacyStub", "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;
                    }
                    c2123v02.s(K3);
                    c2123v02.f27779e.getClass();
                    try {
                        f02.d(K3);
                    } catch (RemoteException e10) {
                        AbstractC1763a.p("MediaSessionLegacyStub", "Exception in " + K3, e10);
                    }
                    if (z10) {
                        new SparseBooleanArray().append(i11, true);
                        c2123v02.p(K3);
                    }
                }
            });
            return;
        }
        AbstractC1763a.f("MediaSessionLegacyStub", "RemoteUserInfo is null, ignoring command=" + i10);
    }

    public final void H(s1 s1Var, int i10, F0 f02, f9.a0 a0Var) {
        if (a0Var != null) {
            c8.y.I(this.f27290g.f27786l, new T(this, s1Var, i10, a0Var, f02));
            return;
        }
        StringBuilder sb2 = new StringBuilder("RemoteUserInfo is null, ignoring command=");
        Object obj = s1Var;
        if (s1Var == null) {
            obj = Integer.valueOf(i10);
        }
        sb2.append(obj);
        AbstractC1763a.f("MediaSessionLegacyStub", sb2.toString());
    }

    public final void J(Z7.H h10, boolean z10) {
        G(31, new B0(this, h10, z10), ((f9.N) this.f27294k.f29046x).c(), false);
    }

    public final C2106m0 K(f9.a0 a0Var) {
        C2106m0 n5 = this.f27289f.n(a0Var);
        if (n5 == null) {
            C2106m0 c2106m0 = new C2106m0(a0Var, 0, 0, this.f27291h.b(a0Var), new E0(a0Var), Bundle.EMPTY);
            C2102k0 l4 = this.f27290g.l(c2106m0);
            this.f27289f.c(a0Var, c2106m0, l4.f27603a, l4.f27604b);
            n5 = c2106m0;
        }
        Lf.a0 a0Var2 = this.f27293j;
        long j10 = this.f27298o;
        a0Var2.removeMessages(1001, n5);
        a0Var2.sendMessageDelayed(a0Var2.obtainMessage(1001, n5), j10);
        return n5;
    }

    public final void L(o1 o1Var) {
        c8.y.I(this.f27290g.f27786l, new RunnableC2131z0(this, o1Var, 1));
    }

    @Override
    public final void b(C2304H c2304h) {
        if (c2304h != null) {
            G(20, new C2088d0(-1, this, c2304h), ((f9.N) this.f27294k.f29046x).c(), false);
        }
    }

    @Override
    public final void c(C2304H c2304h, int i10) {
        if (c2304h != null) {
            if (i10 == -1 || i10 >= 0) {
                G(20, new C2088d0(i10, this, c2304h), ((f9.N) this.f27294k.f29046x).c(), false);
            }
        }
    }

    @Override
    public final void d(String str, Bundle bundle, ResultReceiver resultReceiver) {
        AbstractC1764b.h(str);
        if (str.equals("androidx.media3.session.SESSION_COMMAND_MEDIA3_PLAY_REQUEST")) {
            return;
        }
        if (str.equals("androidx.media3.session.SESSION_COMMAND_REQUEST_SESSION3_TOKEN") && resultReceiver != null) {
            resultReceiver.send(0, this.f27290g.f27784j.b());
        } else {
            s1 s1Var = new s1(str, Bundle.EMPTY);
            H(s1Var, 0, new C0009j(this, s1Var, bundle, resultReceiver), ((f9.N) this.f27294k.f29046x).c());
        }
    }

    @Override
    public final void e(String str, Bundle bundle) {
        if (str.equals("androidx.media3.session.SESSION_COMMAND_MEDIA3_PLAY_REQUEST")) {
            return;
        }
        s1 s1Var = new s1(str, Bundle.EMPTY);
        H(s1Var, 0, new C2129y0(this, s1Var, bundle), ((f9.N) this.f27294k.f29046x).c());
    }

    @Override
    public final void f() {
        G(12, new C2125w0(this, 0), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final boolean g(Intent intent) {
        f9.a0 c10 = ((f9.N) this.f27294k.f29046x).c();
        c10.getClass();
        return this.f27290g.n(new C2106m0(c10, 0, 0, false, null, Bundle.EMPTY), intent);
    }

    @Override
    public final void h() {
        G(1, new C2125w0(this, 11), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final void i() {
        G(1, new C2125w0(this, 10), ((f9.N) this.f27294k.f29046x).c(), false);
    }

    @Override
    public final void j(String str, Bundle bundle) {
        J(F(str, null, null, bundle), true);
    }

    @Override
    public final void k(String str, Bundle bundle) {
        J(F(null, null, str, bundle), true);
    }

    @Override
    public final void l(Uri uri, Bundle bundle) {
        J(F(null, uri, null, bundle), true);
    }

    @Override
    public final void m() {
        G(2, new C2125w0(this, 5), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final void n(String str, Bundle bundle) {
        J(F(str, null, null, bundle), false);
    }

    @Override
    public final void o(String str, Bundle bundle) {
        J(F(null, null, str, bundle), false);
    }

    @Override
    public final void p(Uri uri, Bundle bundle) {
        J(F(null, uri, null, bundle), false);
    }

    @Override
    public final void q(C2304H c2304h) {
        if (c2304h == null) {
            return;
        }
        G(20, new C2129y0(1, this, c2304h), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final void r() {
        G(11, new C2125w0(this, 4), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final void s(long j10) {
        G(5, new C2127x0(this, j10, 1), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final void t(final float f4) {
        if (f4 <= 0.0f) {
            return;
        }
        G(13, new F0() {
            @Override
            public final void d(C2106m0 c2106m0) {
                G0.this.f27290g.f27794t.D0(f4);
            }
        }, ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final void u(f9.f0 f0Var) {
        v(f0Var);
    }

    @Override
    public final void v(f9.f0 f0Var) {
        Z7.X o10 = AbstractC2111p.o(f0Var);
        if (o10 != null) {
            H(null, 40010, new C2125w0(this, o10), ((f9.N) this.f27294k.f29046x).c());
            return;
        }
        AbstractC1763a.o("MediaSessionLegacyStub", "Ignoring invalid RatingCompat " + f0Var);
    }

    @Override
    public final void w(int i10) {
        G(15, new A0(this, i10, 0), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final void x(int i10) {
        G(14, new A0(this, i10, 1), ((f9.N) this.f27294k.f29046x).c(), true);
    }

    @Override
    public final void y() {
        boolean b02 = this.f27290g.f27794t.b0(9);
        f9.U u10 = this.f27294k;
        if (b02) {
            G(9, new C2125w0(this, 8), ((f9.N) u10.f29046x).c(), true);
        } else {
            G(8, new C2125w0(this, 9), ((f9.N) u10.f29046x).c(), true);
        }
    }

    @Override
    public final void z() {
        boolean b02 = this.f27290g.f27794t.b0(7);
        f9.U u10 = this.f27294k;
        if (b02) {
            G(7, new C2125w0(this, 2), ((f9.N) u10.f29046x).c(), true);
        } else {
            G(6, new C2125w0(this, 3), ((f9.N) u10.f29046x).c(), true);
        }
    }
}