summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorJacek Surazski <jaceks@google.com>2009-04-28 15:26:38 +0200
committerJacek Surazski <jaceks@google.com>2009-05-12 23:16:20 +0200
commitc64322c35212e919906ffd66118c7d5d3ad36636 (patch)
tree846d1a95480c87f18975245ceea201535e23c553 /core/java/android/content
parent3e3439d5ba0cf5eda060c4991219c32af917fc5b (diff)
downloadframeworks_base-c64322c35212e919906ffd66118c7d5d3ad36636.zip
frameworks_base-c64322c35212e919906ffd66118c7d5d3ad36636.tar.gz
frameworks_base-c64322c35212e919906ffd66118c7d5d3ad36636.tar.bz2
PackageManager keeps track of who installed what.
Stores the package name of the installer app in packages.xml
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl7
-rw-r--r--core/java/android/content/pm/PackageManager.java42
2 files changed, 46 insertions, 3 deletions
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index d3f6f3c..c199619 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -139,8 +139,11 @@ interface IPackageManager {
* @param observer a callback to use to notify when the package installation in finished.
* @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
* {@link #REPLACE_EXISITING_PACKAGE}
+ * @param installerPackageName Optional package name of the application that is performing the
+ * installation. This identifies which market the package came from.
*/
- void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags);
+ void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
+ in String installerPackageName);
/**
* Delete a package.
@@ -151,6 +154,8 @@ interface IPackageManager {
*/
void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags);
+ String getInstallerPackageName(in String packageName);
+
void addPackageToPreferred(String packageName);
void removePackageFromPreferred(String packageName);
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index e2f0ce4..3695516 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1354,8 +1354,35 @@ public abstract class PackageManager {
*
* @see #installPackage(android.net.Uri)
*/
+ public void installPackage(
+ Uri packageURI, IPackageInstallObserver observer, int flags) {
+ installPackage(packageURI, observer, flags, null);
+ }
+
+ /**
+ * 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, if 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. observer may be null to indicate that no callback is desired.
+ * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
+ * {@link #REPLACE_EXISTING_PACKAGE}
+ * @param installerPackageName Optional package name of the application that is performing the
+ * installation. This identifies which market the package came from.
+ *
+ * @see #installPackage(android.net.Uri)
+ *
+ * @hide
+ */
public abstract void installPackage(
- Uri packageURI, IPackageInstallObserver observer, int flags);
+ Uri packageURI, IPackageInstallObserver observer, int flags,
+ String installerPackageName);
/**
* Attempts to delete a package. Since this may take a little while, the result will
@@ -1374,6 +1401,17 @@ public abstract class PackageManager {
*/
public abstract void deletePackage(
String packageName, IPackageDeleteObserver observer, int flags);
+
+ /**
+ * Retrieve the package name of the application that installed a package. This identifies
+ * which market the package came from.
+ *
+ * @param packageName The name of the package to query
+ *
+ * @hide
+ */
+ public abstract String getInstallerPackageName(String packageName);
+
/**
* Attempts to clear the user data directory of an application.
* Since this may take a little while, the result will
@@ -1483,7 +1521,7 @@ public abstract class PackageManager {
*
* @param packageURI The location of the package file to install
*
- * @see #installPackage(android.net.Uri, IPackageInstallObserver, int)
+ * @see #installPackage(android.net.Uri, IPackageInstallObserver, int, String)
*/
public void installPackage(Uri packageURI) {
installPackage(packageURI, null, 0);