Loading cmds/installd/commands.c +2 −2 Original line number Diff line number Diff line Loading @@ -205,14 +205,14 @@ int rm_dex(const char *path) } } int protect(char *pkgname, gid_t gid) int protect(char *pkgname, gid_t gid, int external) { struct stat s; char pkgpath[PKG_PATH_MAX]; if (gid < AID_SYSTEM) return -1; if (create_pkg_path(pkgpath, PROTECTED_DIR_PREFIX, pkgname, ".apk")) if (create_pkg_path(pkgpath, (external == 1 ? PROTECTED_EXT_DIR_PREFIX : PROTECTED_DIR_PREFIX), pkgname, ".apk")) return -1; if (stat(pkgpath, &s) < 0) return -1; Loading cmds/installd/installd.c +2 −2 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ static int do_rm_cache(char **arg, char reply[REPLY_MAX]) static int do_protect(char **arg, char reply[REPLY_MAX]) { return protect(arg[0], atoi(arg[1])); /* pkgname, gid */ return protect(arg[0], atoi(arg[1]), atoi(arg[2])); /* pkgname, gid */ } static int do_get_size(char **arg, char reply[REPLY_MAX]) Loading Loading @@ -102,7 +102,7 @@ struct cmdinfo cmds[] = { { "remove", 1, do_remove }, { "freecache", 1, do_free_cache }, { "rmcache", 1, do_rm_cache }, { "protect", 2, do_protect }, { "protect", 3, do_protect }, { "getsize", 3, do_get_size }, { "rmuserdata", 1, do_rm_user_data }, }; Loading cmds/installd/installd.h +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ int delete_user_data(const char *pkgname); int delete_cache(const char *pkgname); int move_dex(const char *src, const char *dst); int rm_dex(const char *path); int protect(char *pkgname, gid_t gid); int protect(char *pkgname, gid_t gid, int external); int get_size(const char *pkgname, const char *apkpath, const char *fwdlock_apkpath, int *codesize, int *datasize, int *cachesize); int free_cache(int free_size); Loading services/java/com/android/server/Installer.java +3 −1 Original line number Diff line number Diff line Loading @@ -239,12 +239,14 @@ class Installer { return execute(builder.toString()); } public int setForwardLockPerm(String packageName, int gid) { public int setForwardLockPerm(String packageName, int gid, boolean external) { StringBuilder builder = new StringBuilder("protect"); builder.append(' '); builder.append(packageName); builder.append(' '); builder.append(gid); builder.append(' '); builder.append(external ? "1" : "0"); return execute(builder.toString()); } Loading services/java/com/android/server/PackageManagerService.java +7 −7 Original line number Diff line number Diff line Loading @@ -1948,8 +1948,8 @@ class PackageManagerService extends IPackageManager.Stub { scanMode |= SCAN_FORWARD_LOCKED; } File resFile = destResourceFile; if (ps != null && (scanMode & SCAN_FORWARD_LOCKED) != 0) { resFile = getFwdLockedResource(ps.name); if (ps != null && ((scanMode & SCAN_FORWARD_LOCKED) != 0)) { resFile = getFwdLockedResource(ps.name, ps.codePath.getAbsolutePath()); } // Note that we invoke the following method only if we are about to unpack an application return scanPackageLI(scanFile, destCodeFile, resFile, Loading Loading @@ -3993,9 +3993,9 @@ class PackageManagerService extends IPackageManager.Stub { } } private File getFwdLockedResource(String pkgName) { private File getFwdLockedResource(String pkgName, String codePath) { final String publicZipFileName = pkgName + ".zip"; return new File(mAppInstallDir, publicZipFileName); return new File(codePath.startsWith(Environment.getSdExtDirectory().getAbsolutePath()) ? mSdExtInstallDir : mAppInstallDir, publicZipFileName); } private File copyTempInstallFile(Uri pPackageURI, Loading Loading @@ -4078,7 +4078,6 @@ class PackageManagerService extends IPackageManager.Stub { final String pkgFileName = pkgName + ".apk"; // determine the destination directory. // TODO: add support for app-private on /sd-ext File destDir = null; if ((pFlags&PackageManager.INSTALL_FORWARD_LOCK) != 0) { destDir = mExtInstall ? mDrmSdExtPrivateInstallDir : mDrmAppPrivateInstallDir; Loading @@ -4090,7 +4089,7 @@ class PackageManagerService extends IPackageManager.Stub { final String destFilePath = destPackageFile.getAbsolutePath(); File destResourceFile; if ((pFlags&PackageManager.INSTALL_FORWARD_LOCK) != 0) { destResourceFile = getFwdLockedResource(pkgName); destResourceFile = getFwdLockedResource(pkgName, destFilePath); forwardLocked = true; } else { destResourceFile = destPackageFile; Loading Loading @@ -4164,7 +4163,8 @@ class PackageManagerService extends IPackageManager.Stub { } if (mInstaller != null) { retCode = mInstaller.setForwardLockPerm(pkgName, newPackage.applicationInfo.uid); newPackage.applicationInfo.uid, destFilePath.startsWith(Environment.getSdExtDirectory().getAbsolutePath())); } else { final int filePermissions = FileUtils.S_IRUSR|FileUtils.S_IWUSR|FileUtils.S_IRGRP; Loading Loading
cmds/installd/commands.c +2 −2 Original line number Diff line number Diff line Loading @@ -205,14 +205,14 @@ int rm_dex(const char *path) } } int protect(char *pkgname, gid_t gid) int protect(char *pkgname, gid_t gid, int external) { struct stat s; char pkgpath[PKG_PATH_MAX]; if (gid < AID_SYSTEM) return -1; if (create_pkg_path(pkgpath, PROTECTED_DIR_PREFIX, pkgname, ".apk")) if (create_pkg_path(pkgpath, (external == 1 ? PROTECTED_EXT_DIR_PREFIX : PROTECTED_DIR_PREFIX), pkgname, ".apk")) return -1; if (stat(pkgpath, &s) < 0) return -1; Loading
cmds/installd/installd.c +2 −2 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ static int do_rm_cache(char **arg, char reply[REPLY_MAX]) static int do_protect(char **arg, char reply[REPLY_MAX]) { return protect(arg[0], atoi(arg[1])); /* pkgname, gid */ return protect(arg[0], atoi(arg[1]), atoi(arg[2])); /* pkgname, gid */ } static int do_get_size(char **arg, char reply[REPLY_MAX]) Loading Loading @@ -102,7 +102,7 @@ struct cmdinfo cmds[] = { { "remove", 1, do_remove }, { "freecache", 1, do_free_cache }, { "rmcache", 1, do_rm_cache }, { "protect", 2, do_protect }, { "protect", 3, do_protect }, { "getsize", 3, do_get_size }, { "rmuserdata", 1, do_rm_user_data }, }; Loading
cmds/installd/installd.h +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ int delete_user_data(const char *pkgname); int delete_cache(const char *pkgname); int move_dex(const char *src, const char *dst); int rm_dex(const char *path); int protect(char *pkgname, gid_t gid); int protect(char *pkgname, gid_t gid, int external); int get_size(const char *pkgname, const char *apkpath, const char *fwdlock_apkpath, int *codesize, int *datasize, int *cachesize); int free_cache(int free_size); Loading
services/java/com/android/server/Installer.java +3 −1 Original line number Diff line number Diff line Loading @@ -239,12 +239,14 @@ class Installer { return execute(builder.toString()); } public int setForwardLockPerm(String packageName, int gid) { public int setForwardLockPerm(String packageName, int gid, boolean external) { StringBuilder builder = new StringBuilder("protect"); builder.append(' '); builder.append(packageName); builder.append(' '); builder.append(gid); builder.append(' '); builder.append(external ? "1" : "0"); return execute(builder.toString()); } Loading
services/java/com/android/server/PackageManagerService.java +7 −7 Original line number Diff line number Diff line Loading @@ -1948,8 +1948,8 @@ class PackageManagerService extends IPackageManager.Stub { scanMode |= SCAN_FORWARD_LOCKED; } File resFile = destResourceFile; if (ps != null && (scanMode & SCAN_FORWARD_LOCKED) != 0) { resFile = getFwdLockedResource(ps.name); if (ps != null && ((scanMode & SCAN_FORWARD_LOCKED) != 0)) { resFile = getFwdLockedResource(ps.name, ps.codePath.getAbsolutePath()); } // Note that we invoke the following method only if we are about to unpack an application return scanPackageLI(scanFile, destCodeFile, resFile, Loading Loading @@ -3993,9 +3993,9 @@ class PackageManagerService extends IPackageManager.Stub { } } private File getFwdLockedResource(String pkgName) { private File getFwdLockedResource(String pkgName, String codePath) { final String publicZipFileName = pkgName + ".zip"; return new File(mAppInstallDir, publicZipFileName); return new File(codePath.startsWith(Environment.getSdExtDirectory().getAbsolutePath()) ? mSdExtInstallDir : mAppInstallDir, publicZipFileName); } private File copyTempInstallFile(Uri pPackageURI, Loading Loading @@ -4078,7 +4078,6 @@ class PackageManagerService extends IPackageManager.Stub { final String pkgFileName = pkgName + ".apk"; // determine the destination directory. // TODO: add support for app-private on /sd-ext File destDir = null; if ((pFlags&PackageManager.INSTALL_FORWARD_LOCK) != 0) { destDir = mExtInstall ? mDrmSdExtPrivateInstallDir : mDrmAppPrivateInstallDir; Loading @@ -4090,7 +4089,7 @@ class PackageManagerService extends IPackageManager.Stub { final String destFilePath = destPackageFile.getAbsolutePath(); File destResourceFile; if ((pFlags&PackageManager.INSTALL_FORWARD_LOCK) != 0) { destResourceFile = getFwdLockedResource(pkgName); destResourceFile = getFwdLockedResource(pkgName, destFilePath); forwardLocked = true; } else { destResourceFile = destPackageFile; Loading Loading @@ -4164,7 +4163,8 @@ class PackageManagerService extends IPackageManager.Stub { } if (mInstaller != null) { retCode = mInstaller.setForwardLockPerm(pkgName, newPackage.applicationInfo.uid); newPackage.applicationInfo.uid, destFilePath.startsWith(Environment.getSdExtDirectory().getAbsolutePath())); } else { final int filePermissions = FileUtils.S_IRUSR|FileUtils.S_IWUSR|FileUtils.S_IRGRP; Loading