Merge "Stop using netmask in the framework"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index b84e1b65..8611d3b 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -47,3 +47,6 @@
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
+
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/init.rc)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/init.rc)
diff --git a/adb/adb.c b/adb/adb.c
index 679b086..f5e6e0c 100644
--- a/adb/adb.c
+++ b/adb/adb.c
@@ -682,9 +682,11 @@
dup2(fd, 1);
dup2(fd, 2);
fprintf(stderr,"--- adb starting (pid %d) ---\n", getpid());
+ adb_close(fd);
fd = unix_open("/dev/null", O_RDONLY);
dup2(fd, 0);
+ adb_close(fd);
}
#endif
diff --git a/adb/commandline.c b/adb/commandline.c
index 3600e5a..5ed1b52 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -683,6 +683,7 @@
char buf[4096];
int no_daemon = 0;
int is_daemon = 0;
+ int is_server = 0;
int persist = 0;
int r;
int quote;
@@ -719,7 +720,9 @@
/* modifiers and flags */
while(argc > 0) {
- if(!strcmp(argv[0],"nodaemon")) {
+ if(!strcmp(argv[0],"server")) {
+ is_server = 1;
+ } else if(!strcmp(argv[0],"nodaemon")) {
no_daemon = 1;
} else if (!strcmp(argv[0], "fork-server")) {
/* this is a special flag used only when the ADB client launches the ADB Server */
@@ -766,7 +769,7 @@
adb_set_transport(ttype, serial);
adb_set_tcp_specifics(server_port);
- if ((argc > 0) && (!strcmp(argv[0],"server"))) {
+ if (is_server) {
if (no_daemon || is_daemon) {
r = adb_main(is_daemon, server_port);
} else {
diff --git a/adb/jdwp_service.c b/adb/jdwp_service.c
index 296f718..cd62b55 100644
--- a/adb/jdwp_service.c
+++ b/adb/jdwp_service.c
@@ -499,6 +499,7 @@
/* only wait for incoming connections */
fdevent_add(control->fde, FDE_READ);
+ close_on_exec(s);
D("jdwp control socket started (%d)\n", control->listen_socket);
return 0;
diff --git a/adb/services.c b/adb/services.c
index 487c7d3..c22ce17 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -309,6 +309,7 @@
dup2(pts, 1);
dup2(pts, 2);
+ adb_close(pts);
adb_close(ptm);
execl(cmd, cmd, arg0, arg1, NULL);
diff --git a/adb/sysdeps.h b/adb/sysdeps.h
index 6372649..74f4ed1 100644
--- a/adb/sysdeps.h
+++ b/adb/sysdeps.h
@@ -387,7 +387,13 @@
static __inline__ int adb_socket_accept(int serverfd, struct sockaddr* addr, socklen_t *addrlen)
{
- return accept( serverfd, addr, addrlen );
+ int fd;
+
+ fd = accept(serverfd, addr, addrlen);
+ if (fd >= 0)
+ close_on_exec(fd);
+
+ return fd;
}
#undef accept
diff --git a/debuggerd/arm/machine.c b/debuggerd/arm/machine.c
index 4eb97a3..e765c3b 100644
--- a/debuggerd/arm/machine.c
+++ b/debuggerd/arm/machine.c
@@ -32,6 +32,7 @@
#include <cutils/properties.h>
#include <linux/input.h>
+#include <linux/user.h>
#include "utility.h"
diff --git a/debuggerd/symbol_table.c b/debuggerd/symbol_table.c
index fd008fe..23572a3 100644
--- a/debuggerd/symbol_table.c
+++ b/debuggerd/symbol_table.c
@@ -50,7 +50,7 @@
int length;
char *base;
- XLOG("Creating symbol table for %s\n", filename);
+ XLOG2("Creating symbol table for %s\n", filename);
int fd = open(filename, O_RDONLY);
if(fd < 0) {
@@ -126,7 +126,7 @@
dynsymbol_count++;
}
}
- XLOG("Dynamic Symbol count: %d\n", dynsymbol_count);
+ XLOG2("Dynamic Symbol count: %d\n", dynsymbol_count);
}
if (sym_idx != -1) {
@@ -139,7 +139,7 @@
symbol_count++;
}
}
- XLOG("Symbol count: %d\n", symbol_count);
+ XLOG2("Symbol count: %d\n", symbol_count);
}
// Now, create an entry in our symbol table structure for each symbol...
@@ -160,7 +160,7 @@
table->symbols[j].name = strdup(dynstr + dynsyms[i].st_name);
table->symbols[j].addr = dynsyms[i].st_value;
table->symbols[j].size = dynsyms[i].st_size;
- XLOG("name: %s, addr: %x, size: %x\n",
+ XLOG2("name: %s, addr: %x, size: %x\n",
table->symbols[j].name, table->symbols[j].addr, table->symbols[j].size);
j++;
}
@@ -176,7 +176,7 @@
table->symbols[j].name = strdup(str + syms[i].st_name);
table->symbols[j].addr = syms[i].st_value;
table->symbols[j].size = syms[i].st_size;
- XLOG("name: %s, addr: %x, size: %x\n",
+ XLOG2("name: %s, addr: %x, size: %x\n",
table->symbols[j].name, table->symbols[j].addr, table->symbols[j].size);
j++;
}
diff --git a/debuggerd/utility.h b/debuggerd/utility.h
index 0682b85..45e2067 100644
--- a/debuggerd/utility.h
+++ b/debuggerd/utility.h
@@ -57,10 +57,19 @@
extern void _LOG(int tfd, bool in_tombstone_only, const char *fmt, ...);
#define LOG(fmt...) _LOG(-1, 0, fmt)
+
+/* Set to 1 for normal debug traces */
#if 0
#define XLOG(fmt...) _LOG(-1, 0, fmt)
#else
#define XLOG(fmt...) do {} while(0)
#endif
+/* Set to 1 for chatty debug traces. Includes all resolved dynamic symbols */
+#if 0
+#define XLOG2(fmt...) _LOG(-1, 0, fmt)
+#else
+#define XLOG2(fmt...) do {} while(0)
+#endif
+
#endif
diff --git a/rootdir/init.rc b/rootdir/init.rc
index f6c1162..7f99ce7 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -178,8 +178,6 @@
# create directory for DRM plug-ins
mkdir /data/drm 0774 drm drm
- mkdir /data/drm/plugins 0774 drm drm
- mkdir /data/drm/plugins/native 0774 drm drm
# If there is no fs-post-data action in the init.<device>.rc file, you
# must uncomment this line, otherwise encrypted filesystems
@@ -210,15 +208,28 @@
# Define the memory thresholds at which the above process classes will
# be killed. These numbers are in pages (4k).
- setprop ro.FOREGROUND_APP_MEM 2048
- setprop ro.VISIBLE_APP_MEM 3072
- setprop ro.PERCEPTIBLE_APP_MEM 4096
- setprop ro.HEAVY_WEIGHT_APP_MEM 4096
- setprop ro.SECONDARY_SERVER_MEM 6144
- setprop ro.BACKUP_APP_MEM 6144
- setprop ro.HOME_APP_MEM 6144
- setprop ro.HIDDEN_APP_MEM 7168
- setprop ro.EMPTY_APP_MEM 8192
+ # These are currently tuned for tablets with approx 1GB RAM.
+ setprop ro.FOREGROUND_APP_MEM 8192
+ setprop ro.VISIBLE_APP_MEM 10240
+ setprop ro.PERCEPTIBLE_APP_MEM 12288
+ setprop ro.HEAVY_WEIGHT_APP_MEM 12288
+ setprop ro.SECONDARY_SERVER_MEM 14336
+ setprop ro.BACKUP_APP_MEM 14336
+ setprop ro.HOME_APP_MEM 14336
+ setprop ro.HIDDEN_APP_MEM 16384
+ setprop ro.EMPTY_APP_MEM 20480
+
+ # Old values for phones. Should probably be adjusted up for the next
+ # phone version.
+ #setprop ro.FOREGROUND_APP_MEM 2048
+ #setprop ro.VISIBLE_APP_MEM 3072
+ #setprop ro.PERCEPTIBLE_APP_MEM 4096
+ #setprop ro.HEAVY_WEIGHT_APP_MEM 4096
+ #setprop ro.SECONDARY_SERVER_MEM 6144
+ #setprop ro.BACKUP_APP_MEM 6144
+ #setprop ro.HOME_APP_MEM 6144
+ #setprop ro.HIDDEN_APP_MEM 7168
+ #setprop ro.EMPTY_APP_MEM 8192
# Write value must be consistent with the above properties.
# Note that the driver only supports 6 slots, so we have combined some of
@@ -228,7 +239,7 @@
write /proc/sys/vm/overcommit_memory 1
write /proc/sys/vm/min_free_order_shift 4
- write /sys/module/lowmemorykiller/parameters/minfree 2048,3072,4096,6144,7168,8192
+ write /sys/module/lowmemorykiller/parameters/minfree 8192,10240,12288,14336,16384,20480
# Set init its forked children's oom_adj.
write /proc/1/oom_adj -16