导航菜单

页面标题

页面副标题

迅 唔 v1.3.9 - n0.java 源代码

正在查看: 迅 唔 v1.3.9 应用的 n0.java JAVA 源代码文件

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


package w1;

import android.media.MediaCrypto;
import android.media.MediaCryptoException;
import android.media.MediaDrm;
import android.media.MediaDrm$PlaybackComponent;
import android.media.UnsupportedSchemeException;
import android.media.metrics.LogSessionId;
import android.text.TextUtils;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import t1.t1;
import w1.g0;
import w1.m;

public final class n0 implements g0 {

    public static final g0.c f10858d = new g0.c() {
        @Override
        public final g0 a(UUID uuid) {
            g0 A;
            A = n0.A(uuid);
            return A;
        }
    };

    public final UUID f10859a;

    public final MediaDrm f10860b;

    public int f10861c;

    public static class a {
        public static boolean a(MediaDrm mediaDrm, String str) {
            boolean requiresSecureDecoder;
            requiresSecureDecoder = mediaDrm.requiresSecureDecoder(str);
            return requiresSecureDecoder;
        }

        public static void b(MediaDrm mediaDrm, byte[] bArr, t1 t1Var) {
            MediaDrm$PlaybackComponent playbackComponent;
            LogSessionId a8 = t1Var.a();
            if (a8.equals(LogSessionId.LOG_SESSION_ID_NONE)) {
                return;
            }
            playbackComponent = mediaDrm.getPlaybackComponent(bArr);
            ((MediaDrm$PlaybackComponent) p3.a.e(playbackComponent)).setLogSessionId(a8);
        }
    }

    public n0(UUID uuid) {
        p3.a.e(uuid);
        p3.a.b(!s1.l.f8542b.equals(uuid), "Use C.CLEARKEY_UUID instead");
        this.f10859a = uuid;
        MediaDrm mediaDrm = new MediaDrm(u(uuid));
        this.f10860b = mediaDrm;
        this.f10861c = 1;
        if (s1.l.f8544d.equals(uuid) && B()) {
            w(mediaDrm);
        }
    }

    public static g0 A(UUID uuid) {
        try {
            return C(uuid);
        } catch (s0 unused) {
            p3.r.c("FrameworkMediaDrm", "Failed to instantiate a FrameworkMediaDrm for uuid: " + uuid + ".");
            return new d0();
        }
    }

    public static boolean B() {
        return "ASUS_Z00AD".equals(p3.q0.f7051d);
    }

    public static n0 C(UUID uuid) {
        try {
            return new n0(uuid);
        } catch (UnsupportedSchemeException e8) {
            throw new s0(1, e8);
        } catch (Exception e9) {
            throw new s0(2, e9);
        }
    }

    public static byte[] p(byte[] bArr) {
        p3.c0 c0Var = new p3.c0(bArr);
        int t7 = c0Var.t();
        short v7 = c0Var.v();
        short v8 = c0Var.v();
        if (v7 != 1 || v8 != 1) {
            p3.r.f("FrameworkMediaDrm", "Unexpected record count or type. Skipping LA_URL workaround.");
            return bArr;
        }
        short v9 = c0Var.v();
        Charset charset = s3.d.f9010e;
        String E = c0Var.E(v9, charset);
        if (E.contains("<LA_URL>")) {
            return bArr;
        }
        int indexOf = E.indexOf("</DATA>");
        if (indexOf == -1) {
            p3.r.i("FrameworkMediaDrm", "Could not find the </DATA> tag. Skipping LA_URL workaround.");
        }
        String str = E.substring(0, indexOf) + "<LA_URL>https://x</LA_URL>" + E.substring(indexOf);
        int i8 = t7 + 52;
        ByteBuffer allocate = ByteBuffer.allocate(i8);
        allocate.order(ByteOrder.LITTLE_ENDIAN);
        allocate.putInt(i8);
        allocate.putShort(v7);
        allocate.putShort(v8);
        allocate.putShort((short) (str.length() * 2));
        allocate.put(str.getBytes(charset));
        return allocate.array();
    }

    public static String q(String str) {
        return "<LA_URL>https://x</LA_URL>".equals(str) ? "" : (p3.q0.f7048a == 33 && "https://default.url".equals(str)) ? "" : str;
    }

    public static byte[] r(UUID uuid, byte[] bArr) {
        return s1.l.f8543c.equals(uuid) ? w1.a.a(bArr) : bArr;
    }

    public static byte[] s(java.util.UUID r3, byte[] r4) {
        throw new UnsupportedOperationException("Method not decompiled: w1.n0.s(java.util.UUID, byte[]):byte[]");
    }

    public static String t(UUID uuid, String str) {
        return (p3.q0.f7048a < 26 && s1.l.f8543c.equals(uuid) && ("video/mp4".equals(str) || "audio/mp4".equals(str))) ? "cenc" : str;
    }

    public static UUID u(UUID uuid) {
        return (p3.q0.f7048a >= 27 || !s1.l.f8543c.equals(uuid)) ? uuid : s1.l.f8542b;
    }

    public static void w(MediaDrm mediaDrm) {
        mediaDrm.setPropertyString("securityLevel", "L3");
    }

