Merge "Add handling for DEVNAME for usb devices"
diff --git a/adb/adb.h b/adb/adb.h
index 85922bf..03a7393 100644
--- a/adb/adb.h
+++ b/adb/adb.h
@@ -86,6 +86,11 @@
*/
int closing;
+ /* flag: quit adbd when both ends close the
+ ** local service socket
+ */
+ int exit_on_close;
+
/* the asocket we are connected to
*/
diff --git a/adb/commandline.c b/adb/commandline.c
index 5b2aa88..7af8163 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -1575,7 +1575,7 @@
err = do_sync_push(apk_file, apk_dest, 1 /* verify APK */);
if (err) {
- return err;
+ goto cleanup_apk;
} else {
argv[file_arg] = apk_dest; /* destination name, not source location */
}
@@ -1591,11 +1591,11 @@
pm_command(transport, serial, argc, argv);
+cleanup_apk:
if (verification_file != NULL) {
delete_file(transport, serial, verification_dest);
}
-cleanup_apk:
delete_file(transport, serial, apk_dest);
return err;
diff --git a/adb/services.c b/adb/services.c
index 6940be8..495a083 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -125,12 +125,10 @@
return;
}
+ property_set("service.adb.root", "1");
snprintf(buf, sizeof(buf), "restarting adbd as root\n");
writex(fd, buf, strlen(buf));
adb_close(fd);
-
- // This will cause a property trigger in init.rc to restart us
- property_set("service.adb.root", "1");
}
}
@@ -152,10 +150,6 @@
snprintf(buf, sizeof(buf), "restarting in TCP mode port: %d\n", port);
writex(fd, buf, strlen(buf));
adb_close(fd);
-
- // quit, and init will restart us in TCP mode
- sleep(1);
- exit(1);
}
void restart_usb_service(int fd, void *cookie)
@@ -166,10 +160,6 @@
snprintf(buf, sizeof(buf), "restarting in USB mode\n");
writex(fd, buf, strlen(buf));
adb_close(fd);
-
- // quit, and init will restart us in USB mode
- sleep(1);
- exit(1);
}
void reboot_service(int fd, void *arg)
@@ -369,7 +359,6 @@
break;
}
}
- usleep(100000); // poll every 0.1 sec
}
D("shell exited fd=%d of pid=%d err=%d\n", fd, pid, errno);
if (SHELL_EXIT_NOTIFY_FD >=0) {
diff --git a/adb/sockets.c b/adb/sockets.c
index df223b1..ce3c65e 100644
--- a/adb/sockets.c
+++ b/adb/sockets.c
@@ -199,6 +199,8 @@
static void local_socket_destroy(asocket *s)
{
apacket *p, *n;
+ int exit_on_close = s->exit_on_close;
+
D("LS(%d): destroying fde.fd=%d\n", s->id, s->fde.fd);
/* IMPORTANT: the remove closes the fd
@@ -214,6 +216,11 @@
}
remove_socket(s);
free(s);
+
+ if (exit_on_close) {
+ D("local_socket_destroy: exiting\n");
+ exit(1);
+ }
}
@@ -418,6 +425,13 @@
s = create_local_socket(fd);
D("LS(%d): bound to '%s' via %d\n", s->id, name, fd);
+
+ if (!strcmp(name, "root:") || !strcmp(name, "usb:") ||
+ !strcmp(name, "tcpip:")) {
+ D("LS(%d): enabling exit_on_close\n", s->id);
+ s->exit_on_close = 1;
+ }
+
return s;
}
diff --git a/adb/usb_vendors.c b/adb/usb_vendors.c
index 5d8a831..a477e4e 100644
--- a/adb/usb_vendors.c
+++ b/adb/usb_vendors.c
@@ -117,8 +117,6 @@
#define VENDOR_ID_FUJITSU 0x04C5
// Lumigon's USB Vendor ID
#define VENDOR_ID_LUMIGON 0x25E3
-//Intel's USB Vendor ID
-#define VENDOR_ID_INTEL 0x8087
// Quanta's USB Vendor ID
#define VENDOR_ID_QUANTA 0x0408
// INQ Mobile's USB Vendor ID
@@ -169,7 +167,6 @@
VENDOR_ID_POSITIVO,
VENDOR_ID_FUJITSU,
VENDOR_ID_LUMIGON,
- VENDOR_ID_INTEL,
VENDOR_ID_QUANTA,
VENDOR_ID_INQ_MOBILE,
VENDOR_ID_SONY,
diff --git a/include/cutils/logger.h b/include/cutils/logger.h
index b60f7ad..04f3fb0 100644
--- a/include/cutils/logger.h
+++ b/include/cutils/logger.h
@@ -12,6 +12,11 @@
#include <stdint.h>
+/*
+ * The userspace structure for version 1 of the logger_entry ABI.
+ * This structure is returned to userspace by the kernel logger
+ * driver unless an upgrade to a newer ABI version is requested.
+ */
struct logger_entry {
uint16_t len; /* length of the payload */
uint16_t __pad; /* no matter what, we get 2 bytes of padding */
@@ -22,14 +27,41 @@
char msg[0]; /* the entry's payload */
};
+/*
+ * The userspace structure for version 2 of the logger_entry ABI.
+ * This structure is returned to userspace if ioctl(LOGGER_SET_VERSION)
+ * is called with version==2
+ */
+struct logger_entry_v2 {
+ uint16_t len; /* length of the payload */
+ uint16_t hdr_size; /* sizeof(struct logger_entry_v2) */
+ int32_t pid; /* generating process's pid */
+ int32_t tid; /* generating process's tid */
+ int32_t sec; /* seconds since Epoch */
+ int32_t nsec; /* nanoseconds */
+ uint32_t euid; /* effective UID of logger */
+ char msg[0]; /* the entry's payload */
+};
+
#define LOGGER_LOG_MAIN "log/main"
#define LOGGER_LOG_RADIO "log/radio"
#define LOGGER_LOG_EVENTS "log/events"
#define LOGGER_LOG_SYSTEM "log/system"
-#define LOGGER_ENTRY_MAX_LEN (4*1024)
-#define LOGGER_ENTRY_MAX_PAYLOAD \
- (LOGGER_ENTRY_MAX_LEN - sizeof(struct logger_entry))
+/*
+ * The maximum size of the log entry payload that can be
+ * written to the kernel logger driver. An attempt to write
+ * more than this amount to /dev/log/* will result in a
+ * truncated log entry.
+ */
+#define LOGGER_ENTRY_MAX_PAYLOAD 4076
+
+/*
+ * The maximum size of a log entry which can be read from the
+ * kernel logger driver. An attempt to read less than this amount
+ * may result in read() returning EINVAL.
+ */
+#define LOGGER_ENTRY_MAX_LEN (5*1024)
#ifdef HAVE_IOCTL
@@ -41,6 +73,8 @@
#define LOGGER_GET_LOG_LEN _IO(__LOGGERIO, 2) /* used log len */
#define LOGGER_GET_NEXT_ENTRY_LEN _IO(__LOGGERIO, 3) /* next entry len */
#define LOGGER_FLUSH_LOG _IO(__LOGGERIO, 4) /* flush log */
+#define LOGGER_GET_VERSION _IO(__LOGGERIO, 5) /* abi version */
+#define LOGGER_SET_VERSION _IO(__LOGGERIO, 6) /* abi version */
#endif // HAVE_IOCTL
diff --git a/include/system/audio_policy.h b/include/system/audio_policy.h
index 70fc534..641b177 100644
--- a/include/system/audio_policy.h
+++ b/include/system/audio_policy.h
@@ -43,10 +43,11 @@
AUDIO_POLICY_OUTPUT_FLAG_NONE = 0x0, // no attributes
AUDIO_POLICY_OUTPUT_FLAG_DIRECT = 0x1, // this output directly connects a track to one output
// stream (no software mixer)
- AUDIO_POLICY_OUTPUT_FLAG_PRIMARY = 0x2 // this output is the primary output of the device.
+ AUDIO_POLICY_OUTPUT_FLAG_PRIMARY = 0x2, // this output is the primary output of the device.
// it is unique and must be present. it is opened by
// default and receives routing, audio mode and
// volume controls related to voice calls.
+ AUDIO_POLICY_OUTPUT_FLAG_FAST = 0x4, // output supports "fast tracks", defined elsewhere
} audio_policy_output_flags_t;
/* device categories used for audio_policy->set_force_use() */
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 17374f0..8520854 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -379,18 +379,6 @@
on property:ro.kernel.qemu=1
start adbd
-# This property trigger has added to imitiate the previous behavior of "adb root".
-# The adb gadget driver used to reset the USB bus when the adbd daemon exited,
-# and the host side adb relied on this behavior to force it to reconnect with the
-# new adbd instance after init relaunches it. So now we force the USB bus to reset
-# here when adbd sets the service.adb.root property to 1. We also restart adbd here
-# rather than waiting for init to notice its death and restarting it so the timing
-# of USB resetting and adb restarting more closely matches the previous behavior.
-on property:service.adb.root=1
- write /sys/class/android_usb/android0/enable 0
- restart adbd
- write /sys/class/android_usb/android0/enable 1
-
service servicemanager /system/bin/servicemanager
class core
user system
@@ -438,7 +426,7 @@
service drm /system/bin/drmserver
class main
user drm
- group system inet drmrpc
+ group drm system inet drmrpc
service media /system/bin/mediaserver
class main