Loading core/java/android/app/ApplicationPackageManager.java +13 −39 Original line number Diff line number Diff line Loading @@ -126,14 +126,8 @@ public class ApplicationPackageManager extends PackageManager { @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; } Loading Loading @@ -1341,17 +1335,10 @@ public class ApplicationPackageManager extends PackageManager { @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 Loading @@ -1361,7 +1348,7 @@ public class ApplicationPackageManager extends PackageManager { 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 Loading @@ -1369,7 +1356,7 @@ public class ApplicationPackageManager extends PackageManager { 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 Loading @@ -1377,8 +1364,7 @@ public class ApplicationPackageManager extends PackageManager { 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 Loading @@ -1389,7 +1375,7 @@ public class ApplicationPackageManager extends PackageManager { final VerificationParams verificationParams = new VerificationParams(verificationURI, null, null, VerificationParams.NO_UID, manifestDigest); installCommon(packageURI, observer, flags, installerPackageName, verificationParams, encryptionParams, UserHandle.myUserId()); encryptionParams); } @Override Loading @@ -1397,13 +1383,12 @@ public class ApplicationPackageManager extends PackageManager { 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"); } Loading @@ -1413,22 +1398,17 @@ public class ApplicationPackageManager extends PackageManager { 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"); } Loading Loading @@ -1726,14 +1706,8 @@ public class ApplicationPackageManager extends PackageManager { @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! } Loading core/java/android/content/pm/PackageManager.java +0 −103 Original line number Diff line number Diff line Loading @@ -2031,48 +2031,6 @@ public abstract class PackageManager { public abstract PackageInfo getPackageInfo(String packageName, int flags) 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. Loading Loading @@ -3629,38 +3587,6 @@ public abstract class PackageManager { Uri packageURI, IPackageInstallObserver observer, int flags, 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 Loading Loading @@ -3829,14 +3755,6 @@ 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 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 Loading Loading @@ -4049,27 +3967,6 @@ public abstract class PackageManager { public abstract void deletePackage( 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. Loading test-runner/src/android/test/mock/MockPackageManager.java +1 −33 Original line number Diff line number Diff line Loading @@ -68,13 +68,6 @@ public class MockPackageManager extends PackageManager { throw new UnsupportedOperationException(); } /** @hide */ @Override public PackageInfo getPackageInfoAsUser(String packageName, int flags, int userId) throws NameNotFoundException { throw new UnsupportedOperationException(); } @Override public String[] currentToCanonicalPackageNames(String[] names) { throw new UnsupportedOperationException(); Loading Loading @@ -531,13 +524,6 @@ public class MockPackageManager extends PackageManager { 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) { Loading Loading @@ -643,15 +629,6 @@ public class MockPackageManager extends PackageManager { 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(); Loading Loading @@ -820,15 +797,6 @@ public class MockPackageManager extends PackageManager { 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(); Loading Loading
core/java/android/app/ApplicationPackageManager.java +13 −39 Original line number Diff line number Diff line Loading @@ -126,14 +126,8 @@ public class ApplicationPackageManager extends PackageManager { @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; } Loading Loading @@ -1341,17 +1335,10 @@ public class ApplicationPackageManager extends PackageManager { @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 Loading @@ -1361,7 +1348,7 @@ public class ApplicationPackageManager extends PackageManager { 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 Loading @@ -1369,7 +1356,7 @@ public class ApplicationPackageManager extends PackageManager { 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 Loading @@ -1377,8 +1364,7 @@ public class ApplicationPackageManager extends PackageManager { 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 Loading @@ -1389,7 +1375,7 @@ public class ApplicationPackageManager extends PackageManager { final VerificationParams verificationParams = new VerificationParams(verificationURI, null, null, VerificationParams.NO_UID, manifestDigest); installCommon(packageURI, observer, flags, installerPackageName, verificationParams, encryptionParams, UserHandle.myUserId()); encryptionParams); } @Override Loading @@ -1397,13 +1383,12 @@ public class ApplicationPackageManager extends PackageManager { 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"); } Loading @@ -1413,22 +1398,17 @@ public class ApplicationPackageManager extends PackageManager { 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"); } Loading Loading @@ -1726,14 +1706,8 @@ public class ApplicationPackageManager extends PackageManager { @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! } Loading
core/java/android/content/pm/PackageManager.java +0 −103 Original line number Diff line number Diff line Loading @@ -2031,48 +2031,6 @@ public abstract class PackageManager { public abstract PackageInfo getPackageInfo(String packageName, int flags) 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. Loading Loading @@ -3629,38 +3587,6 @@ public abstract class PackageManager { Uri packageURI, IPackageInstallObserver observer, int flags, 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 Loading Loading @@ -3829,14 +3755,6 @@ 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 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 Loading Loading @@ -4049,27 +3967,6 @@ public abstract class PackageManager { public abstract void deletePackage( 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. Loading
test-runner/src/android/test/mock/MockPackageManager.java +1 −33 Original line number Diff line number Diff line Loading @@ -68,13 +68,6 @@ public class MockPackageManager extends PackageManager { throw new UnsupportedOperationException(); } /** @hide */ @Override public PackageInfo getPackageInfoAsUser(String packageName, int flags, int userId) throws NameNotFoundException { throw new UnsupportedOperationException(); } @Override public String[] currentToCanonicalPackageNames(String[] names) { throw new UnsupportedOperationException(); Loading Loading @@ -531,13 +524,6 @@ public class MockPackageManager extends PackageManager { 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) { Loading Loading @@ -643,15 +629,6 @@ public class MockPackageManager extends PackageManager { 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(); Loading Loading @@ -820,15 +797,6 @@ public class MockPackageManager extends PackageManager { 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(); Loading