summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/pm
diff options
context:
space:
mode:
authorSuchi Amalapurapu <asuchitra@google.com>2010-02-19 09:19:34 -0800
committerSuchi Amalapurapu <asuchitra@google.com>2010-02-19 14:20:54 -0800
commit8946dd3355fc1dcbad872c0546e356474d4cc5de (patch)
tree8b614c938152df8ad809fd9bf03c6876c8a7a58e /core/java/android/content/pm
parenteac461cf7c246df737d2b0e7bd30be176a34c36e (diff)
downloadframeworks_base-8946dd3355fc1dcbad872c0546e356474d4cc5de.zip
frameworks_base-8946dd3355fc1dcbad872c0546e356474d4cc5de.tar.gz
frameworks_base-8946dd3355fc1dcbad872c0546e356474d4cc5de.tar.bz2
Move package from internal to external and vice versa.
Diffstat (limited to 'core/java/android/content/pm')
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl3
-rw-r--r--core/java/android/content/pm/IPackageMoveObserver.aidl27
-rw-r--r--core/java/android/content/pm/PackageManager.java82
3 files changed, 112 insertions, 0 deletions
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 47789a5..7a02a98 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -26,6 +26,7 @@ import android.content.pm.FeatureInfo;
import android.content.pm.IPackageInstallObserver;
import android.content.pm.IPackageDeleteObserver;
import android.content.pm.IPackageDataObserver;
+import android.content.pm.IPackageMoveObserver;
import android.content.pm.IPackageStatsObserver;
import android.content.pm.InstrumentationInfo;
import android.content.pm.PackageInfo;
@@ -309,4 +310,6 @@ interface IPackageManager {
void updateExternalMediaStatus(boolean mounted);
String nextPackageToClean(String lastPackage);
+
+ void movePackage(String packageName, IPackageMoveObserver observer, int flags);
}
diff --git a/core/java/android/content/pm/IPackageMoveObserver.aidl b/core/java/android/content/pm/IPackageMoveObserver.aidl
new file mode 100644
index 0000000..baa1595
--- /dev/null
+++ b/core/java/android/content/pm/IPackageMoveObserver.aidl
@@ -0,0 +1,27 @@
+/*
+**
+** Copyright 2007, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.content.pm;
+
+/**
+ * Callback for moving package resources from the Package Manager.
+ * @hide
+ */
+oneway interface IPackageMoveObserver {
+ void packageMoved(in String packageName, int returnCode);
+}
+
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 8576de2..2edb430 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -551,6 +551,69 @@ public abstract class PackageManager {
public static final int DONT_DELETE_DATA = 0x00000001;
/**
+ * Return code that is passed to the {@link IPackageMoveObserver} by
+ * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
+ * when the package has been successfully moved by the system.
+ * @hide
+ */
+ public static final int MOVE_SUCCEEDED = 1;
+ /**
+ * Error code that is passed to the {@link IPackageMoveObserver} by
+ * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
+ * when the package hasn't been successfully moved by the system
+ * because of insufficient memory on specified media.
+ * @hide
+ */
+ public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
+
+ /**
+ * Error code that is passed to the {@link IPackageMoveObserver} by
+ * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
+ * if the specified package doesn't exist.
+ * @hide
+ */
+ public static final int MOVE_FAILED_DOESNT_EXIST = -2;
+
+ /**
+ * Error code that is passed to the {@link IPackageMoveObserver} by
+ * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
+ * if the specified package cannot be moved since its a system package.
+ * @hide
+ */
+ public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
+
+ /**
+ * Error code that is passed to the {@link IPackageMoveObserver} by
+ * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
+ * if the specified package cannot be moved since its forward locked.
+ * @hide
+ */
+ public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
+
+ /**
+ * Error code that is passed to the {@link IPackageMoveObserver} by
+ * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
+ * if the specified package cannot be moved to the specified location.
+ * @hide
+ */
+ public static final int MOVE_FAILED_INVALID_LOCATION = -5;
+
+ /**
+ * Flag parameter for {@link #movePackage} to indicate that
+ * the package should be moved to internal storage if its
+ * been installed on external media.
+ * @hide
+ */
+ public static final int MOVE_INTERNAL = 0x00000001;
+
+ /**
+ * Flag parameter for {@link #movePackage} to indicate that
+ * the package should be moved to external media.
+ * @hide
+ */
+ public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
+
+ /**
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device has a camera facing away
* from the screen.
@@ -1922,4 +1985,23 @@ public abstract class PackageManager {
* Return whether the device has been booted into safe mode.
*/
public abstract boolean isSafeMode();
+
+ /**
+ * Attempts to move package resources from internal to external media or vice versa.
+ * Since this may take a little while, the result will
+ * be posted back to the given observer. This call may fail if the calling context
+ * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the
+ * named package cannot be found, or if the named package is a "system package".
+ *
+ * @param packageName The name of the package to delete
+ * @param observer An observer callback to get notified when the package move is
+ * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be
+ * called when that happens. observer may be null to indicate that no callback is desired.
+ * @param flags To indicate install location {@link #MOVE_INTERNAL} or
+ * {@link #MOVE_EXTERNAL_MEDIA}
+ *
+ * @hide
+ */
+ public abstract void movePackage(
+ String packageName, IPackageMoveObserver observer, int flags);
}