Remove "protect" command from installd
No one uses the "protect" command anymore, so remove it from installd.
Change-Id: Ia990bae6f95cd6e317496f5dd173ec15164d7164
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 697d8ec..68f8400 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -403,37 +403,6 @@
}
}
-int protect(char *pkgname, gid_t gid)
-{
- struct stat s;
- char pkgpath[PKG_PATH_MAX];
-
- if (gid < AID_SYSTEM) return -1;
-
- if (create_pkg_path_in_dir(pkgpath, &android_app_private_dir, pkgname, ".apk"))
- return -1;
-
- if (stat(pkgpath, &s) < 0) return -1;
-
- if (chown(pkgpath, s.st_uid, gid) < 0) {
- ALOGE("failed to chgrp '%s': %s\n", pkgpath, strerror(errno));
- return -1;
- }
- if (chmod(pkgpath, S_IRUSR|S_IWUSR|S_IRGRP) < 0) {
- ALOGE("protect(): failed to chmod '%s': %s\n", pkgpath, strerror(errno));
- return -1;
- }
-
-#ifdef HAVE_SELINUX
- if (selinux_android_setfilecon(pkgpath, pkgname, s.st_uid) < 0) {
- ALOGE("cannot setfilecon dir '%s': %s\n", pkgpath, strerror(errno));
- return -1;
- }
-#endif
-
- return 0;
-}
-
int get_size(const char *pkgname, int persona, const char *apkpath,
const char *fwdlock_apkpath, const char *asecpath,
int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize,
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 652543fd..cc8f014 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -75,11 +75,6 @@
return delete_cache(arg[0]); /* pkgname */
}
-static int do_protect(char **arg, char reply[REPLY_MAX])
-{
- return protect(arg[0], atoi(arg[1])); /* pkgname, gid */
-}
-
static int do_get_size(char **arg, char reply[REPLY_MAX])
{
int64_t codesize = 0;
@@ -153,7 +148,6 @@
{ "fixuid", 3, do_fixuid },
{ "freecache", 1, do_free_cache },
{ "rmcache", 1, do_rm_cache },
- { "protect", 2, do_protect },
{ "getsize", 5, do_get_size },
{ "rmuserdata", 2, do_rm_user_data },
{ "movefiles", 0, do_movefiles },
diff --git a/services/java/com/android/server/pm/Installer.java b/services/java/com/android/server/pm/Installer.java
index d4fe3fb..3329acb 100644
--- a/services/java/com/android/server/pm/Installer.java
+++ b/services/java/com/android/server/pm/Installer.java
@@ -324,20 +324,6 @@
return execute(builder.toString());
}
- /*
- * @param packagePathSuffix The name of the path relative to install
- * directory. Say if the path name is /data/app/com.test-1.apk, the package
- * suffix path will be com.test-1
- */
- public int setForwardLockPerm(String packagePathSuffix, int gid) {
- StringBuilder builder = new StringBuilder("protect");
- builder.append(' ');
- builder.append(packagePathSuffix);
- builder.append(' ');
- builder.append(gid);
- return execute(builder.toString());
- }
-
public int getSizeInfo(String pkgName, int persona, String apkPath, String fwdLockApkPath,
String asecPath, PackageStats pStats) {
StringBuilder builder = new StringBuilder("getsize");