本文整理汇总了Java中android.content.pm.PackageManager.SIGNATURE_MATCH属性的典型用法代码示例。如果您正苦于以下问题:Java PackageManager.SIGNATURE_MATCH属性的具体用法?Java PackageManager.SIGNATURE_MATCH怎么用?Java PackageManager.SIGNATURE_MATCH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.pm.PackageManager
的用法示例。
在下文中一共展示了PackageManager.SIGNATURE_MATCH属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStubProcessByTarget
public String getStubProcessByTarget(ComponentInfo targetInfo) {
for (ProcessItem processItem : items.values()) {
if (processItem.pkgs.contains(targetInfo.packageName) && TextUtils.equals(processItem.targetProcessName, targetInfo.processName)) {
return processItem.stubProcessName;
} else {
try {
boolean signed = false;
for (String pkg : processItem.pkgs) {
if (PluginManager.getInstance().checkSignatures(targetInfo.packageName, pkg) == PackageManager.SIGNATURE_MATCH) {
signed = true;
break;
}
}
if (signed && TextUtils.equals(processItem.targetProcessName, targetInfo.processName)) {
return processItem.stubProcessName;
}
} catch (Exception e) {
Log.e(TAG, "getStubProcessByTarget:error", e);
}
}
}
return null;
}
示例2: isPkgCanRunInProcess
boolean isPkgCanRunInProcess(String packageName, String stubProcessName, String targetProcessName) throws RemoteException {
for (ProcessItem item : items.values()) {
if (TextUtils.equals(stubProcessName, item.stubProcessName)) {
if (!TextUtils.isEmpty(item.targetProcessName) && !TextUtils.equals(item.targetProcessName, targetProcessName)) {
continue;
}
if (item.pkgs.contains(packageName)) {
return true;
}
boolean signed = false;
for (String pkg : item.pkgs) {
if (PluginManager.getInstance().checkSignatures(packageName, pkg) == PackageManager.SIGNATURE_MATCH) {
signed = true;
break;
}
}
if (signed) {
return true;
}
}
}
return false;
}
示例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);
}
示例4: isFrameworkPackage
private boolean isFrameworkPackage(PackageManager packageManager, String packageName) {
if (fakeFramework) {
try {
PackageInfo packageInfo = packageManager.getPackageInfo(packageName, 0);
return isFrameworkPackage(packageManager, packageInfo);
} catch (PackageManager.NameNotFoundException e) {
UILog.w("cannot find " + packageName, e);
return false;
}
} else {
return packageManager.checkSignatures(PACKAGE_FRAMEWORK, packageName) ==
PackageManager.SIGNATURE_MATCH;
}
}
示例5: SetDonationKeyStatus
public void SetDonationKeyStatus() {
if (BuildConfig.DEBUG) {
Status = true;
return;
//if debug mode, avoid the advertisements and use pro features
}
try {
PackageManager packageManager = getPackageManager();
packageManager.getPackageInfo("com.softminds.matrixcalculator.pro.key", 0);
//Key is Installed
//Checking the Authenticity of the Key
if (packageManager.checkSignatures(getPackageName(),
"com.softminds.matrixcalculator.pro.key")
== PackageManager.SIGNATURE_MATCH) {
Log.d(TAG, "The Signature of Key Matched with Application");
String manager = packageManager.getInstallerPackageName("com.softminds.matrixcalculator.pro.key");
if (manager != null) {
//Status = true;
Log.d(TAG, manager);
if (Objects.equals(manager, "com.android.vending")) {
Status = true;
} else {
Status = false;
Toast.makeText(this, R.string.clear_warn_invalid_install, Toast.LENGTH_LONG).show();
}
}
//the Key is Genuine and was Installed from Play
}
} catch (Exception e) {
Status = false;
}
}
示例6: 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);
}
示例7: signaturesMatch
boolean signaturesMatch(int uid1, int uid2) {
try {
IPackageManager pm = AppGlobals.getPackageManager();
return pm.checkUidSignatures(uid1, uid2) == PackageManager.SIGNATURE_MATCH;
} catch (RemoteException ex) {
Slog.e(TAG, "Remote exception while checking signatures", ex);
return false;
}
}
示例8: 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);
}
示例9: isDonated
private boolean isDonated() {
return getPackageManager().checkSignatures(getPackageName(), "ru.meefik.donate")
== PackageManager.SIGNATURE_MATCH;
}
示例10: isBreventFramework
private boolean isBreventFramework() {
PackageManager packageManager = getPackageManager();
return packageManager.checkSignatures(PACKAGE_FRAMEWORK, BuildConfig.APPLICATION_ID) ==
PackageManager.SIGNATURE_MATCH;
}
示例11: checkProVersion
public static boolean checkProVersion(Context context) {
PackageManager manager = context.getPackageManager();
return (manager.checkSignatures(context.getPackageName(), PRO_NAME) == PackageManager.SIGNATURE_MATCH || (BuildConfig.DEBUG && Constants.DEBUG_PRO));
}
示例12: hasValidProEnablerSignature
private static boolean hasValidProEnablerSignature(Context context) {
return (context.getPackageManager()
.checkSignatures(context.getPackageName(), context.getPackageName() + ".pro") == PackageManager.SIGNATURE_MATCH);
}