diff options
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/installd/commands.c | 12 | ||||
-rw-r--r-- | cmds/installd/installd.h | 1 | ||||
-rw-r--r-- | cmds/pm/src/com/android/commands/pm/Pm.java | 5 |
3 files changed, 14 insertions, 4 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c index dcae0c7..79bda74 100644 --- a/cmds/installd/commands.c +++ b/cmds/installd/commands.c @@ -218,14 +218,20 @@ int free_cache(int free_size) static int is_valid_apk_path(const char *path) { int len = strlen(APK_DIR_PREFIX); +int nosubdircheck = 0; if (strncmp(path, APK_DIR_PREFIX, len)) { len = strlen(PROTECTED_DIR_PREFIX); if (strncmp(path, PROTECTED_DIR_PREFIX, len)) { - LOGE("invalid apk path '%s' (bad prefix)\n", path); - return 0; + len = strlen(SDCARD_DIR_PREFIX); + if (strncmp(path, SDCARD_DIR_PREFIX, len)) { + LOGE("invalid apk path '%s' (bad prefix)\n", path); + return 0; + } else { + nosubdircheck = 1; + } } } - if (strchr(path + len, '/')) { + if ((nosubdircheck != 1) && strchr(path + len, '/')) { LOGE("invalid apk path '%s' (subdir?)\n", path); return 0; } diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h index 1679d14..35a173e 100644 --- a/cmds/installd/installd.h +++ b/cmds/installd/installd.h @@ -68,6 +68,7 @@ /* other handy constants */ #define PROTECTED_DIR_PREFIX "/data/app-private/" +#define SDCARD_DIR_PREFIX "/asec/" #define DALVIK_CACHE_PREFIX "/data/dalvik-cache/" #define DALVIK_CACHE_POSTFIX "/classes.dex" diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index 79eb310..4953f5d 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -594,6 +594,8 @@ public final class Pm { } } else if (opt.equals("-t")) { installFlags |= PackageManager.INSTALL_ALLOW_TEST; + } else if (opt.equals("-s")) { + installFlags |= PackageManager.INSTALL_ON_SDCARD; } else { System.err.println("Error: Unknown option: " + opt); showUsage(); @@ -822,7 +824,7 @@ public final class Pm { System.err.println(" pm list instrumentation [-f] [TARGET-PACKAGE]"); System.err.println(" pm list features"); System.err.println(" pm path PACKAGE"); - System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] PATH"); + System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] PATH"); System.err.println(" pm uninstall [-k] PACKAGE"); System.err.println(" pm enable PACKAGE_OR_COMPONENT"); System.err.println(" pm disable PACKAGE_OR_COMPONENT"); @@ -854,6 +856,7 @@ public final class Pm { System.err.println(" -r: reinstall an exisiting app, keeping its data."); System.err.println(" -t: allow test .apks to be installed."); System.err.println(" -i: specify the installer package name."); + System.err.println(" -s: install package on sdcard."); System.err.println(""); System.err.println("The uninstall command removes a package from the system. Options:"); System.err.println(" -k: keep the data and cache directories around."); |