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

Commit 0c191624 authored by Kenny Root's avatar Kenny Root
Browse files

Remove "protect" command from installd

No one uses the "protect" command anymore, so remove it from installd.

Change-Id: Ia990bae6f95cd6e317496f5dd173ec15164d7164
parent add52a97
Loading
Loading
Loading
Loading
+0 −31
Original line number Diff line number Diff line
@@ -403,37 +403,6 @@ int rm_dex(const char *path)
    }
}

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,
+0 −6
Original line number Diff line number Diff line
@@ -75,11 +75,6 @@ static int do_rm_cache(char **arg, char reply[REPLY_MAX])
    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 @@ struct cmdinfo cmds[] = {
    { "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 },
+0 −14
Original line number Diff line number Diff line
@@ -324,20 +324,6 @@ class Installer {
        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");