summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorRobin Lee <rgl@google.com>2014-08-21 16:51:18 +0100
committerJeff Sharkey <jsharkey@google.com>2014-08-21 17:37:20 +0000
commite812d9096915ad165de125520ed7371009587d1f (patch)
tree3d8f124c06fff865cd49e5d74679cbc43a30b207 /services
parente4be1bf2bed48afd234ea1f2558c60beffe3fa18 (diff)
downloadframeworks_base-e812d9096915ad165de125520ed7371009587d1f.zip
frameworks_base-e812d9096915ad165de125520ed7371009587d1f.tar.gz
frameworks_base-e812d9096915ad165de125520ed7371009587d1f.tar.bz2
Clear identity before calling out to PackageHelper
PackageHelper.resolveInstallLocation expects the binding user to be equivalent to the calling user. If this is not the case, it may fail and throw an exception preventing anyone but user 0 from installing anything. Bug: 17175251 Change-Id: Id5615738c7b4e1234a548c7b4a410282d14c9ee3
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/pm/PackageInstallerService.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index 03cb2e9..5e802de 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -485,17 +485,22 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
if (params.mode == SessionParams.MODE_FULL_INSTALL) {
// Brand new install, use best resolved location. This also verifies
// that target has enough free space for the install.
- final int resolved = PackageHelper.resolveInstallLocation(mContext,
- params.appPackageName, params.installLocation, params.sizeBytes,
- params.installFlags);
- if (resolved == PackageHelper.RECOMMEND_INSTALL_INTERNAL) {
- stageInternal = true;
- } else if (resolved == PackageHelper.RECOMMEND_INSTALL_EXTERNAL) {
- stageInternal = false;
- } else {
- throw new IOException("No storage with enough free space; res=" + resolved);
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ final int resolved = PackageHelper.resolveInstallLocation(mContext,
+ params.appPackageName, params.installLocation, params.sizeBytes,
+ params.installFlags);
+
+ if (resolved == PackageHelper.RECOMMEND_INSTALL_INTERNAL) {
+ stageInternal = true;
+ } else if (resolved == PackageHelper.RECOMMEND_INSTALL_EXTERNAL) {
+ stageInternal = false;
+ } else {
+ throw new IOException("No storage with enough free space; res=" + resolved);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
-
} else if (params.mode == SessionParams.MODE_INHERIT_EXISTING) {
// We always stage inheriting sessions on internal storage first,
// since we don't want to grow containers until we're sure that