Merge "Add AID_SDCARD_R."
diff --git a/debuggerd/debuggerd.c b/debuggerd/debuggerd.c
index 0f05bfd..662683a 100644
--- a/debuggerd/debuggerd.c
+++ b/debuggerd/debuggerd.c
@@ -64,6 +64,7 @@
     case SIGBUS:     return "SIGBUS";
     case SIGFPE:     return "SIGFPE";
     case SIGSEGV:    return "SIGSEGV";
+    case SIGPIPE:    return "SIGPIPE";
     case SIGSTKFLT:  return "SIGSTKFLT";
     case SIGSTOP:    return "SIGSTOP";
     default:         return "?";
@@ -719,7 +720,8 @@
     request_t request;
     int status = read_request(fd, &request);
     if (!status) {
-        XLOG("BOOM: pid=%d uid=%d gid=%d tid=%d\n", pid, uid, gid, tid);
+        XLOG("BOOM: pid=%d uid=%d gid=%d tid=%d\n",
+            request.pid, request.uid, request.gid, request.tid);
 
         /* At this point, the thread that made the request is blocked in
          * a read() call.  If the thread has crashed, then this gives us
@@ -776,8 +778,16 @@
                     case SIGBUS:
                     case SIGFPE:
                     case SIGSEGV:
+                    case SIGPIPE:
                     case SIGSTKFLT: {
                         XLOG("stopped -- fatal signal\n");
+                        /*
+                         * Send a SIGSTOP to the process to make all of
+                         * the non-signaled threads stop moving.  Without
+                         * this we get a lot of "ptrace detach failed:
+                         * No such process".
+                         */
+                        kill(request.pid, SIGSTOP);
                         /* don't dump sibling threads when attaching to GDB because it
                          * makes the process less reliable, apparently... */
                         tombstone_path = engrave_tombstone(request.pid, request.tid,
@@ -861,8 +871,8 @@
     signal(SIGBUS, SIG_DFL);
     signal(SIGFPE, SIG_DFL);
     signal(SIGSEGV, SIG_DFL);
-    signal(SIGSTKFLT, SIG_DFL);
     signal(SIGPIPE, SIG_DFL);
+    signal(SIGSTKFLT, SIG_DFL);
 
     logsocket = socket_local_client("logd",
             ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_DGRAM);
diff --git a/include/system/audio_policy.h b/include/system/audio_policy.h
index d45758a..70fc534 100644
--- a/include/system/audio_policy.h
+++ b/include/system/audio_policy.h
@@ -30,12 +30,23 @@
  * frameworks/base/include/media/AudioSystem.h
  */
 
-/* request to open a direct output with get_output() (by opposition to
- * sharing an output with other AudioTracks)
+/* the audio output flags serve two purposes:
+ * - when an AudioTrack is created they indicate a "wish" to be connected to an output stream with
+ * attributes corresponding to the specified flags
+ * - when present in an output profile descriptor listed for a particular audio hardware module,
+ * they indicate that an output stream can be opened that supports the attributes indicated by
+ * the flags.
+ * the audio policy manager will try to match the flags in the request (when getOuput() is called)
+ * to an available output stream.
  */
 typedef enum {
-    AUDIO_POLICY_OUTPUT_FLAG_NONE = 0x0,
-    AUDIO_POLICY_OUTPUT_FLAG_DIRECT = 0x1
+    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.
+                                            // 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_flags_t;
 
 /* device categories used for audio_policy->set_force_use() */
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 7299513..2e8f7d2 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -162,7 +162,7 @@
     # 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