AppProtocol { 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; }  boolean validateMinimumVersion(
            @NonNull Context context, @NonNull PackageInfo packageInfo, int minimumVersion); @Deprecated boolean isUberInstalled(@NonNull Context context); boolean isInstalled(@NonNull Context context, @NonNull SupportedAppType supportedApp); boolean isInstalled(@NonNull Context context, @NonNull SupportedAppType supportedApp, int minimumVersion); @NonNull List<PackageInfo> getInstalledPackages(
            @NonNull Context context, @NonNull SupportedAppType supportedApp, int minimumVersion); boolean isAppLinkSupported(); boolean validateSignature(@NonNull Context context, @NonNull String packageName); @Nullable String getAppSignature(@NonNull Context context); @Deprecated
    static final String[] UBER_PACKAGE_NAMES; static final String PLATFORM; }
@Test public void validateSignature_whenValid_returnsTrue() { stubAppSignature(GOOD_SIGNATURE); assertTrue(appProtocol.validateSignature(activity, AppProtocol.RIDER_PACKAGE_NAMES[0])); }
@Test public void validateSignature_whenInvalid_returnsFalse() { stubAppSignature(BAD_SIGNATURE); assertFalse(appProtocol.validateSignature(activity, AppProtocol.RIDER_PACKAGE_NAMES[0])); }
@Test public void validateSignature_whenGoodAndBad_returnsFalse() { stubAppSignature(GOOD_SIGNATURE, BAD_SIGNATURE); assertFalse(appProtocol.validateSignature(activity, AppProtocol.RIDER_PACKAGE_NAMES[0])); }