PackageManager checkSignatures - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PackageManager checkSignatures method.

This code example shows how to use the following methods:checkSignatures, getApplicationInfo
This code example shows how to use the following methods:checkSignatures, getPackagesForUid
		final String pname = getPackageNameByUid(uid);
		return checkSignature(pname);
	} 
 
	public boolean checkSignature(final String pname) {
		return mPackageManager.checkSignatures(pname, mContext.getPackageName()) == PackageManager.SIGNATURE_MATCH;
	} 
 
	public boolean deny(final String package_name) {
		if (package_name == null) return false;
		final SharedPreferences.Editor editor = mPreferences.edit();
		editor.putInt(package_name, PERMISSION_DENIED);
		return editor.commit();
 
	} 
 
	public int getPermissions(final int uid) {
		return getPermissions(getPackageNameByUid(uid));
	} 
 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:checkSignatures, getComponentEnabledSetting, resolveService
	 * @return true if ads should be hidden 
	 */ 
	public static boolean hideAds(final Context context) {
		PackageManager pm = context.getPackageManager();
		Intent donationCheck = new Intent(DONATOR_BROADCAST_CHECK);
		ResolveInfo ri = pm.resolveService(donationCheck, 0);
		// Log.d(TAG, "ri: " + ri); 
		int match = PackageManager.SIGNATURE_UNKNOWN_PACKAGE;
		if (ri != null) {
			Log.d(TAG, "found package: " + ri.serviceInfo.packageName);
			ComponentName cn = new ComponentName(ri.serviceInfo.packageName, ri.serviceInfo.name);
			// Log.d(TAG, "component name: " + cn); 
			int i = pm.getComponentEnabledSetting(cn);
			// Log.d(TAG, "component status: " + i); 
			// Log.d(TAG, "package status: " + ri.serviceInfo.enabled); 
			if (i == PackageManager.COMPONENT_ENABLED_STATE_ENABLED
					|| i == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
					&& ri.serviceInfo.enabled) {
				match = pm.checkSignatures(context.getPackageName(), ri.serviceInfo.packageName);
			} else { 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:checkSignatures
		String signature = pi.signatures[0].toCharsString();
		return signature;
	} 
 
	public boolean doSignaturesMatch(String pkg1, String pkg2) {
		boolean match = pkgMngr.checkSignatures(pkg1, pkg2) == SIGNATURE_MATCH;
		return match;
	} 
 
	public boolean isInstalledFromMarket(String pkgName)
			throws NameNotFoundException { 
		String installerPkg = pkgMngr.getInstallerPackageName(pkgName);
		boolean installedFromMarket = "com.google.android.feedback"
				.equals(installerPkg);
		return installedFromMarket;
	} 
 
	public long getClassesDexCrc() { 
		ZipFile zf;
		try { 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:checkSignatures, getPackageInfo
        return formatDate(context, date) + " " + formatTime(context, date);
    } 
 
    public static boolean elitePresent(Context context, boolean versionCheck, int minVersion) {
        PackageManager pm = context.getPackageManager();
        int sigs = pm.checkSignatures("com.noshufou.android.su", "com.noshufou.android.su.elite");
        if (sigs != PackageManager.SIGNATURE_MATCH) {
            return false; 
        } else { 
            if (versionCheck) {
                PackageInfo pi;
                try { 
                    pi = pm.getPackageInfo("com.noshufou.android.su.elite", 0);
                    if (pi.versionCode >= minVersion) {
                        return true; 
                    } else { 
                        return false; 
                    } 
                } catch (NameNotFoundException e) {
                    return false; 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:checkSignatures
        /** 
         * Compare the package signature with WapPushManager package 
         */ 
        protected boolean signatureCheck(String package_name) {
            PackageManager pm = mContext.getPackageManager();
            int match = pm.checkSignatures(mContext.getPackageName(), package_name);
 
            if (LOCAL_LOGV) Log.v(LOG_TAG, "compare signature " + mContext.getPackageName()
                    + " and " +  package_name + ", match=" + match);
 
            return match == PackageManager.SIGNATURE_MATCH;
        } 
 
        /** 
         * Returns the status value of the message processing. 
         * The message will be processed as follows: 
         * 1.Look up Application ID Table with x-wap-application-id + content type 
         * 2.Check the signature of package name that is found in the 
         *   Application ID Table by using PackageManager.checkSignature 
         * 3.Trigger the Application 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:checkSignatures
        wrapped.removePermission(name);
    } 
 
    @Override 
    public int checkSignatures(String pkg1, String pkg2) {
        return wrapped.checkSignatures(pkg1, pkg2);
    } 
 
    @Override 
    public int checkSignatures(int uid1, int uid2) {
        return wrapped.checkSignatures(uid1, uid2);
    } 
 
    @Override 
    public String[] getPackagesForUid(int uid) {
        return wrapped.getPackagesForUid(uid);
    } 
 
    @Override 
    public String getNameForUid(int uid) {
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
checkSignatures Method Overview
Like checkSignatures(String, String), but takes UIDs of the two packages to be checked.
See Code Examples for other Android PackageManager Methods: