am ee77eced: Merge "Check signature match between Cert installer and Settings" into mnc-dev

* commit 'ee77eced69fac3e6f94cbb3ce2013d8334c17c90':
  Check signature match between Cert installer and Settings
This commit is contained in:
Zoltan Szatmary-Ban
2015-07-09 17:49:56 +00:00
committed by Android Git Automerger

View File

@@ -22,6 +22,7 @@ import android.app.admin.DevicePolicyManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo; import android.content.pm.UserInfo;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.AsyncTask; import android.os.AsyncTask;
@@ -417,8 +418,10 @@ public final class CredentialStorage extends Activity {
*/ */
private boolean checkCallerIsCertInstallerOrSelfInProfile() { private boolean checkCallerIsCertInstallerOrSelfInProfile() {
if (TextUtils.equals("com.android.certinstaller", getCallingPackage())) { if (TextUtils.equals("com.android.certinstaller", getCallingPackage())) {
// CertInstaller is allowed to install credentials // CertInstaller is allowed to install credentials if it has the same signature as
return true; // Settings package.
return getPackageManager().checkSignatures(
getCallingPackage(), getPackageName()) == PackageManager.SIGNATURE_MATCH;
} }
final int launchedFromUserId; final int launchedFromUserId;