Clear calling identity

Before getting the package uid, need to clear the calling identity

Change-Id: Id917288f5457baa7672d0355889a498bc9a92cb3
Fixes: 31058820
Test: cts-tradefed run commandAndExit cts --skip-connectivity-check --skip-device-info --disable-reboot -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testPackageInstallUserRestrictions
This commit is contained in:
Todd Kennedy
2016-08-31 15:54:48 -07:00
parent 9edadbd87a
commit c25fbdec41

View File

@@ -44,6 +44,7 @@ import android.content.pm.PackageParser.ApkLite;
import android.content.pm.PackageParser.PackageLite; import android.content.pm.PackageParser.PackageLite;
import android.content.pm.PackageParser.PackageParserException; import android.content.pm.PackageParser.PackageParserException;
import android.content.pm.Signature; import android.content.pm.Signature;
import android.os.Binder;
import android.os.Bundle; import android.os.Bundle;
import android.os.FileBridge; import android.os.FileBridge;
import android.os.FileUtils; import android.os.FileUtils;
@@ -271,9 +272,14 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
} else { } else {
mPermissionsAccepted = false; mPermissionsAccepted = false;
} }
final int uid = mPm.getPackageUid(PackageManagerService.DEFAULT_CONTAINER_PACKAGE, final long identity = Binder.clearCallingIdentity();
PackageManager.MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM); try {
defaultContainerGid = UserHandle.getSharedAppGid(uid); final int uid = mPm.getPackageUid(PackageManagerService.DEFAULT_CONTAINER_PACKAGE,
PackageManager.MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM);
defaultContainerGid = UserHandle.getSharedAppGid(uid);
} finally {
Binder.restoreCallingIdentity(identity);
}
} }
public SessionInfo generateInfo() { public SessionInfo generateInfo() {