Permalink
Browse files

Merge branch 'ics' of git://github.com/CyanogenMod/android_system_core

  • Loading branch information...
2 parents 1bd61bd + 486e637 commit 6aec780297fd2ec3222c5ea34396c40759c31b21 @Arakmar Arakmar committed Apr 2, 2012
Showing with 189 additions and 10 deletions.
  1. +13 −0 adb/services.c
  2. +125 −0 adb/transport_local.c
  3. +18 −1 adb/usb_vendors.c
  4. +1 −0 fastboot/fastboot.c
  5. +4 −4 include/system/audio.h
  6. +14 −0 include/system/camera.h
  7. +6 −0 init/init.c
  8. +3 −1 init/property_service.c
  9. +4 −3 rootdir/init.rc
  10. +1 −1 rootdir/ueventd.rc
View
@@ -111,6 +111,8 @@ void restart_root_service(int fd, void *cookie)
{
char buf[100];
char value[PROPERTY_VALUE_MAX];
+ char build_type[PROPERTY_VALUE_MAX];
+ char cm_version[PROPERTY_VALUE_MAX];
if (getuid() == 0) {
snprintf(buf, sizeof(buf), "adbd is already running as root\n");
@@ -125,6 +127,17 @@ void restart_root_service(int fd, void *cookie)
return;
}
+ property_get("persist.sys.root_access", value, "1");
+ property_get("ro.build.type", build_type, "");
+ property_get("ro.cm.version", cm_version, "");
+
+ if (strlen(cm_version) > 0 && strcmp(build_type, "eng") != 0 && (atoi(value) & 2) != 2) {
+ snprintf(buf, sizeof(buf), "root access is disabled by system setting - enable in settings -> development options\n");
+ writex(fd, buf, strlen(buf));
+ adb_close(fd);
+ return;
+ }
+
snprintf(buf, sizeof(buf), "restarting adbd as root\n");
writex(fd, buf, strlen(buf));
adb_close(fd);
View
@@ -185,6 +185,117 @@ static void *server_socket_thread(void * arg)
return 0;
}
+/* This is relevant only for ADB daemon running inside the emulator. */
+#if !ADB_HOST
+/*
+ * Redefine open and write for qemu_pipe.h that contains inlined references
+ * to those routines. We will redifine them back after qemu_pipe.h inclusion.
+ */
+#undef open
+#undef write
+#define open adb_open
+#define write adb_write
+#include <hardware/qemu_pipe.h>
+#undef open
+#undef write
+#define open ___xxx_open
+#define write ___xxx_write
+
+/* A worker thread that monitors host connections, and registers a transport for
+ * every new host connection. This thread replaces server_socket_thread on
+ * condition that adbd daemon runs inside the emulator, and emulator uses QEMUD
+ * pipe to communicate with adbd daemon inside the guest. This is done in order
+ * to provide more robust communication channel between ADB host and guest. The
+ * main issue with server_socket_thread approach is that it runs on top of TCP,
+ * and thus is sensitive to network disruptions. For instance, the
+ * ConnectionManager may decide to reset all network connections, in which case
+ * the connection between ADB host and guest will be lost. To make ADB traffic
+ * independent from the network, we use here 'adb' QEMUD service to transfer data
+ * between the host, and the guest. See external/qemu/android/adb-*.* that
+ * implements the emulator's side of the protocol. Another advantage of using
+ * QEMUD approach is that ADB will be up much sooner, since it doesn't depend
+ * anymore on network being set up.
+ * The guest side of the protocol contains the following phases:
+ * - Connect with adb QEMUD service. In this phase a handle to 'adb' QEMUD service
+ * is opened, and it becomes clear whether or not emulator supports that
+ * protocol.
+ * - Wait for the ADB host to create connection with the guest. This is done by
+ * sending an 'accept' request to the adb QEMUD service, and waiting on
+ * response.
+ * - When new ADB host connection is accepted, the connection with adb QEMUD
+ * service is registered as the transport, and a 'start' request is sent to the
+ * adb QEMUD service, indicating that the guest is ready to receive messages.
+ * Note that the guest will ignore messages sent down from the emulator before
+ * the transport registration is completed. That's why we need to send the
+ * 'start' request after the transport is registered.
+ */
+static void *qemu_socket_thread(void * arg)
+{
+/* 'accept' request to the adb QEMUD service. */
+static const char _accept_req[] = "accept";
+/* 'start' request to the adb QEMUD service. */
+static const char _start_req[] = "start";
+/* 'ok' reply from the adb QEMUD service. */
+static const char _ok_resp[] = "ok";
+
+ const int port = (int)arg;
+ int res, fd;
+ char tmp[256];
+ char con_name[32];
+
+ D("transport: qemu_socket_thread() starting\n");
+
+ /* adb QEMUD service connection request. */
+ snprintf(con_name, sizeof(con_name), "qemud:adb:%d", port);
+
+ /* Connect to the adb QEMUD service. */
+ fd = qemu_pipe_open(con_name);
+ if (fd < 0) {
+ /* This could be an older version of the emulator, that doesn't
+ * implement adb QEMUD service. Fall back to the old TCP way. */
+ adb_thread_t thr;
+ D("adb service is not available. Falling back to TCP socket.\n");
+ adb_thread_create(&thr, server_socket_thread, arg);
+ return 0;
+ }
+
+ for(;;) {
+ /*
+ * Wait till the host creates a new connection.
+ */
+
+ /* Send the 'accept' request. */
+ res = adb_write(fd, _accept_req, strlen(_accept_req));
+ if (res == strlen(_accept_req)) {
+ /* Wait for the response. In the response we expect 'ok' on success,
+ * or 'ko' on failure. */
+ res = adb_read(fd, tmp, sizeof(tmp));
+ if (res != 2 || memcmp(tmp, _ok_resp, 2)) {
+ D("Accepting ADB host connection has failed.\n");
+ adb_close(fd);
+ } else {
+ /* Host is connected. Register the transport, and start the
+ * exchange. */
+ register_socket_transport(fd, "host", port, 1);
+ adb_write(fd, _start_req, strlen(_start_req));
+ }
+
+ /* Prepare for accepting of the next ADB host connection. */
+ fd = qemu_pipe_open(con_name);
+ if (fd < 0) {
+ D("adb service become unavailable.\n");
+ return 0;
+ }
+ } else {
+ D("Unable to send the '%s' request to ADB service.\n", _accept_req);
+ return 0;
+ }
+ }
+ D("transport: qemu_socket_thread() exiting\n");
+ return 0;
+}
+#endif // !ADB_HOST
+
void local_init(int port)
{
adb_thread_t thr;
@@ -193,7 +304,21 @@ void local_init(int port)
if(HOST) {
func = client_socket_thread;
} else {
+#if ADB_HOST
func = server_socket_thread;
+#else
+ /* For the adbd daemon in the system image we need to distinguish
+ * between the device, and the emulator. */
+ char is_qemu[PROPERTY_VALUE_MAX];
+ property_get("ro.kernel.qemu", is_qemu, "");
+ if (!strcmp(is_qemu, "1")) {
+ /* Running inside the emulator: use QEMUD pipe as the transport. */
+ func = qemu_socket_thread;
+ } else {
+ /* Running inside the device: use TCP socket as the transport. */
+ func = server_socket_thread;
+ }
+#endif !ADB_HOST
}
D("transport: local %s init\n", HOST ? "client" : "server");
View
@@ -111,7 +111,18 @@
#define VENDOR_ID_ARCHOS 0x0E79
// Positivo's USB Vendor ID
#define VENDOR_ID_POSITIVO 0x1662
-
+// Fujitsu's USB Vendor ID
+#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
+#define VENDOR_ID_INQ_MOBILE 0x2314
+// Sony's USB Vendor ID
+#define VENDOR_ID_SONY 0x054C
/** built-in vendor list */
int builtInVendorIds[] = {
@@ -153,6 +164,12 @@ int builtInVendorIds[] = {
VENDOR_ID_PEGATRON,
VENDOR_ID_ARCHOS,
VENDOR_ID_POSITIVO,
+ VENDOR_ID_FUJITSU,
+ VENDOR_ID_LUMIGON,
+ VENDOR_ID_INTEL,
+ VENDOR_ID_QUANTA,
+ VENDOR_ID_INQ_MOBILE,
+ VENDOR_ID_SONY,
};
#define BUILT_IN_VENDOR_COUNT (sizeof(builtInVendorIds)/sizeof(builtInVendorIds[0]))
View
@@ -157,6 +157,7 @@ int match_fastboot(usb_ifc_info *info)
(info->dev_vendor != 0x22b8) && // Motorola
(info->dev_vendor != 0x0955) && // Nvidia
(info->dev_vendor != 0x413c) && // DELL
+ (info->dev_vendor != 0x2314) && // INQ Mobile
(info->dev_vendor != 0x0bb4)) // HTC
return -1;
if(info->ifc_class != 0xff) return -1;
View
@@ -298,7 +298,7 @@ typedef enum {
AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800,
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000,
AUDIO_DEVICE_OUT_FM = 0x2000,
-#ifdef QCOM_HARDWARE
+#if defined(QCOM_HARDWARE) && !defined(USES_AUDIO_LEGACY)
AUDIO_DEVICE_OUT_ANC_HEADSET = 0x4000,
AUDIO_DEVICE_OUT_ANC_HEADPHONE = 0x8000,
AUDIO_DEVICE_OUT_FM_TX = 0x10000,
@@ -320,7 +320,7 @@ typedef enum {
AUDIO_DEVICE_OUT_AUX_DIGITAL |
AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET |
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET |
-#ifdef QCOM_HARDWARE
+#if defined(QCOM_HARDWARE) && !defined(USES_AUDIO_LEGACY)
AUDIO_DEVICE_OUT_FM |
AUDIO_DEVICE_OUT_ANC_HEADSET |
AUDIO_DEVICE_OUT_ANC_HEADPHONE |
@@ -336,7 +336,7 @@ typedef enum {
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT),
/* input devices */
-#ifdef QCOM_HARDWARE
+#if defined(QCOM_HARDWARE) && !defined(USES_AUDIO_LEGACY)
AUDIO_DEVICE_IN_COMMUNICATION = 0x100000,
AUDIO_DEVICE_IN_AMBIENT = 0x200000,
AUDIO_DEVICE_IN_BUILTIN_MIC = 0x400000,
@@ -368,7 +368,7 @@ typedef enum {
AUDIO_DEVICE_IN_AUX_DIGITAL |
AUDIO_DEVICE_IN_VOICE_CALL |
AUDIO_DEVICE_IN_BACK_MIC |
-#ifdef QCOM_HARDWARE
+#if defined(QCOM_HARDWARE) && !defined(USES_AUDIO_LEGACY)
AUDIO_DEVICE_IN_ANC_HEADSET |
AUDIO_DEVICE_IN_FM_RX |
AUDIO_DEVICE_IN_FM_RX_A2DP |
View
@@ -85,6 +85,8 @@ enum {
// request FRAME and METADATA. Or the apps can request only FRAME or only
// METADATA.
CAMERA_MSG_PREVIEW_METADATA = 0x0400, // dataCallback
+ CAMERA_MSG_STATS_DATA = 0x800,
+
CAMERA_MSG_ALL_MSGS = 0xFFFF
};
@@ -142,6 +144,11 @@ enum {
* Stop the face detection.
*/
CAMERA_CMD_STOP_FACE_DETECTION = 7,
+
+ CAMERA_CMD_HISTOGRAM_ON = 8,
+ CAMERA_CMD_HISTOGRAM_OFF = 9,
+ CAMERA_CMD_HISTOGRAM_SEND_DATA = 10,
+
};
/** camera fatal errors */
@@ -158,6 +165,13 @@ enum {
};
enum {
+ CAMERA_SUPPORT_MODE_2D = 0x01, /* Camera Sensor supports 2D mode. */
+ CAMERA_SUPPORT_MODE_3D = 0x02, /* Camera Sensor supports 3D mode. */
+ CAMERA_SUPPORT_MODE_NONZSL = 0x04, /* Camera Sensor in NON-ZSL mode. */
+ CAMERA_SUPPORT_MODE_ZSL = 0x08 /* Camera Sensor supports ZSL mode. */
+};
+
+enum {
/** Hardware face detection. It does not use much CPU. */
CAMERA_FACE_DETECTION_HW = 0,
/**
View
@@ -66,6 +66,7 @@ static char baseband[32];
static char carrier[32];
static char bootloader[32];
static char hardware[32];
+static char modelno[32];
static unsigned revision = 0;
static char qemu[32];
@@ -479,6 +480,8 @@ static void import_kernel_nv(char *name, int in_qemu)
if (!strcmp(value,"true")) {
emmc_boot = 1;
}
+ } else if (!strcmp(name,"androidboot.modelno")) {
+ strlcpy(modelno, value, sizeof(modelno));
}
} else {
/* in the emulator, export any kernel option with the
@@ -628,6 +631,9 @@ static int set_init_properties_action(int nargs, char **args)
property_set("ro.carrier", carrier[0] ? carrier : "unknown");
property_set("ro.bootloader", bootloader[0] ? bootloader : "unknown");
+ if (modelno[0])
+ property_set("ro.boot.modelno", modelno);
+
property_set("ro.hardware", hardware);
snprintf(tmp, PROP_VALUE_MAX, "%d", revision);
property_set("ro.revision", tmp);
View
@@ -75,6 +75,7 @@ struct {
{ "hw.", AID_SYSTEM, 0 },
{ "sys.", AID_SYSTEM, 0 },
{ "service.", AID_SYSTEM, 0 },
+ { "service.", AID_RADIO, 0 },
{ "wlan.", AID_SYSTEM, 0 },
{ "dhcp.", AID_SYSTEM, 0 },
{ "dhcp.", AID_DHCP, 0 },
@@ -84,7 +85,8 @@ struct {
{ "service.adb.tcp.port", AID_SHELL, 0 },
{ "persist.sys.", AID_SYSTEM, 0 },
{ "persist.service.", AID_SYSTEM, 0 },
- { "persist.security.", AID_SYSTEM, 0 },
+ { "persist.service.", AID_RADIO, 0 },
+ { "persist.security.",AID_SYSTEM, 0 },
{ "net.pdp0", AID_RADIO, AID_RADIO },
{ "net.pdp1", AID_RADIO, AID_RADIO },
{ "net.pdp2", AID_RADIO, AID_RADIO },
View
@@ -158,7 +158,7 @@ on post-fs-data
# give system access to wpa_supplicant.conf for backup and restore
mkdir /data/misc/wifi 0770 wifi wifi
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
- mkdir /data/local 0771 shell shell
+ mkdir /data/local 0751 root root
mkdir /data/local/tmp 0771 shell shell
mkdir /data/data 0771 system system
mkdir /data/app-private 0771 system system
@@ -182,8 +182,9 @@ on post-fs-data
# create the lost+found directories, so as to enforce our permissions
mkdir /data/lost+found 0770 root root
- # create directory for DRM plug-ins
- mkdir /data/drm 0774 drm drm
+ # create directory for DRM plug-ins - give drm the read/write access to
+ # the following directory.
+ mkdir /data/drm 0770 drm drm
# If there is no fs-post-data action in the init.<device>.rc file, you
# must uncomment this line, otherwise encrypted filesystems
View
@@ -38,7 +38,7 @@
/dev/adsp/* 0660 system audio
/dev/snd/* 0660 system audio
/dev/mt9t013 0660 system system
-/dev/msm_camera/* 0660 system system
+/dev/msm_camera/* 0660 system camera
/dev/akm8976_daemon 0640 compass system
/dev/akm8976_aot 0640 compass system
/dev/akm8973_daemon 0640 compass system

0 comments on commit 6aec780

Please sign in to comment.