DO NOT MERGE: adb: use asocket\\\\\\\'s close function when closing. am: 83cb3032d2 -s ours am: 420aa30c9f am: 05d5db2534 am: 8ec6f5b46f -s ours am: f5592e174e am: d99c745c31
am: 57b4b422e3
Change-Id: I14d98d1df800f6197c5eb28a45bd9fe259c844bf
diff --git a/adb/adb.cpp b/adb/adb.cpp
index f64b19f..c09aee3 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -919,7 +919,7 @@
if(!strncmp(service,"get-state",strlen("get-state"))) {
transport = acquire_one_transport(CS_ANY, ttype, serial, NULL);
SendOkay(reply_fd);
- SendProtocolString(reply_fd, transport->connection_state_name());
+ SendProtocolString(reply_fd, transport ? transport->connection_state_name() : "unknown");
return 0;
}
#endif // ADB_HOST
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index fd9953c..374a2e5 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -741,8 +741,10 @@
static int mkdirs(const char *path)
{
+ std::string holder(path);
+
int ret;
- char *x = (char *)path + 1;
+ char *x = &holder[1];
for(;;) {
x = adb_dirstart(x);
@@ -759,7 +761,7 @@
}
static int backup(int argc, const char** argv) {
- const char* filename = "./backup.ab";
+ const char* filename = "backup.ab";
/* find, extract, and use any -f argument */
for (int i = 1; i < argc; i++) {
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index ec7c4ae..dec690c 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -189,16 +189,26 @@
return load_fd(fd, _sz);
}
-int match_fastboot_with_serial(usb_ifc_info* info, const char* local_serial) {
- // Require a matching vendor id if the user specified one with -i.
- if (vendor_id != 0 && info->dev_vendor != vendor_id) {
- return -1;
- }
-
- if (info->ifc_class != 0xff || info->ifc_subclass != 0x42 || info->ifc_protocol != 0x03) {
- return -1;
- }
-
+int match_fastboot_with_serial(usb_ifc_info *info, const char *local_serial)
+{
+ if(!(vendor_id && (info->dev_vendor == vendor_id)) &&
+ (info->dev_vendor != 0x18d1) && // Google
+ (info->dev_vendor != 0x8087) && // Intel
+ (info->dev_vendor != 0x0451) &&
+ (info->dev_vendor != 0x0502) &&
+ (info->dev_vendor != 0x0fce) && // Sony Ericsson
+ (info->dev_vendor != 0x05c6) && // Qualcomm
+ (info->dev_vendor != 0x22b8) && // Motorola
+ (info->dev_vendor != 0x0955) && // Nvidia
+ (info->dev_vendor != 0x413c) && // DELL
+ (info->dev_vendor != 0x2314) && // INQ Mobile
+ (info->dev_vendor != 0x0b05) && // Asus
+ (info->dev_vendor != 0x0bb4) && // HTC
+ (info->dev_vendor != 0x07cf)) // CASIO
+ return -1;
+ if(info->ifc_class != 0xff) return -1;
+ if(info->ifc_subclass != 0x42) return -1;
+ if(info->ifc_protocol != 0x03) return -1;
// require matching serial number or device path if requested
// at the command line with the -s option.
if (local_serial && (strcmp(local_serial, info->serial_number) != 0 &&
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c
index 83222f4..70dc8c4 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.c
@@ -61,6 +61,7 @@
static int fg_cgroup_fd = -1;
// File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error
+static int system_bg_cpuset_fd = -1;
static int bg_cpuset_fd = -1;
static int fg_cpuset_fd = -1;
@@ -126,6 +127,8 @@
fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
filename = "/dev/cpuset/background/tasks";
bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
+ filename = "/dev/cpuset/system-background/tasks";
+ system_bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
}
#endif
@@ -260,6 +263,9 @@
case SP_AUDIO_SYS:
fd = fg_cpuset_fd;
break;
+ case SP_SYSTEM:
+ fd = system_bg_cpuset_fd;
+ break;
default:
fd = -1;
break;
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 70a75bd..52c7978 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -167,13 +167,19 @@
chown system system /dev/cpuset/foreground
chown system system /dev/cpuset/foreground/boost
chown system system /dev/cpuset/background
+ chown system system /dev/cpuset/system-background
chown system system /dev/cpuset/tasks
chown system system /dev/cpuset/foreground/tasks
chown system system /dev/cpuset/foreground/boost/tasks
chown system system /dev/cpuset/background/tasks
+ chown system system /dev/cpuset/system-background/tasks
+
+ # set system-background to 0775 so SurfaceFlinger can touch it
+ chmod 0775 /dev/cpuset/system-background
chmod 0664 /dev/cpuset/foreground/tasks
chmod 0664 /dev/cpuset/foreground/boost/tasks
chmod 0664 /dev/cpuset/background/tasks
+ chmod 0664 /dev/cpuset/system-background/tasks
chmod 0664 /dev/cpuset/tasks
@@ -648,7 +654,6 @@
user system
group graphics drmrpc
onrestart restart zygote
- writepid /dev/cpuset/system-background/tasks
service drm /system/bin/drmserver
class main
diff --git a/rootdir/init.trace.rc b/rootdir/init.trace.rc
index 50944e6..4933156 100644
--- a/rootdir/init.trace.rc
+++ b/rootdir/init.trace.rc
@@ -12,6 +12,7 @@
chown root shell /sys/kernel/debug/tracing/options/print-tgid
chown root shell /sys/kernel/debug/tracing/events/sched/sched_switch/enable
chown root shell /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
+ chown root shell /sys/kernel/debug/tracing/events/sched/sched_blocked_reason/enable
chown root shell /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
chown root shell /sys/kernel/debug/tracing/events/power/cpu_idle/enable
chown root shell /sys/kernel/debug/tracing/events/power/clock_set_rate/enable
@@ -24,6 +25,7 @@
chmod 0664 /sys/kernel/debug/tracing/options/print-tgid
chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_switch/enable
chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
+ chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_blocked_reason/enable
chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_idle/enable
chmod 0664 /sys/kernel/debug/tracing/events/power/clock_set_rate/enable
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index 123fce6..143ae89 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -1214,7 +1214,13 @@
}
out.fh = ptr_to_id(h);
out.open_flags = 0;
+
+#ifdef FUSE_STACKED_IO
+ out.lower_fd = h->fd;
+#else
out.padding = 0;
+#endif
+
fuse_reply(fuse, hdr->unique, &out, sizeof(out));
return NO_STATUS;
}
@@ -1378,7 +1384,13 @@
}
out.fh = ptr_to_id(h);
out.open_flags = 0;
+
+#ifdef FUSE_STACKED_IO
+ out.lower_fd = -1;
+#else
out.padding = 0;
+#endif
+
fuse_reply(fuse, hdr->unique, &out, sizeof(out));
return NO_STATUS;
}
@@ -1460,6 +1472,11 @@
out.major = FUSE_KERNEL_VERSION;
out.max_readahead = req->max_readahead;
out.flags = FUSE_ATOMIC_O_TRUNC | FUSE_BIG_WRITES;
+
+#ifdef FUSE_STACKED_IO
+ out.flags |= FUSE_STACKED_IO;
+#endif
+
out.max_background = 32;
out.congestion_threshold = 32;
out.max_write = MAX_WRITE;