MD5 校验值:63f8e52e07318fa084f03ba71262387f
k0.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package t1; import android.annotation.SuppressLint; import android.media.MediaCrypto; import android.media.MediaCryptoException; import android.media.MediaDrm; 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 q1.t1; import t1.g0; import t1.m; public final class k0 implements g0 { public static final g0.c f16388d = new g0.c() { @Override public final g0 a(UUID uuid) { g0 A; A = k0.A(uuid); return A; } }; private final UUID f16389a; private final MediaDrm f16390b; private int f16391c; private static class a { public static boolean a(MediaDrm mediaDrm, String str) { return mediaDrm.requiresSecureDecoder(str); } public static void b(MediaDrm mediaDrm, byte[] bArr, t1 t1Var) { LogSessionId a10 = t1Var.a(); if (a10.equals(LogSessionId.LOG_SESSION_ID_NONE)) { return; } ((MediaDrm.PlaybackComponent) m3.a.e(mediaDrm.getPlaybackComponent(bArr))).setLogSessionId(a10); } } private k0(UUID uuid) { m3.a.e(uuid); m3.a.b(!p1.i.f13530b.equals(uuid), "Use C.CLEARKEY_UUID instead"); this.f16389a = uuid; MediaDrm mediaDrm = new MediaDrm(u(uuid)); this.f16390b = mediaDrm; this.f16391c = 1; if (p1.i.f13532d.equals(uuid) && B()) { w(mediaDrm); } } public static g0 A(UUID uuid) { try { return C(uuid); } catch (p0 unused) { m3.r.c("FrameworkMediaDrm", "Failed to instantiate a FrameworkMediaDrm for uuid: " + uuid + "."); return new d0(); } } private static boolean B() { return "ASUS_Z00AD".equals(m3.n0.f12326d); } public static k0 C(UUID uuid) { try { return new k0(uuid); } catch (UnsupportedSchemeException e10) { throw new p0(1, e10); } catch (Exception e11) { throw new p0(2, e11); } } private static byte[] p(byte[] bArr) { m3.a0 a0Var = new m3.a0(bArr); int t10 = a0Var.t(); short v10 = a0Var.v(); short v11 = a0Var.v(); if (v10 != 1 || v11 != 1) { m3.r.f("FrameworkMediaDrm", "Unexpected record count or type. Skipping LA_URL workaround."); return bArr; } short v12 = a0Var.v(); Charset charset = v4.e.f17358e; String E = a0Var.E(v12, charset); if (E.contains("<LA_URL>")) { return bArr; } int indexOf = E.indexOf("</DATA>"); if (indexOf == -1) { m3.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 i10 = t10 + 52; ByteBuffer allocate = ByteBuffer.allocate(i10); allocate.order(ByteOrder.LITTLE_ENDIAN); allocate.putInt(i10); allocate.putShort(v10); allocate.putShort(v11); allocate.putShort((short) (str.length() * 2)); allocate.put(str.getBytes(charset)); return allocate.array(); } private static String q(String str) { return "<LA_URL>https://x</LA_URL>".equals(str) ? "" : (m3.n0.f12323a == 33 && "https://default.url".equals(str)) ? "" : str; } private static byte[] r(UUID uuid, byte[] bArr) { return p1.i.f13531c.equals(uuid) ? t1.a.a(bArr) : bArr; } private static byte[] s(UUID uuid, byte[] bArr) { UUID uuid2 = p1.i.f13533e; if (uuid2.equals(uuid)) { byte[] e10 = c2.l.e(bArr, uuid); if (e10 != null) { bArr = e10; } bArr = c2.l.a(uuid2, p(bArr)); } if (m3.n0.f12323a >= 23 || !p1.i.f13532d.equals(uuid)) { if (uuid2.equals(uuid) && "Amazon".equals(m3.n0.f12325c)) { String str = m3.n0.f12326d; if (!"AFTB".equals(str)) { if (!"AFTS".equals(str)) { if (!"AFTM".equals(str)) { } } } } } byte[] e11 = c2.l.e(bArr, uuid); return e11 != null ? e11 : bArr; } private static String t(UUID uuid, String str) { return (m3.n0.f12323a < 26 && p1.i.f13531c.equals(uuid) && ("video/mp4".equals(str) || "audio/mp4".equals(str))) ? "cenc" : str; } private static UUID u(UUID uuid) { return (m3.n0.f12323a >= 27 || !p1.i.f13531c.equals(uuid)) ? uuid : p1.i.f13530b; } private static void w(MediaDrm mediaDrm) { mediaDrm.setPropertyString("securityLevel", "L3"); } private static m.b y(UUID uuid, List<m.b> list) { boolean z10; if (p1.i.f13532d.equals(uuid)) { if (m3.n0.f12323a >= 28 && list.size() > 1) { m.b bVar = list.get(0); int i10 = 0; for (int i11 = 0; i11 < list.size(); i11++) { m.b bVar2 = list.get(i11); byte[] bArr = (byte[]) m3.a.e(bVar2.f16409s); if (!m3.n0.c(bVar2.f16408r, bVar.f16408r) || !m3.n0.c(bVar2.f16407q, bVar.f16407q) || !c2.l.c(bArr)) { z10 = false; break; } i10 += bArr.length; } z10 = true; if (z10) { byte[] bArr2 = new byte[i10]; int i12 = 0; for (int i13 = 0; i13 < list.size(); i13++) { byte[] bArr3 = (byte[]) m3.a.e(list.get(i13).f16409s); int length = bArr3.length; System.arraycopy(bArr3, 0, bArr2, i12, length); i12 += length; } return bVar.b(bArr2); } } for (int i14 = 0; i14 < list.size(); i14++) { m.b bVar3 = list.get(i14); int g10 = c2.l.g((byte[]) m3.a.e(bVar3.f16409s)); int i15 = m3.n0.f12323a; if (i15 < 23 && g10 == 0) { return bVar3; } if (i15 >= 23 && g10 == 1) { return bVar3; } } } return list.get(0); } public void z(g0.b bVar, MediaDrm mediaDrm, byte[] bArr, int i10, int i11, byte[] bArr2) { bVar.a(this, bArr, i10, i11, bArr2); } @Override public void a(final g0.b bVar) { this.f16390b.setOnEventListener(bVar == null ? null : new MediaDrm.OnEventListener() { @Override public final void onEvent(MediaDrm mediaDrm, byte[] bArr, int i10, int i11, byte[] bArr2) { k0.this.z(bVar, mediaDrm, bArr, i10, i11, bArr2); } }); } @Override public Map<String, String> b(byte[] bArr) { return this.f16390b.queryKeyStatus(bArr); } @Override public g0.d c() { MediaDrm.ProvisionRequest provisionRequest = this.f16390b.getProvisionRequest(); return new g0.d(provisionRequest.getData(), provisionRequest.getDefaultUrl()); } @Override public void d(byte[] bArr, t1 t1Var) { if (m3.n0.f12323a >= 31) { try { a.b(this.f16390b, bArr, t1Var); } catch (UnsupportedOperationException unused) { m3.r.i("FrameworkMediaDrm", "setLogSessionId failed."); } } } @Override public byte[] f() { return this.f16390b.openSession(); } @Override public boolean g(byte[] bArr, String str) { if (m3.n0.f12323a >= 31) { return a.a(this.f16390b, str); } try { MediaCrypto mediaCrypto = new MediaCrypto(this.f16389a, bArr); try { return mediaCrypto.requiresSecureDecoderComponent(str); } finally { mediaCrypto.release(); } } catch (MediaCryptoException unused) { return true; } } @Override public void h(byte[] bArr, byte[] bArr2) { this.f16390b.restoreKeys(bArr, bArr2); } @Override public void i(byte[] bArr) { this.f16390b.closeSession(bArr); } @Override public byte[] j(byte[] bArr, byte[] bArr2) { if (p1.i.f13531c.equals(this.f16389a)) { bArr2 = t1.a.b(bArr2); } return this.f16390b.provideKeyResponse(bArr, bArr2); } @Override public void k(byte[] bArr) { this.f16390b.provideProvisionResponse(bArr); } @Override @SuppressLint({"WrongConstant"}) public g0.a l(byte[] bArr, List<m.b> list, int i10, HashMap<String, String> hashMap) { byte[] bArr2; String str; m.b bVar = null; if (list != null) { bVar = y(this.f16389a, list); bArr2 = s(this.f16389a, (byte[]) m3.a.e(bVar.f16409s)); str = t(this.f16389a, bVar.f16408r); } else { bArr2 = null; str = null; } MediaDrm.KeyRequest keyRequest = this.f16390b.getKeyRequest(bArr, bArr2, str, i10, hashMap); byte[] r10 = r(this.f16389a, keyRequest.getData()); String q10 = q(keyRequest.getDefaultUrl()); if (TextUtils.isEmpty(q10) && bVar != null && !TextUtils.isEmpty(bVar.f16407q)) { q10 = bVar.f16407q; } return new g0.a(r10, q10, m3.n0.f12323a >= 23 ? keyRequest.getRequestType() : Integer.MIN_VALUE); } @Override public int m() { return 2; } @Override public synchronized void release() { int i10 = this.f16391c - 1; this.f16391c = i10; if (i10 == 0) { this.f16390b.release(); } } @Override public h0 e(byte[] bArr) { return new h0(u(this.f16389a), bArr, m3.n0.f12323a < 21 && p1.i.f13532d.equals(this.f16389a) && "L3".equals(x("securityLevel"))); } public String x(String str) { return this.f16390b.getPropertyString(str); } }