Merge "Reorder BOOTCLASSPATH to match change 7eff81df2a"
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/include/netutils/ifc.h b/include/netutils/ifc.h
index 650d89d..36827ee 100644
--- a/include/netutils/ifc.h
+++ b/include/netutils/ifc.h
@@ -38,7 +38,8 @@
extern int ifc_get_addr(const char *name, in_addr_t *addr);
extern int ifc_set_addr(const char *name, in_addr_t addr);
-extern int ifc_set_mask(const char *name, in_addr_t mask);
+extern int ifc_get_prefixLength(const char *name, uint32_t *prefixLength);
+extern int ifc_set_prefixLength(const char *name, uint32_t prefixLength);
extern int ifc_set_hwaddr(const char *name, const void *ptr);
/* This function is deprecated. Use ifc_add_route instead. */
@@ -57,7 +58,7 @@
in_addr_t *flags);
extern int ifc_configure(const char *ifname, in_addr_t address,
- in_addr_t netmask, in_addr_t gateway,
+ uint32_t prefixLength, in_addr_t gateway,
in_addr_t dns1, in_addr_t dns2);
__END_DECLS
diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h
index 0f05a1b..3194bde 100644
--- a/include/private/android_filesystem_config.h
+++ b/include/private/android_filesystem_config.h
@@ -147,6 +147,8 @@
{ 00771, AID_SHELL, AID_SHELL, "data/local" },
{ 01771, AID_SYSTEM, AID_MISC, "data/misc" },
{ 00770, AID_DHCP, AID_DHCP, "data/misc/dhcp" },
+ { 00775, AID_MEDIA_RW, AID_MEDIA_RW, "data/media" },
+ { 00775, AID_MEDIA_RW, AID_MEDIA_RW, "data/media/Music" },
{ 00771, AID_SYSTEM, AID_SYSTEM, "data" },
{ 00750, AID_ROOT, AID_SHELL, "sbin" },
{ 00755, AID_ROOT, AID_SHELL, "system/bin" },
@@ -181,6 +183,7 @@
{ 00555, AID_ROOT, AID_ROOT, "system/etc/ppp/*" },
{ 00555, AID_ROOT, AID_ROOT, "system/etc/rc.*" },
{ 00644, AID_SYSTEM, AID_SYSTEM, "data/app/*" },
+ { 00644, AID_MEDIA_RW, AID_MEDIA_RW, "data/media/*" },
{ 00644, AID_SYSTEM, AID_SYSTEM, "data/app-private/*" },
{ 00644, AID_APP, AID_APP, "data/data/*" },
/* the following two files are INTENTIONALLY set-gid and not set-uid.
diff --git a/libnetutils/dhcpclient.c b/libnetutils/dhcpclient.c
index ff00432..5039e26 100644
--- a/libnetutils/dhcpclient.c
+++ b/libnetutils/dhcpclient.c
@@ -93,6 +93,8 @@
return inet_ntoa(in_addr);
}
+extern int ipv4NetmaskToPrefixLength(in_addr_t mask);
+
typedef struct dhcp_info dhcp_info;
struct dhcp_info {
@@ -100,7 +102,7 @@
uint32_t ipaddr;
uint32_t gateway;
- uint32_t netmask;
+ uint32_t prefixLength;
uint32_t dns1;
uint32_t dns2;
@@ -111,13 +113,13 @@
dhcp_info last_good_info;
-void get_dhcp_info(uint32_t *ipaddr, uint32_t *gateway, uint32_t *mask,
+void get_dhcp_info(uint32_t *ipaddr, uint32_t *gateway, uint32_t *prefixLength,
uint32_t *dns1, uint32_t *dns2, uint32_t *server,
uint32_t *lease)
{
*ipaddr = last_good_info.ipaddr;
*gateway = last_good_info.gateway;
- *mask = last_good_info.netmask;
+ *prefixLength = last_good_info.prefixLength;
*dns1 = last_good_info.dns1;
*dns2 = last_good_info.dns2;
*server = last_good_info.serveraddr;
@@ -127,7 +129,7 @@
static int dhcp_configure(const char *ifname, dhcp_info *info)
{
last_good_info = *info;
- return ifc_configure(ifname, info->ipaddr, info->netmask, info->gateway,
+ return ifc_configure(ifname, info->ipaddr, info->prefixLength, info->gateway,
info->dns1, info->dns2);
}
@@ -153,8 +155,7 @@
dhcp_type_to_name(info->type), info->type);
strcpy(addr, ipaddr(info->ipaddr));
strcpy(gway, ipaddr(info->gateway));
- strcpy(mask, ipaddr(info->netmask));
- LOGD("ip %s gw %s mask %s", addr, gway, mask);
+ LOGD("ip %s gw %s prefixLength %d", addr, gway, info->prefixLength);
if (info->dns1) LOGD("dns1: %s", ipaddr(info->dns1));
if (info->dns2) LOGD("dns2: %s", ipaddr(info->dns2));
LOGD("server %s, lease %d seconds",
@@ -196,7 +197,7 @@
}
switch(opt) {
case OPT_SUBNET_MASK:
- if (optlen >= 4) memcpy(&info->netmask, x, 4);
+ if (optlen >= 4) info->prefixLength = ipv4NetmaskToPrefixLength((int)x);
break;
case OPT_GATEWAY:
if (optlen >= 4) memcpy(&info->gateway, x, 4);
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
index 6788391..e5c58b9 100644
--- a/libnetutils/ifc_utils.c
+++ b/libnetutils/ifc_utils.c
@@ -51,6 +51,33 @@
static int ifc_ctl_sock6 = -1;
void printerr(char *fmt, ...);
+in_addr_t prefixLengthToIpv4Netmask(int prefix_length)
+{
+ in_addr_t mask = 0;
+
+ // C99 (6.5.7): shifts of 32 bits have undefined results
+ if (prefix_length <= 0 || prefix_length > 32) {
+ return 0;
+ }
+
+ mask = ~mask << (32 - prefix_length);
+ mask = htonl(mask);
+
+ return mask;
+}
+
+int ipv4NetmaskToPrefixLength(in_addr_t mask)
+{
+ mask = ntohl(mask);
+ int prefixLength = 0;
+ uint32_t m = (uint32_t)mask;
+ while (m & 0x80000000) {
+ prefixLength++;
+ m = m << 1;
+ }
+ return prefixLength;
+}
+
static const char *ipaddr_to_string(in_addr_t addr)
{
struct in_addr in_addr;
@@ -179,10 +206,13 @@
return ioctl(ifc_ctl_sock, SIOCSIFHWADDR, &ifr);
}
-int ifc_set_mask(const char *name, in_addr_t mask)
+int ifc_set_prefixLength(const char *name, int prefixLength)
{
struct ifreq ifr;
+ // TODO - support ipv6
+ if (prefixLength > 32 || prefixLength < 0) return -1;
+ in_addr_t mask = prefixLengthToIpv4Netmask(prefixLength);
ifc_init_ifr(name, &ifr);
init_sockaddr_in(&ifr.ifr_addr, mask);
@@ -206,7 +236,7 @@
return ret;
}
-int ifc_get_info(const char *name, in_addr_t *addr, in_addr_t *mask, unsigned *flags)
+int ifc_get_info(const char *name, in_addr_t *addr, int *prefixLength, unsigned *flags)
{
struct ifreq ifr;
ifc_init_ifr(name, &ifr);
@@ -219,11 +249,12 @@
}
}
- if (mask != NULL) {
+ if (prefixLength != NULL) {
if(ioctl(ifc_ctl_sock, SIOCGIFNETMASK, &ifr) < 0) {
- *mask = 0;
+ *prefixLength = 0;
} else {
- *mask = ((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr;
+ *prefixLength = ipv4NetmaskToPrefixLength((int)
+ ((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr);
}
}
@@ -238,21 +269,6 @@
return 0;
}
-in_addr_t get_ipv4_netmask(int prefix_length)
-{
- in_addr_t mask = 0;
-
- // C99 (6.5.7): shifts of 32 bits have undefined results
- if (prefix_length == 0) {
- return 0;
- }
-
- mask = ~mask << (32 - prefix_length);
- mask = htonl(mask);
-
- return mask;
-}
-
int ifc_add_ipv4_route(const char *ifname, struct in_addr dst, int prefix_length,
struct in_addr gw)
{
@@ -265,7 +281,7 @@
rt.rt_dst.sa_family = AF_INET;
rt.rt_dev = (void*) ifname;
- netmask = get_ipv4_netmask(prefix_length);
+ netmask = prefixLengthToIpv4Netmask(prefix_length);
init_sockaddr_in(&rt.rt_genmask, netmask);
init_sockaddr_in(&rt.rt_dst, dst.s_addr);
rt.rt_flags = RTF_UP;
@@ -499,7 +515,7 @@
int
ifc_configure(const char *ifname,
in_addr_t address,
- in_addr_t netmask,
+ uint32_t prefixLength,
in_addr_t gateway,
in_addr_t dns1,
in_addr_t dns2) {
@@ -518,8 +534,8 @@
ifc_close();
return -1;
}
- if (ifc_set_mask(ifname, netmask)) {
- printerr("failed to set netmask %s: %s\n", ipaddr_to_string(netmask), strerror(errno));
+ if (ifc_set_prefixLength(ifname, prefixLength)) {
+ printerr("failed to set prefixLength %d: %s\n", prefixLength, strerror(errno));
ifc_close();
return -1;
}
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 426d5bb..046ab3d 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