Merge "Setting Session commited broadcast when an existing apk is enabled for a different user" into oc-dev

This commit is contained in:
Sunny Goyal
2017-05-12 21:08:57 +00:00
committed by Android (Google) Code Review
6 changed files with 61 additions and 19 deletions

View File

@@ -1696,15 +1696,27 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public int installExistingPackage(String packageName) throws NameNotFoundException {
return installExistingPackageAsUser(packageName, mContext.getUserId());
return installExistingPackage(packageName, PackageManager.INSTALL_REASON_UNKNOWN);
}
@Override
public int installExistingPackage(String packageName, int installReason)
throws NameNotFoundException {
return installExistingPackageAsUser(packageName, installReason, mContext.getUserId());
}
@Override
public int installExistingPackageAsUser(String packageName, int userId)
throws NameNotFoundException {
return installExistingPackageAsUser(packageName, PackageManager.INSTALL_REASON_UNKNOWN,
userId);
}
private int installExistingPackageAsUser(String packageName, int installReason, int userId)
throws NameNotFoundException {
try {
int res = mPM.installExistingPackageAsUser(packageName, userId, 0 /*installFlags*/,
PackageManager.INSTALL_REASON_UNKNOWN);
installReason);
if (res == INSTALL_FAILED_INVALID_URI) {
throw new NameNotFoundException("Package " + packageName + " doesn't exist");
}

View File

@@ -4628,6 +4628,14 @@ public abstract class PackageManager {
*/
public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
/**
* If there is already an application with the given package name installed
* on the system for other users, also install it for the calling user.
* @hide
*/
public abstract int installExistingPackage(String packageName, @InstallReason int installReason)
throws NameNotFoundException;
/**
* If there is already an application with the given package name installed
* on the system for other users, also install it for the specified user.