summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/pm
diff options
context:
space:
mode:
authorSuchi Amalapurapu <asuchitra@google.com>2010-01-12 10:17:28 -0800
committerSuchi Amalapurapu <asuchitra@google.com>2010-01-14 14:02:39 -0800
commitaf8e9f4805643f90a9dc0ecfa119e0a860c12f8a (patch)
treea6ea88a10b61204a5256901dca8b958849e13dc4 /core/java/android/content/pm
parentf6fff20a96268b0b1136a2c44199ad8de46ced5d (diff)
downloadframeworks_base-af8e9f4805643f90a9dc0ecfa119e0a860c12f8a.zip
frameworks_base-af8e9f4805643f90a9dc0ecfa119e0a860c12f8a.tar.gz
frameworks_base-af8e9f4805643f90a9dc0ecfa119e0a860c12f8a.tar.bz2
app install on sdcard. provide skeleton implementation
to install an app on sdcard, just resources. Add new install path for /asec in installd. ignore . when checking for apk path since the sdcard packages id'ed by package name. Add new -s option to adb shell pm Refactor fwd locked from scanMode to ApplicationInfo. Add new flag for sd install Add new parse flags for fwd locking and installing on sdcard New mock api's in PackageManagerService to invoke MountService api's. These will be refactored again and so have been wrapped internally. Some error codes in PackageManager Changes in PackageManagerService to use mPath and mScanPath during installation and switch to using PackageParser.Package.applicationInfo attributes for source and public resource directories. Some known issues that will be addressed later using system_uid for now. needs some tinkering with uid and packagesetting creation to use the actual app uid error handling from vold not very robust. ignoring lot of things for now sending a delayed destroy to delete packages. will revisit later revisit temp file creation later. just copy for now
Diffstat (limited to 'core/java/android/content/pm')
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java18
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl9
-rw-r--r--core/java/android/content/pm/PackageManager.java16
-rw-r--r--core/java/android/content/pm/PackageParser.java31
4 files changed, 63 insertions, 11 deletions
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 3dea286..b27cd6c 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -218,6 +218,22 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
public static final int FLAG_NEVER_ENCRYPT = 1<<17;
/**
+ * Value for {@link #flags}: Set to true if the application has been
+ * installed using the forward lock option.
+ *
+ * {@hide}
+ */
+ public static final int FLAG_FORWARD_LOCK = 1<<18;
+
+ /**
+ * Value for {@link #flags}: Set to true if the application is
+ * currently installed on the sdcard.
+ *
+ * {@hide}
+ */
+ public static final int FLAG_ON_SDCARD = 1<<19;
+
+ /**
* Flags associated with the application. Any combination of
* {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
* {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
@@ -227,6 +243,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
* {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
* {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_RESIZEABLE_FOR_SCREENS},
* {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}.
+ * {@link #FLAG_FWD_LOCKED},
+ * {@link #FLAG_ON_SDCARD}
*/
public int flags = 0;
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index fc6538f..54db5e0 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -296,4 +296,13 @@ interface IPackageManager {
* in the special development "no pre-dexopt" mode.
*/
boolean performDexOpt(String packageName);
+
+ /**
+ * Update status of external media on the package manager to scan and
+ * install packages installed on the external media. Like say the
+ * MountService uses this to call into the package manager to update
+ * status of sdcard.
+ */
+ void updateExternalMediaStatus(boolean mounted);
+
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 53a966d..bc59c94 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -252,6 +252,13 @@ public abstract class PackageManager {
public static final int INSTALL_ALLOW_TEST = 0x00000004;
/**
+ * Flag parameter for {@link #installPackage} to indicate that this
+ * package has to be installed on the sdcard.
+ * @hide
+ */
+ public static final int INSTALL_ON_SDCARD = 0x00000008;
+
+ /**
* Flag parameter for
* {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
* that you don't want to kill the app containing the component. Be careful when you set this
@@ -411,6 +418,15 @@ public abstract class PackageManager {
*/
public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
+ // ------ Errors related to sdcard
+ /**
+ * Installation return code: this is passed to the {@link IPackageInstallObserver} by
+ * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
+ * a secure container mount point couldn't be accessed on external media.
+ * @hide
+ */
+ public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
+
/**
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index ad99f54..8a5df32 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -327,16 +327,18 @@ public class PackageParser {
return null;
}
- public final static int PARSE_IS_SYSTEM = 0x0001;
- public final static int PARSE_CHATTY = 0x0002;
- public final static int PARSE_MUST_BE_APK = 0x0004;
- public final static int PARSE_IGNORE_PROCESSES = 0x0008;
+ public final static int PARSE_IS_SYSTEM = 1<<0;
+ public final static int PARSE_CHATTY = 1<<1;
+ public final static int PARSE_MUST_BE_APK = 1<<2;
+ public final static int PARSE_IGNORE_PROCESSES = 1<<3;
+ public final static int PARSE_FORWARD_LOCK = 1<<4;
+ public final static int PARSE_ON_SDCARD = 1<<5;
public int getParseError() {
return mParseError;
}
- public Package parsePackage(File sourceFile, String destFileName,
+ public Package parsePackage(File sourceFile, String destCodePath,
DisplayMetrics metrics, int flags) {
mParseError = PackageManager.INSTALL_SUCCEEDED;
@@ -413,8 +415,11 @@ public class PackageParser {
parser.close();
assmgr.close();
- pkg.applicationInfo.sourceDir = destFileName;
- pkg.applicationInfo.publicSourceDir = destFileName;
+ // Set code and resource paths
+ pkg.mPath = destCodePath;
+ pkg.mScanPath = mArchiveSourcePath;
+ //pkg.applicationInfo.sourceDir = destCodePath;
+ //pkg.applicationInfo.publicSourceDir = destRes;
pkg.mSignatures = null;
return pkg;
@@ -1369,6 +1374,14 @@ public class PackageParser {
}
}
+ if ((flags & PARSE_FORWARD_LOCK) != 0) {
+ ai.flags |= ApplicationInfo.FLAG_FORWARD_LOCK;
+ }
+
+ if ((flags & PARSE_ON_SDCARD) != 0) {
+ ai.flags |= ApplicationInfo.FLAG_ON_SDCARD;
+ }
+
if (sa.getBoolean(
com.android.internal.R.styleable.AndroidManifestApplication_debuggable,
false)) {
@@ -2530,10 +2543,6 @@ public class PackageParser {
// preferred up order.
public int mPreferredOrder = 0;
- // For use by package manager service to keep track of which apps
- // have been installed with forward locking.
- public boolean mForwardLocked;
-
// For use by the package manager to keep track of the path to the
// file an app came from.
public String mScanPath;