當前位置: 首頁>>代碼示例>>Java>>正文


Java PackageManager.SIGNATURE_SECOND_NOT_SIGNED屬性代碼示例

本文整理匯總了Java中android.content.pm.PackageManager.SIGNATURE_SECOND_NOT_SIGNED屬性的典型用法代碼示例。如果您正苦於以下問題:Java PackageManager.SIGNATURE_SECOND_NOT_SIGNED屬性的具體用法?Java PackageManager.SIGNATURE_SECOND_NOT_SIGNED怎麽用?Java PackageManager.SIGNATURE_SECOND_NOT_SIGNED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.content.pm.PackageManager的用法示例。


在下文中一共展示了PackageManager.SIGNATURE_SECOND_NOT_SIGNED屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: call

@Override
public Object call(Object who, Method method, Object... args) throws Throwable {

    if (args.length == 2 && args[0] instanceof String && args[1] instanceof String) {

        PackageManager pm = VirtualCore.getPM();

        String pkgNameOne = (String) args[0], pkgNameTwo = (String) args[1];
        try {
            PackageInfo pkgOne = pm.getPackageInfo(pkgNameOne, PackageManager.GET_SIGNATURES);
            PackageInfo pkgTwo = pm.getPackageInfo(pkgNameTwo, PackageManager.GET_SIGNATURES);

            Signature[] one = pkgOne.signatures;
            Signature[] two = pkgTwo.signatures;

            if (ArrayUtils.isEmpty(one)) {
                if (!ArrayUtils.isEmpty(two)) {
                    return PackageManager.SIGNATURE_FIRST_NOT_SIGNED;
                } else {
                    return PackageManager.SIGNATURE_NEITHER_SIGNED;
                }
            } else {
                if (ArrayUtils.isEmpty(two)) {
                    return PackageManager.SIGNATURE_SECOND_NOT_SIGNED;
                } else {
                    // 走到了這裏說明兩個包的簽名都在
                    if (Arrays.equals(one, two)) {
                        return PackageManager.SIGNATURE_MATCH;
                    } else {
                        return PackageManager.SIGNATURE_NO_MATCH;
                    }
                }
            }
        } catch (Throwable e) {
            // Ignore
        }
    }

    return method.invoke(who, args);
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:40,代碼來源:MethodProxies.java

示例2: call

@Override
public Object call(Object who, Method method, Object... args) throws Throwable {

    if (args.length == 2 && args[0] instanceof String && args[1] instanceof String) {

        PackageManager pm = VirtualCore.getPM();

        String pkgNameOne = (String) args[0], pkgNameTwo = (String) args[1];
        try {
            PackageInfo pkgOne = pm.getPackageInfo(pkgNameOne, PackageManager.GET_SIGNATURES);
            PackageInfo pkgTwo = pm.getPackageInfo(pkgNameTwo, PackageManager.GET_SIGNATURES);

            Signature[] one = pkgOne.signatures;
            Signature[] two = pkgTwo.signatures;

            if (ArrayUtils.isEmpty(one)) {
                if (!ArrayUtils.isEmpty(two)) {
                    return PackageManager.SIGNATURE_FIRST_NOT_SIGNED;
                } else {
                    return PackageManager.SIGNATURE_NEITHER_SIGNED;
                }
            } else {
                if (ArrayUtils.isEmpty(two)) {
                    return PackageManager.SIGNATURE_SECOND_NOT_SIGNED;
                } else {
                    if (Arrays.equals(one, two)) {
                        return PackageManager.SIGNATURE_MATCH;
                    } else {
                        return PackageManager.SIGNATURE_NO_MATCH;
                    }
                }
            }
        } catch (Throwable e) {
            // Ignore
        }
    }

    return method.invoke(who, args);
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:39,代碼來源:MethodProxies.java

示例3: call

@Override
public Object call(Object who, Method method, Object... args) throws Throwable {

	if (args.length == 2 && args[0] instanceof String && args[1] instanceof String) {

		PackageManager pm = VirtualCore.getPM();

		String pkgNameOne = (String) args[0], pkgNameTwo = (String) args[1];
		try {
			PackageInfo pkgOne = pm.getPackageInfo(pkgNameOne, PackageManager.GET_SIGNATURES);
			PackageInfo pkgTwo = pm.getPackageInfo(pkgNameTwo, PackageManager.GET_SIGNATURES);

			Signature[] one = pkgOne.signatures;
			Signature[] two = pkgTwo.signatures;

			if (ArrayUtils.isEmpty(one)) {
				if (!ArrayUtils.isEmpty(two)) {
					return PackageManager.SIGNATURE_FIRST_NOT_SIGNED;
				} else {
					return PackageManager.SIGNATURE_NEITHER_SIGNED;
				}
			} else {
				if (ArrayUtils.isEmpty(two)) {
					return PackageManager.SIGNATURE_SECOND_NOT_SIGNED;
				} else {
					// 走到了這裏說明兩個包的簽名都在
					if (Arrays.equals(one, two)) {
						return PackageManager.SIGNATURE_MATCH;
					} else {
						return PackageManager.SIGNATURE_NO_MATCH;
					}
				}
			}
		} catch (Throwable e) {
			// Ignore
		}
	}

	return method.invoke(who, args);
}
 
開發者ID:codehz,項目名稱:container,代碼行數:40,代碼來源:CheckSignatures.java


注:本文中的android.content.pm.PackageManager.SIGNATURE_SECOND_NOT_SIGNED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。