diff options
author | Kenny Root <kroot@google.com> | 2013-04-01 15:59:59 -0700 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2013-04-02 11:50:16 -0700 |
commit | 95e3ee3971915b323e5c13dcfe3b12a4180850cd (patch) | |
tree | 233169c1fc19155ec6fa7d0b408838ac051ce426 /services | |
parent | b7aca350e4c46bbc431f2ecaa4d8cee87915fe8b (diff) | |
download | frameworks_base-95e3ee3971915b323e5c13dcfe3b12a4180850cd.zip frameworks_base-95e3ee3971915b323e5c13dcfe3b12a4180850cd.tar.gz frameworks_base-95e3ee3971915b323e5c13dcfe3b12a4180850cd.tar.bz2 |
Remove keystore entries when package removed
Add a hook into PackageManagerService so that when app IDs are
completely removed, we erase all entries from keystore for those UIDs
that have gone away.
Bug: 3020069
Change-Id: Id4b1d51a5fa4c418865055635a84bebcf5b65ec8
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/pm/PackageManagerService.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index b8324ee..c16f0ee 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -111,7 +111,9 @@ import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.os.Environment.UserEnvironment; +import android.os.UserManager; import android.provider.Settings.Secure; +import android.security.KeyStore; import android.security.SystemKeyStore; import android.util.DisplayMetrics; import android.util.EventLog; @@ -8219,6 +8221,17 @@ public class PackageManagerService extends IPackageManager.Stub { mSettings.writeLPr(); } } + // A user ID was deleted here. Go through all users and remove it from + // KeyStore. + final int appId = outInfo.removedAppId; + if (appId != -1) { + final KeyStore keyStore = KeyStore.getInstance(); + if (keyStore != null) { + for (final int userId : sUserManager.getUserIds()) { + keyStore.clearUid(UserHandle.getUid(userId, appId)); + } + } + } } /* |