当前位置: 首页>>代码示例>>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;未经允许,请勿转载。