MD5 校验值:8d01bad3385dcb060a6dcda2da0f8dbf
k0.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package t5; import android.annotation.SuppressLint; 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 q5.u1; import t5.g0; import t5.m; public final class k0 implements g0 { public static final g0.c f24188d = new g0.c() { @Override public final g0 a(UUID uuid) { g0 A; A = k0.A(uuid); return A; } }; private final UUID f24189a; private final MediaDrm f24190b; private int f24191c; private 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, u1 u1Var) { MediaDrm$PlaybackComponent playbackComponent; LogSessionId a10 = u1Var.a(); if (a10.equals(LogSessionId.LOG_SESSION_ID_NONE)) { return; } playbackComponent = mediaDrm.getPlaybackComponent(bArr); ((MediaDrm$PlaybackComponent) l7.a.e(playbackComponent)).setLogSessionId(a10); } } private k0(UUID uuid) { l7.a.e(uuid); l7.a.b(!p5.j.f20383b.equals(uuid), "Use C.CLEARKEY_UUID instead"); this.f24189a = uuid; MediaDrm mediaDrm = new MediaDrm(u(uuid)); this.f24190b = mediaDrm; this.f24191c = 1; if (p5.j.f20385d.equals(uuid) && B()) { w(mediaDrm); } } public static g0 A(UUID uuid) { try { return C(uuid); } catch (p0 unused) { l7.r.c("FrameworkMediaDrm", "Failed to instantiate a FrameworkMediaDrm for uuid: " + uuid + "."); return new d0(); } } private static boolean B() { return "ASUS_Z00AD".equals(l7.n0.f17597d); } 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) { l7.a0 a0Var = new l7.a0(bArr); int t10 = a0Var.t(); short v10 = a0Var.v(); short v11 = a0Var.v(); if (v10 != 1 || v11 != 1) { l7.r.f("FrameworkMediaDrm", "Unexpected record count or type. Skipping LA_URL workaround."); return bArr; } short v12 = a0Var.v(); Charset charset = x8.e.f27736e; String E = a0Var.E(v12, charset); if (E.contains("<LA_URL>")) { return bArr; } int indexOf = E.indexOf("</DATA>"); if (indexOf == -1) { l7.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) ? "" : (l7.n0.f17594a == 33 && "https://default.url".equals(str)) ? "" : str; } private static byte[] r(UUID uuid, byte[] bArr) { return p5.j.f20384c.equals(uuid) ? t5.a.a(bArr) : bArr; } private static byte[] s(UUID uuid, byte[] bArr) { UUID uuid2 = p5.j.f20386e; if (uuid2.equals(uuid)) { byte[] e10 = c6.l.e(bArr, uuid); if (e10 != null) { bArr = e10; } bArr = c6.l.a(uuid2, p(bArr)); } if (l7.n0.f17594a >= 23 || !p5.j.f20385d.equals(uuid)) { if (uuid2.equals(uuid) && "Amazon".equals(l7.n0.f17596c)) { String str = l7.n0.f17597d; if (!"AFTB".equals(str)) { if (!"AFTS".equals(str)) { if (!"AFTM".equals(str)) { } } } } } byte[] e11 = c6.l.e(bArr, uuid); return e11 != null ? e11 : bArr; } private static String t(UUID uuid, String str) { return (l7.n0.f17594a < 26 && p5.j.f20384c.equals(uuid) && ("video/mp4".equals(str) || "audio/mp4".equals(str))) ? "cenc" : str; } private static UUID u(UUID uuid) { return (l7.n0.f17594a >= 27 || !p5.j.f20384c.equals(uuid)) ? uuid : p5.j.f20383b; } private static void w(MediaDrm mediaDrm) { mediaDrm.setPropertyString("securityLevel", "L3"); } private static m.b y(UUID uuid, List<m.b> list) { boolean z10; if (p5.j.f20385d.equals(uuid)) { if (l7.n0.f17594a >= 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[]) l7.a.e(bVar2.f24209e); if (!l7.n0.c(bVar2.f24208d, bVar.f24208d) || !l7.n0.c(bVar2.f24207c, bVar.f24207c) || !c6.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[]) l7.a.e(list.get(i13).f24209e); 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 = c6.l.g((byte[]) l7.a.e(bVar3.f24209e)); int i15 = l7.n0.f17594a; 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 Map<String, String> a(byte[] bArr) { return this.f24190b.queryKeyStatus(bArr); } @Override public g0.d b() { MediaDrm.ProvisionRequest provisionRequest = this.f24190b.getProvisionRequest(); return new g0.d(provisionRequest.getData(), provisionRequest.getDefaultUrl()); } @Override public byte[] d() { return this.f24190b.openSession(); } @Override public boolean e(byte[] bArr, String str) { if (l7.n0.f17594a >= 31) { return a.a(this.f24190b, str); } try { MediaCrypto mediaCrypto = new MediaCrypto(this.f24189a, bArr); try { return mediaCrypto.requiresSecureDecoderComponent(str); } finally { mediaCrypto.release(); } } catch (MediaCryptoException unused) { return true; } } @Override public void f(byte[] bArr, byte[] bArr2) { this.f24190b.restoreKeys(bArr, bArr2); } @Override public void g(byte[] bArr) { this.f24190b.closeSession(bArr); } @Override public byte[] h(byte[] bArr, byte[] bArr2) { if (p5.j.f20384c.equals(this.f24189a)) { bArr2 = t5.a.b(bArr2); } return this.f24190b.provideKeyResponse(bArr, bArr2); } @Override public void i(byte[] bArr) { this.f24190b.provideProvisionResponse(bArr); } @Override @SuppressLint({"WrongConstant"}) public g0.a j(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.f24189a, list); bArr2 = s(this.f24189a, (byte[]) l7.a.e(bVar.f24209e)); str = t(this.f24189a, bVar.f24208d); } else { bArr2 = null; str = null; } MediaDrm.KeyRequest keyRequest = this.f24190b.getKeyRequest(bArr, bArr2, str, i10, hashMap); byte[] r10 = r(this.f24189a, keyRequest.getData()); String q10 = q(keyRequest.getDefaultUrl()); if (TextUtils.isEmpty(q10) && bVar != null && !TextUtils.isEmpty(bVar.f24207c)) { q10 = bVar.f24207c; } return new g0.a(r10, q10, l7.n0.f17594a >= 23 ? keyRequest.getRequestType() : Integer.MIN_VALUE); } @Override public int k() { return 2; } @Override public void l(final g0.b bVar) { this.f24190b.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 void m(byte[] bArr, u1 u1Var) { if (l7.n0.f17594a >= 31) { try { a.b(this.f24190b, bArr, u1Var); } catch (UnsupportedOperationException unused) { l7.r.i("FrameworkMediaDrm", "setLogSessionId failed."); } } } @Override public synchronized void release() { int i10 = this.f24191c - 1; this.f24191c = i10; if (i10 == 0) { this.f24190b.release(); } } @Override public h0 c(byte[] bArr) { return new h0(u(this.f24189a), bArr, l7.n0.f17594a < 21 && p5.j.f20385d.equals(this.f24189a) && "L3".equals(x("securityLevel"))); } public String x(String str) { return this.f24190b.getPropertyString(str); } }