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


Java PackageManager.SIGNATURE_MATCH屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:amikey,項目名稱:DroidPlugin,代碼行數:23,代碼來源:RunningProcesList.java

示例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;
}
 
開發者ID:amikey,項目名稱:DroidPlugin,代碼行數:26,代碼來源:RunningProcesList.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:7763sea,項目名稱:VirtualHook,代碼行數:40,代碼來源:MethodProxies.java

示例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;
    }
}
 
開發者ID:brevent,項目名稱:Brevent,代碼行數:14,代碼來源:BreventActivity.java

示例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;
        }
    }
 
開發者ID:coder3101,項目名稱:Matrix-Calculator-for-Android,代碼行數:33,代碼來源:GlobalValues.java

示例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);
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:39,代碼來源:MethodProxies.java

示例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;
    }
}
 
開發者ID:TaRGroup,項目名稱:IFWManager,代碼行數:9,代碼來源:IntentFirewall.java

示例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);
}
 
開發者ID:codehz,項目名稱:container,代碼行數:40,代碼來源:CheckSignatures.java

示例9: isDonated

private boolean isDonated() {
    return getPackageManager().checkSignatures(getPackageName(), "ru.meefik.donate")
            == PackageManager.SIGNATURE_MATCH;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:RepositoryActivity.java

示例10: isBreventFramework

private boolean isBreventFramework() {
    PackageManager packageManager = getPackageManager();
    return packageManager.checkSignatures(PACKAGE_FRAMEWORK, BuildConfig.APPLICATION_ID) ==
            PackageManager.SIGNATURE_MATCH;
}
 
開發者ID:brevent,項目名稱:Brevent,代碼行數:5,代碼來源:BreventActivity.java

示例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));
}
 
開發者ID:lucasax,項目名稱:Zero,代碼行數:4,代碼來源:Utils.java

示例12: hasValidProEnablerSignature

private static boolean hasValidProEnablerSignature(Context context) {
	return (context.getPackageManager()
			.checkSignatures(context.getPackageName(), context.getPackageName() + ".pro") == PackageManager.SIGNATURE_MATCH);
}
 
開發者ID:ukanth,項目名稱:XPrivacy,代碼行數:4,代碼來源:Util.java


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