    public static m.b y(UUID uuid, List<m.b> list) {
        boolean z7;
        if (s1.l.f8544d.equals(uuid)) {
            if (p3.q0.f7048a >= 28 && list.size() > 1) {
                m.b bVar = list.get(0);
                int i8 = 0;
                for (int i9 = 0; i9 < list.size(); i9++) {
                    m.b bVar2 = list.get(i9);
                    byte[] bArr = (byte[]) p3.a.e(bVar2.f10857l);
                    if (!p3.q0.c(bVar2.f10856k, bVar.f10856k) || !p3.q0.c(bVar2.f10855j, bVar.f10855j) || !f2.l.c(bArr)) {
                        z7 = false;
                        break;
                    }
                    i8 += bArr.length;
                }
                z7 = true;
                if (z7) {
                    byte[] bArr2 = new byte[i8];
                    int i10 = 0;
                    for (int i11 = 0; i11 < list.size(); i11++) {
                        byte[] bArr3 = (byte[]) p3.a.e(list.get(i11).f10857l);
                        int length = bArr3.length;
                        System.arraycopy(bArr3, 0, bArr2, i10, length);
                        i10 += length;
                    }
                    return bVar.c(bArr2);
                }
            }
            for (int i12 = 0; i12 < list.size(); i12++) {
                m.b bVar3 = list.get(i12);
                int g8 = f2.l.g((byte[]) p3.a.e(bVar3.f10857l));
                int i13 = p3.q0.f7048a;
                if (i13 < 23 && g8 == 0) {
                    return bVar3;
                }
                if (i13 >= 23 && g8 == 1) {
                    return bVar3;
                }
            }
        }
        return list.get(0);
    }

    public void z(g0.b bVar, MediaDrm mediaDrm, byte[] bArr, int i8, int i9, byte[] bArr2) {
        bVar.a(this, bArr, i8, i9, bArr2);
    }

    @Override
    public boolean a(byte[] bArr, String str) {
        if (p3.q0.f7048a >= 31) {
            return a.a(this.f10860b, str);
        }
        try {
            MediaCrypto mediaCrypto = new MediaCrypto(this.f10859a, bArr);
            try {
                return mediaCrypto.requiresSecureDecoderComponent(str);
            } finally {
                mediaCrypto.release();
            }
        } catch (MediaCryptoException unused) {
            return true;
        }
    }

    @Override
    public void b(byte[] bArr, byte[] bArr2) {
        this.f10860b.restoreKeys(bArr, bArr2);
    }

    @Override
    public Map<String, String> c(byte[] bArr) {
        return this.f10860b.queryKeyStatus(bArr);
    }

    @Override
    public void d(byte[] bArr) {
        this.f10860b.closeSession(bArr);
    }

    @Override
    public void e(byte[] bArr, t1 t1Var) {
        if (p3.q0.f7048a >= 31) {
            try {
                a.b(this.f10860b, bArr, t1Var);
            } catch (UnsupportedOperationException unused) {
                p3.r.i("FrameworkMediaDrm", "setLogSessionId failed.");
            }
        }
    }

    @Override
    public byte[] f(byte[] bArr, byte[] bArr2) {
        if (s1.l.f8543c.equals(this.f10859a)) {
            bArr2 = w1.a.b(bArr2);
        }
        return this.f10860b.provideKeyResponse(bArr, bArr2);
    }

    @Override
    public g0.d g() {
        MediaDrm.ProvisionRequest provisionRequest = this.f10860b.getProvisionRequest();
        return new g0.d(provisionRequest.getData(), provisionRequest.getDefaultUrl());
    }

    @Override
    public void h(byte[] bArr) {
        this.f10860b.provideProvisionResponse(bArr);
    }

    @Override
    public g0.a i(byte[] bArr, List<m.b> list, int i8, HashMap<String, String> hashMap) {
        byte[] bArr2;
        String str;
        m.b bVar = null;
        if (list != null) {
            bVar = y(this.f10859a, list);
            bArr2 = s(this.f10859a, (byte[]) p3.a.e(bVar.f10857l));
            str = t(this.f10859a, bVar.f10856k);
        } else {
            bArr2 = null;
            str = null;
        }
        MediaDrm.KeyRequest keyRequest = this.f10860b.getKeyRequest(bArr, bArr2, str, i8, hashMap);
        byte[] r7 = r(this.f10859a, keyRequest.getData());
        String q7 = q(keyRequest.getDefaultUrl());
        if (TextUtils.isEmpty(q7) && bVar != null && !TextUtils.isEmpty(bVar.f10855j)) {
            q7 = bVar.f10855j;
        }
        return new g0.a(r7, q7, p3.q0.f7048a >= 23 ? keyRequest.getRequestType() : Integer.MIN_VALUE);
    }

    @Override
    public int j() {
        return 2;
    }

    @Override
    public void k(final g0.b bVar) {
        this.f10860b.setOnEventListener(bVar == null ? null : new MediaDrm.OnEventListener() {
            @Override
            public final void onEvent(MediaDrm mediaDrm, byte[] bArr, int i8, int i9, byte[] bArr2) {
                n0.this.z(bVar, mediaDrm, bArr, i8, i9, bArr2);
            }
        });
    }

    @Override
    public byte[] m() {
        return this.f10860b.openSession();
    }

    @Override
    public synchronized void release() {
        int i8 = this.f10861c - 1;
        this.f10861c = i8;
        if (i8 == 0) {
            this.f10860b.release();
        }
    }

    @Override
    public h0 l(byte[] bArr) {
        return new h0(u(this.f10859a), bArr, p3.q0.f7048a < 21 && s1.l.f8544d.equals(this.f10859a) && "L3".equals(x("securityLevel")));
    }

    public String x(String str) {
        return this.f10860b.getPropertyString(str);
    }
}