Merge "Revert "Add more methods that take a userId to PackageManager.""
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 7aab5c4..5544a71 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -126,14 +126,8 @@
@Override
public PackageInfo getPackageInfo(String packageName, int flags)
throws NameNotFoundException {
- return getPackageInfoAsUser(packageName, flags, mContext.getUserId());
- }
-
- @Override
- public PackageInfo getPackageInfoAsUser(String packageName, int flags, int userId)
- throws NameNotFoundException {
try {
- PackageInfo pi = mPM.getPackageInfo(packageName, flags, userId);
+ PackageInfo pi = mPM.getPackageInfo(packageName, flags, mContext.getUserId());
if (pi != null) {
return pi;
}
@@ -1341,17 +1335,10 @@
@Override
public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags,
String installerPackageName) {
- installPackageAsUser(packageURI, observer, flags, installerPackageName,
- UserHandle.myUserId());
- }
-
- @Override
- public void installPackageAsUser(Uri packageURI, IPackageInstallObserver observer, int flags,
- String installerPackageName, int userId) {
final VerificationParams verificationParams = new VerificationParams(null, null,
null, VerificationParams.NO_UID, null);
installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
- installerPackageName, verificationParams, null, userId);
+ installerPackageName, verificationParams, null);
}
@Override
@@ -1361,7 +1348,7 @@
final VerificationParams verificationParams = new VerificationParams(verificationURI, null,
null, VerificationParams.NO_UID, manifestDigest);
installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
- installerPackageName, verificationParams, encryptionParams, UserHandle.myUserId());
+ installerPackageName, verificationParams, encryptionParams);
}
@Override
@@ -1369,7 +1356,7 @@
IPackageInstallObserver observer, int flags, String installerPackageName,
VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
- installerPackageName, verificationParams, encryptionParams, UserHandle.myUserId());
+ installerPackageName, verificationParams, encryptionParams);
}
@Override
@@ -1377,8 +1364,7 @@
int flags, String installerPackageName) {
final VerificationParams verificationParams = new VerificationParams(null, null,
null, VerificationParams.NO_UID, null);
- installCommon(packageURI, observer, flags, installerPackageName, verificationParams, null,
- UserHandle.myUserId());
+ installCommon(packageURI, observer, flags, installerPackageName, verificationParams, null);
}
@Override
@@ -1389,7 +1375,7 @@
final VerificationParams verificationParams = new VerificationParams(verificationURI, null,
null, VerificationParams.NO_UID, manifestDigest);
installCommon(packageURI, observer, flags, installerPackageName, verificationParams,
- encryptionParams, UserHandle.myUserId());
+ encryptionParams);
}
@Override
@@ -1397,13 +1383,12 @@
PackageInstallObserver observer, int flags, String installerPackageName,
VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
installCommon(packageURI, observer, flags, installerPackageName, verificationParams,
- encryptionParams, UserHandle.myUserId());
+ encryptionParams);
}
private void installCommon(Uri packageURI,
PackageInstallObserver observer, int flags, String installerPackageName,
- VerificationParams verificationParams, ContainerEncryptionParams encryptionParams,
- int userId) {
+ VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
if (!"file".equals(packageURI.getScheme())) {
throw new UnsupportedOperationException("Only file:// URIs are supported");
}
@@ -1413,22 +1398,17 @@
final String originPath = packageURI.getPath();
try {
- mPM.installPackageAsUser(originPath, observer.getBinder(), flags, installerPackageName,
- verificationParams, null, userId);
+ mPM.installPackage(originPath, observer.getBinder(), flags, installerPackageName,
+ verificationParams, null);
} catch (RemoteException ignored) {
}
}
@Override
- public int installExistingPackage(String packageName) throws NameNotFoundException {
- return installExistingPackageAsUser(packageName, UserHandle.myUserId());
- }
-
- @Override
- public int installExistingPackageAsUser(String packageName, int userId)
+ public int installExistingPackage(String packageName)
throws NameNotFoundException {
try {
- int res = mPM.installExistingPackageAsUser(packageName, userId);
+ int res = mPM.installExistingPackageAsUser(packageName, UserHandle.myUserId());
if (res == INSTALL_FAILED_INVALID_URI) {
throw new NameNotFoundException("Package " + packageName + " doesn't exist");
}
@@ -1726,14 +1706,8 @@
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
- deletePackageAsUser(packageName, observer, flags, UserHandle.myUserId());
- }
-
- @Override
- public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer, int flags,
- int userId) {
try {
- mPM.deletePackageAsUser(packageName, observer, userId, flags);
+ mPM.deletePackageAsUser(packageName, observer, UserHandle.myUserId(), flags);
} catch (RemoteException e) {
// Should never happen!
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index a92f4ef..c8e9402 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -2032,48 +2032,6 @@
throws NameNotFoundException;
/**
- * @hide
- * Retrieve overall information about an application package that is
- * installed on the system.
- * <p>
- * Throws {@link NameNotFoundException} if a package with the given name can
- * not be found on the system.
- * Fails if the calling context lacks the
- * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission and
- * the target user is not the calling user.
- *
- * @param packageName The full name (i.e. com.google.apps.contacts) of the
- * desired package.
- * @param flags Additional option flags. Use any combination of
- * {@link #GET_ACTIVITIES}, {@link #GET_GIDS},
- * {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION},
- * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
- * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
- * {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to
- * modify the data returned.
- * @param userId The user id.
- * @return Returns a PackageInfo object containing information about the
- * package. If flag GET_UNINSTALLED_PACKAGES is set and if the
- * package is not found in the list of installed applications, the
- * package information is retrieved from the list of uninstalled
- * applications (which includes installed applications as well as
- * applications with data directory i.e. applications which had been
- * deleted with {@code DONT_DELETE_DATA} flag set).
- * @see #GET_ACTIVITIES
- * @see #GET_GIDS
- * @see #GET_CONFIGURATIONS
- * @see #GET_INSTRUMENTATION
- * @see #GET_PERMISSIONS
- * @see #GET_PROVIDERS
- * @see #GET_RECEIVERS
- * @see #GET_SERVICES
- * @see #GET_SIGNATURES
- * @see #GET_UNINSTALLED_PACKAGES
- */
- public abstract PackageInfo getPackageInfoAsUser(String packageName, int flags, int userId)
- throws NameNotFoundException;
-
- /**
* Map from the current package names in use on the device to whatever
* the current canonical name of that package is.
* @param names Array of current names to be mapped.
@@ -3630,38 +3588,6 @@
String installerPackageName);
/**
- * @hide
- * Install a package. Since this may take a little while, the result will be
- * posted back to the given observer. An installation will fail if the calling
- * context lacks the {@link android.Manifest.permission#INSTALL_PACKAGES}
- * permission or the {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL}
- * permission when the target user is not the calling user, the package named
- * in the package file's manifest is already installed, or if there's no space
- * available on the device.
- * @param packageURI The location of the package file to install. This can
- * be a 'file:' or a 'content:' URI.
- * @param observer An observer callback to get notified when the package
- * installation is complete.
- * {@link IPackageInstallObserver#packageInstalled(String, int)}
- * will be called when that happens. This parameter must not be
- * null.
- * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
- * {@link #INSTALL_REPLACE_EXISTING},
- * {@link #INSTALL_ALLOW_TEST}.
- * @param installerPackageName Optional package name of the application that
- * is performing the installation. This identifies which market
- * the package came from.
- * @param userId The user id
- * @deprecated Use {@link #installPackage(Uri, PackageInstallObserver, int,
- * String)} instead. This method will continue to be supported
- * but the older observer interface will not get additional
- * failure details.
- */
- public abstract void installPackageAsUser(
- Uri packageURI, IPackageInstallObserver observer, int flags,
- String installerPackageName, int userId);
-
- /**
* Similar to
* {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
* with an extra verification file provided.
@@ -3830,14 +3756,6 @@
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.
- * @hide
- */
- public abstract int installExistingPackageAsUser(String packageName, int userId)
- throws NameNotFoundException;
-
- /**
* Allows a package listening to the
* {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
* broadcast} to respond to the package manager. The response must include
@@ -4050,27 +3968,6 @@
String packageName, IPackageDeleteObserver observer, int flags);
/**
- * Attempts to delete a package. Since this may take a little while, the result will
- * be posted back to the given observer. A deletion will fail if the calling context
- * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission or the
- * {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} permission when the target
- * user is not the calling user, if the named package cannot be found, or if the named package
- * is a "system package".
- * (TODO: include pointer to documentation on "system packages")
- *
- * @param packageName The name of the package to delete
- * @param observer An observer callback to get notified when the package deletion is
- * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be
- * called when that happens. observer may be null to indicate that no callback is desired.
- * @param flags - possible values: {@link #DELETE_KEEP_DATA}, {@link #DELETE_ALL_USERS}.
- * @param userId - The user Id
- *
- * @hide
- */
- public abstract void deletePackageAsUser(
- String packageName, IPackageDeleteObserver observer, int flags, int userId);
-
- /**
* Retrieve the package name of the application that installed a package. This identifies
* which market the package came from.
*
diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java
index cfc4499..1ff621a 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -64,14 +64,7 @@
@Override
public PackageInfo getPackageInfo(String packageName, int flags)
- throws NameNotFoundException {
- throw new UnsupportedOperationException();
- }
-
- /** @hide */
- @Override
- public PackageInfo getPackageInfoAsUser(String packageName, int flags, int userId)
- throws NameNotFoundException {
+ throws NameNotFoundException {
throw new UnsupportedOperationException();
}
@@ -531,13 +524,6 @@
throw new UnsupportedOperationException();
}
- /** @hide */
- @Override
- public void installPackageAsUser(Uri packageURI, IPackageInstallObserver observer,
- int flags, String installerPackageName, int userId) {
- throw new UnsupportedOperationException();
- }
-
@Override
public void setInstallerPackageName(String targetPackage,
String installerPackageName) {
@@ -643,15 +629,6 @@
throw new UnsupportedOperationException();
}
- /**
- * @hide - to match hiding in superclass
- */
- @Override
- public void deletePackageAsUser(
- String packageName, IPackageDeleteObserver observer, int flags, int userId) {
- throw new UnsupportedOperationException();
- }
-
@Override
public void addPackageToPreferred(String packageName) {
throw new UnsupportedOperationException();
@@ -820,15 +797,6 @@
throw new UnsupportedOperationException();
}
- /**
- * @hide
- */
- @Override
- public int installExistingPackageAsUser(String packageName, int userId)
- throws NameNotFoundException {
- throw new UnsupportedOperationException();
- }
-
@Override
public void verifyPendingInstall(int id, int verificationCode) {
throw new UnsupportedOperationException();