MD5 校验值:12538e99b43ae4a3db9c6dfff4aad74d
n0.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package i2; 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 f2.t1; import i2.g0; import i2.m; 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; public final class n0 implements g0 { public static final g0.c f14099d = new g0.c() { @Override public final g0 a(UUID uuid) { g0 A; A = n0.A(uuid); return A; } }; private final UUID f14100a; private final MediaDrm f14101b; private int f14102c; 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, t1 t1Var) { MediaDrm$PlaybackComponent playbackComponent; LogSessionId a10 = t1Var.a(); if (a10.equals(LogSessionId.LOG_SESSION_ID_NONE)) { return; } playbackComponent = mediaDrm.getPlaybackComponent(bArr); ((MediaDrm$PlaybackComponent) b4.a.e(playbackComponent)).setLogSessionId(a10); } } private n0(UUID uuid) { b4.a.e(uuid); b4.a.b(!e2.l.f10987b.equals(uuid), "Use C.CLEARKEY_UUID instead"); this.f14100a = uuid; MediaDrm mediaDrm = new MediaDrm(u(uuid)); this.f14101b = mediaDrm; this.f14102c = 1; if (e2.l.f10989d.equals(uuid) && B()) { w(mediaDrm); } } public static g0 A(UUID uuid) { try { return C(uuid); } catch (s0 unused) { b4.r.c("FrameworkMediaDrm", "Failed to instantiate a FrameworkMediaDrm for uuid: " + uuid + "."); return new d0(); } } private static boolean B() { return "ASUS_Z00AD".equals(b4.q0.f3673d); } public static n0 C(UUID uuid) { try { return new n0(uuid); } catch (UnsupportedSchemeException e10) { throw new s0(1, e10); } catch (Exception e11) { throw new s0(2, e11); } } private static byte[] p(byte[] bArr) { b4.c0 c0Var = new b4.c0(bArr); int t10 = c0Var.t(); short v10 = c0Var.v(); short v11 = c0Var.v(); if (v10 != 1 || v11 != 1) { b4.r.f("FrameworkMediaDrm", "Unexpected record count or type. Skipping LA_URL workaround."); return bArr; } short v12 = c0Var.v(); Charset charset = n5.e.f18542e; String E = c0Var.E(v12, charset); if (E.contains("<LA_URL>")) { return bArr; } int indexOf = E.indexOf("</DATA>"); if (indexOf == -1) { b4.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) ? "" : (b4.q0.f3670a == 33 && "https://default.url".equals(str)) ? "" : str; } private static byte[] r(UUID uuid, byte[] bArr) { return e2.l.f10988c.equals(uuid) ? i2.a.a(bArr) : bArr; } private static byte[] s(UUID uuid, byte[] bArr) { UUID uuid2 = e2.l.f10990e; if (uuid2.equals(uuid)) { byte[] e10 = r2.l.e(bArr, uuid); if (e10 != null) { bArr = e10; } bArr = r2.l.a(uuid2, p(bArr)); } if (b4.q0.f3670a >= 23 || !e2.l.f10989d.equals(uuid)) { if (uuid2.equals(uuid) && "Amazon".equals(b4.q0.f3672c)) { String str = b4.q0.f3673d; if (!"AFTB".equals(str)) { if (!"AFTS".equals(str)) { if (!"AFTM".equals(str)) { } } } } } byte[] e11 = r2.l.e(bArr, uuid); return e11 != null ? e11 : bArr; } private static String t(UUID uuid, String str) { return (b4.q0.f3670a < 26 && e2.l.f10988c.equals(uuid) && ("video/mp4".equals(str) || "audio/mp4".equals(str))) ? "cenc" : str; } private static UUID u(UUID uuid) { return (b4.q0.f3670a >= 27 || !e2.l.f10988c.equals(uuid)) ? uuid : e2.l.f10987b; } private static void w(MediaDrm mediaDrm) { mediaDrm.setPropertyString("securityLevel", "L3"); } private static m.b y(UUID uuid, List<m.b> list) { boolean z10; if (e2.l.f10989d.equals(uuid)) { if (b4.q0.f3670a >= 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[]) b4.a.e(bVar2.f14098e); if (!b4.q0.c(bVar2.f14097d, bVar.f14097d) || !b4.q0.c(bVar2.f14096c, bVar.f14096c) || !r2.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[]) b4.a.e(list.get(i13).f14098e); 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 = r2.l.g((byte[]) b4.a.e(bVar3.f14098e)); int i15 = b4.q0.f3670a; 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.f14101b.queryKeyStatus(bArr); } @Override public void b(byte[] bArr, t1 t1Var) { if (b4.q0.f3670a >= 31) { try { a.b(this.f14101b, bArr, t1Var); } catch (UnsupportedOperationException unused) { b4.r.i("FrameworkMediaDrm", "setLogSessionId failed."); } } } @Override public g0.d c() { MediaDrm.ProvisionRequest provisionRequest = this.f14101b.getProvisionRequest(); return new g0.d(provisionRequest.getData(), provisionRequest.getDefaultUrl()); } @Override public byte[] e() { return this.f14101b.openSession(); } @Override public boolean f(byte[] bArr, String str) { if (b4.q0.f3670a >= 31) { return a.a(this.f14101b, str); } try { MediaCrypto mediaCrypto = new MediaCrypto(this.f14100a, bArr); try { return mediaCrypto.requiresSecureDecoderComponent(str); } finally { mediaCrypto.release(); } } catch (MediaCryptoException unused) { return true; } } @Override public void g(byte[] bArr, byte[] bArr2) { this.f14101b.restoreKeys(bArr, bArr2); } @Override public void h(byte[] bArr) { this.f14101b.closeSession(bArr); } @Override public byte[] i(byte[] bArr, byte[] bArr2) { if (e2.l.f10988c.equals(this.f14100a)) { bArr2 = i2.a.b(bArr2); } return this.f14101b.provideKeyResponse(bArr, bArr2); } @Override public void j(final g0.b bVar) { this.f14101b.setOnEventListener(bVar == null ? null : new MediaDrm.OnEventListener() { @Override public final void onEvent(MediaDrm mediaDrm, byte[] bArr, int i10, int i11, byte[] bArr2) { n0.this.z(bVar, mediaDrm, bArr, i10, i11, bArr2); } }); } @Override public void k(byte[] bArr) { this.f14101b.provideProvisionResponse(bArr); } @Override 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.f14100a, list); bArr2 = s(this.f14100a, (byte[]) b4.a.e(bVar.f14098e)); str = t(this.f14100a, bVar.f14097d); } else { bArr2 = null; str = null; } MediaDrm.KeyRequest keyRequest = this.f14101b.getKeyRequest(bArr, bArr2, str, i10, hashMap); byte[] r10 = r(this.f14100a, keyRequest.getData()); String q10 = q(keyRequest.getDefaultUrl()); if (TextUtils.isEmpty(q10) && bVar != null && !TextUtils.isEmpty(bVar.f14096c)) { q10 = bVar.f14096c; } return new g0.a(r10, q10, b4.q0.f3670a >= 23 ? keyRequest.getRequestType() : Integer.MIN_VALUE); } @Override public int m() { return 2; } @Override public synchronized void release() { int i10 = this.f14102c - 1; this.f14102c = i10; if (i10 == 0) { this.f14101b.release(); } } @Override public h0 d(byte[] bArr) { return new h0(u(this.f14100a), bArr, b4.q0.f3670a < 21 && e2.l.f10989d.equals(this.f14100a) && "L3".equals(x("securityLevel"))); } public String x(String str) { return this.f14101b.getPropertyString(str); } }