package ar.tvplayer.tv;

import android.app.Application;
import android.content.Context;
import android.content.pm.Signature;
import android.os.Handler;
import android.os.Looper;
import java.io.InputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/* loaded from: classes.dex */
public class ProtectedTvPlayerApplication extends Application {
    private static Object GAzqD;

    public class ProtectedAppComponentFactory implements Runnable {
        private final Throwable G;

        ProtectedAppComponentFactory(Throwable th) {
            this.G = th;
        }

        static void fECoyeqJF(Context context, Throwable th) throws Throwable {
            if (!(th instanceof MessageGuardException)) {
                throw th;
            }
            new Handler(Looper.getMainLooper()).postAtFrontOfQueue(new ProtectedAppComponentFactory(th));
        }

        /* JADX WARN: Unreachable blocks removed: 1, instructions: 1 */
        @Override // java.lang.Runnable
        public void run() throws Throwable {
            throw this.G;
        }
    }

    public ProtectedTvPlayerApplication() {
        GAzqD = this;
    }

    private void HyGokf() throws NoSuchAlgorithmException {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
        Signature[] signatureArr = getPackageManager().getPackageInfo(getPackageName(), 64).signatures;
        if (signatureArr == null || signatureArr.length == 0) {
            throw new RuntimeException("Signing certificates not found");
        }
        if (signatureArr.length != 1) {
            throw new RuntimeException("Package is signed by multiple signing certificates [" + signatureArr.length + "]");
        }
        String string = new BigInteger(1, messageDigest.digest(signatureArr[0].toByteArray())).toString(16);
        if (!"cafa2c5e0affcc243b4df23d1a69720a78a92412afc210a051b88ca68fca2c5b".equals(string)) {
            throw new RuntimeException("Certificate mismatch. Expecting sha256[cafa2c5e0affcc243b4df23d1a69720a78a92412afc210a051b88ca68fca2c5b], current sha256[" + string + "]");
        }
    }

    public static byte[] gBo(byte[] bArr) {
        byte[] bArr2 = {-57, -47, -125, -108, -97, -127, -58, -126, -70, -117, 0, 99, 36, 64, -81, -72, 39, -69, -96, -16, 99, -26, 43, -42, -48, 55, -32, 48, 123, 98, -43, -118, 45, 105, 3, -127, -90, 82, 15, 84, -99, 41, 123, 109, 74, -54, 98, -28, -30, 98, 65, -121, -103, -72, -102, 79, 111, 77, -60, -61, 22, -10, -114, -52, 88, -93, -93, -5, -71, 28, 62, 77, -16, 114, 4, 11, -111, 90, 83, -16, 68, -112, -30, -88, -69, -68, 79, -22, 69, 90, 40, -50, -114, 66, 37, -40, 38, 13, 52, -62, 18, -4, 55, 51, -79, -49, 8, -113, -46, 26, -109, -58, -26, 6, 103, 88, -42, -48, -121, -72, 70, 63, -25, -8, -121, -40, 61, 21, -20, 48, -117, 85, -116, -22, -56, -21, 63, 73, -33, -44, -72, 82, -53, -57, -93, 70, 93, -98, 0, 49, -3, -12, -117, -57, 112, Byte.MIN_VALUE, -125, -98, -17, Byte.MIN_VALUE, -104, -112, Byte.MIN_VALUE, 49, -8, -40, -47, -21, 114, 124, -103, 64, -100, 124, -6, -79, 89, -14, -9, -70, 23, -112, 92, -7, 26, -107, 7, 124, -54, 39, -94, -26, -87, 18, 66, 73, 90, 94, 31, -55, 90, 98, 33, -2, 43, -39, -40, -36, 59, 14, 38, -63, 93, -56, 3, -104, -60, -61, 92, -79, -95, -35, -94, 13, -67, -32, 93, -66, -40, -95, -118, 58, 11, 69, -100, -113, -113, 84, Byte.MAX_VALUE, 53, -59, 79, 88, -58, 41, 11, 126, -18, -23, 88, 63, 53, -15, -55, 30, 125};
        byte[] bArr3 = {-99, -32, 47, -101, 68, 118, -43, 57, 88, 105, 73, 32, 63, -42, -9, -85, -117, 100, 21, -122, -122, -75, 111, -40, 40, 79, 54, 61, 51, -30, 94, 91, 43, -125, -1, 9, 11, 106, -30, -43, 43, -38, 60, 75, -111, -42, -15, 27, 26, -62, -105, 109, 50, -87, 54, 9, -37, -44, 65, 108, -35, -82, -48, 96, -125, -34, -115, 93, 75, 26, -95, -98, -95, -47, 51, -63, -28, -69, 9, -30, -72, 112, 34, Byte.MAX_VALUE, 32, 36, -21, -40, 113, -117, 29, -6, 37, -84, 91, 55, -81, -22, 77, -22, -61, 90, 88, -77, -29, 33, -118, -35, 48, 106, -11, -119, 19, 101, -111, -21, 9, -37, 96, 32, -17, -16, -92, -52, 24, -21, -61, 23, 33, 89, 62, -20, -61, -105, 2, 71, -8, 113, 101, 33, 96, -60, 6, -34, -88, 25, -100, 32, -91, 22, -78, -54, 84, -120, -112, -33, 22, -39, -38, -116, -87, 57, -6, 70, 115, -28, -86, 43, -125, 36, 12, 55, -127, -21, 34, -127, -67, 96, -120, -125, 74, -87, 10, 59, -96, -10, 124, -81, -63, 86, -72, -95, 87, -8, -126, 120, -103, 14, -15, 17, -24, -126, 118, -4, -62, -117, -5, 24, -6, 61, 27, -118, -119, -57, 28, 94, -103, -87, -69, -52, 29, -28, 85, -3, -21, 93, 76, -12, 88, 117, 111, -85, -3, -114, 93, 123, 97, 47, 27, 38, -31, 115, 80, 56, 68, -97, 95, -33, 69, -71, 46, 122, -36, 106, -58, 80};
        byte[] bArr4 = new byte[32];
        for (int i = 0; i < 32; i++) {
            bArr4[i] = bArr2[bArr3[bArr[i] & 255] & 255];
        }
        return bArr4;
    }

    public static native InputStream ron(Object obj, String str);

    public static native String s(String str);

    private static native void vpyozAG();

    @Override // android.content.ContextWrapper
    protected void attachBaseContext(Context context) throws Throwable {
        super.attachBaseContext(context);
        try {
            HyGokf();
            System.loadLibrary("dexprotector");
        } catch (Throwable th) {
            ProtectedAppComponentFactory.fECoyeqJF(this, th);
        }
    }

    @Override // android.app.Application
    public void onCreate() throws Throwable {
        super.onCreate();
        try {
            vpyozAG();
        } catch (Throwable th) {
            ProtectedAppComponentFactory.fECoyeqJF(this, th);
        }
    }
}
