App home directories are now 0700 for targetSdkVersion > 17

Have installd set an app's home directory permissions to
0700 if the app has targetSdkVersion > 17.

Bug: 7208882
Change-Id: Iaa4fc42fec69bc1abdfae53704d6264dd6fa965f
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 2285e79..bf21102 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -31,7 +31,11 @@
 
 static int do_install(char **arg, char reply[REPLY_MAX])
 {
-    return install(arg[0], atoi(arg[1]), atoi(arg[2])); /* pkgname, uid, gid */
+    bool restrictHomeDir = (strncmp(arg[3], "false", 6) != 0);
+    return install(arg[0],           /* pkgname */
+                   atoi(arg[1]),     /* uid */
+                   atoi(arg[2]),     /* gid */
+                   restrictHomeDir); /* restrictHomeDir */
 }
 
 static int do_dexopt(char **arg, char reply[REPLY_MAX])
@@ -103,7 +107,11 @@
 
 static int do_mk_user_data(char **arg, char reply[REPLY_MAX])
 {
-    return make_user_data(arg[0], atoi(arg[1]), atoi(arg[2])); /* pkgname, uid, userid */
+    bool restrictHomeDir = (strncmp(arg[3], "false", 6) != 0);
+    return make_user_data(arg[0],           /* pkgname */
+                          atoi(arg[1]),     /* uid */
+                          atoi(arg[2]),     /* userid */
+                          restrictHomeDir); /* restrictHomeDir */
 }
 
 static int do_rm_user(char **arg, char reply[REPLY_MAX])
@@ -129,7 +137,7 @@
 
 struct cmdinfo cmds[] = {
     { "ping",                 0, do_ping },
-    { "install",              3, do_install },
+    { "install",              4, do_install },
     { "dexopt",               3, do_dexopt },
     { "movedex",              2, do_move_dex },
     { "rmdex",                1, do_rm_dex },
@@ -142,7 +150,7 @@
     { "rmuserdata",           2, do_rm_user_data },
     { "movefiles",            0, do_movefiles },
     { "linklib",              3, do_linklib },
-    { "mkuserdata",           3, do_mk_user_data },
+    { "mkuserdata",           4, do_mk_user_data },
     { "rmuser",               1, do_rm_user },
 };