public boolean validateSignature(@NonNull Context context, @NonNull String packageName) {
        if (isDebug(context)) {
            return true;
        }

        PackageInfo packageInfo;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(packageName,
                    PackageManager.GET_SIGNATURES);
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }

        for (Signature signature : packageInfo.signatures) {
            String hashedSignature = Utility.sha1hash(signature.toByteArray());
            if (!validAppSignatureHashes.contains(hashedSignature)) {
                return false;
            }
        }
        return true;
    }
public boolean validateSignature(@NonNull Context context, @NonNull String packageName) {
        if (isDebug(context)) {
            return true;
        }

        PackageInfo packageInfo;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(packageName,
                    PackageManager.GET_SIGNATURES);
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }

        for (Signature signature : packageInfo.signatures) {
            String hashedSignature = Utility.sha1hash(signature.toByteArray());
            if (!validAppSignatureHashes.contains(hashedSignature)) {
                return false;
            }
        }
        return true;
    }
public boolean validateSignature ( @ NonNull Context context , @ NonNull String packageName ) { if ( isDebug ( context ) ) { return true ; } PackageInfo packageInfo ; try { packageInfo = context . getPackageManager ( ) . getPackageInfo ( packageName , PackageManager . GET_SIGNATURES ) ; } catch ( PackageManager . NameNotFoundException e ) { return false ; } for ( Signature signature : packageInfo . signatures ) { String hashedSignature = Utility . sha1hash ( signature . toByteArray ( ) ) ; if ( ! validAppSignatureHashes . contains ( hashedSignature ) ) { return false ; } } return true ; }
Validates the app signature required or returns true if in debug.
Validates the app signature required or returns true if in debug .