本文整理汇总了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);
}
示例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);
}
示例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);
}