resolved conflicts for merge of 9a7d11f0 to master

Change-Id: Ie4d101185a93d37ec280f608813ad62a077a584e
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 04f0564..8fedc7f 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1247,6 +1247,7 @@
 
     // check calling permissions
     if (!recordingAllowed()) {
+        ALOGE("openRecord() permission denied: recording not allowed");
         lStatus = PERMISSION_DENIED;
         goto Exit;
     }
@@ -1262,12 +1263,14 @@
         Mutex::Autolock _l(mLock);
         thread = checkRecordThread_l(input);
         if (thread == NULL) {
+            ALOGE("openRecord() checkRecordThread_l failed");
             lStatus = BAD_VALUE;
             goto Exit;
         }
 
         if (deviceRequiresCaptureAudioOutputPermission(thread->inDevice())
                 && !captureAudioOutputAllowed()) {
+            ALOGE("openRecord() permission denied: capture not allowed");
             lStatus = PERMISSION_DENIED;
             goto Exit;
         }
@@ -1288,6 +1291,7 @@
         // The record track uses one track in mHardwareMixerThread by convention.
         recordTrack = thread->createRecordTrack_l(client, sampleRate, format, channelMask,
                                                   frameCount, lSessionId, flags, tid, &lStatus);
+        LOG_ALWAYS_FATAL_IF((recordTrack != 0) != (lStatus == NO_ERROR));
     }
 
     if (lStatus != NO_ERROR) {
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index aaa9608..5e41dd2 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4607,7 +4607,7 @@
 
     lStatus = initCheck();
     if (lStatus != NO_ERROR) {
-        ALOGE("Audio driver not initialized.");
+        ALOGE("createRecordTrack_l() audio driver not initialized");
         goto Exit;
     }
     // client expresses a preference for FAST, but we get the final say
@@ -4671,6 +4671,7 @@
 
         lStatus = track->initCheck();
         if (lStatus != NO_ERROR) {
+            ALOGE("createRecordTrack_l() initCheck failed %d; no control block?", lStatus);
             track.clear();
             goto Exit;
         }