Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c5f6dde authored by Suchi Amalapurapu's avatar Suchi Amalapurapu Committed by Android (Google) Code Review
Browse files

Merge "app install on sdcard. provide skeleton implementation to install an...

Merge "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"
parents 1061a4dd af8e9f48
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -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)) {
            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;
    }
+1 −0
Original line number Diff line number Diff line
@@ -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"
+4 −1
Original line number Diff line number Diff line
@@ -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.");
+18 −0
Original line number Diff line number Diff line
@@ -217,6 +217,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},
@@ -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;
    
+9 −0
Original line number Diff line number Diff line
@@ -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);

}
Loading