OSDN Git Service

AudioSystem: Add log for failed commands
authorMikhail Naganov <mnaganov@google.com>
Mon, 2 Apr 2018 17:35:45 +0000 (10:35 -0700)
committerMikhail Naganov <mnaganov@google.com>
Mon, 2 Apr 2018 18:17:49 +0000 (11:17 -0700)
Log if a remote call to the service has failed.  The log records
provide info about the calling function and the actual
status. This is useful for debugging from logs since not every
client logs an error, and that log will anyway lack the original
status code.

Test: make
Change-Id: I5a7ff1698f443d37c2d57e2dc3c2ec686debfdec

core/jni/android_media_AudioSystem.cpp

index adaff1f..ab5e15d 100644 (file)
@@ -269,8 +269,11 @@ static sp<JNIAudioPortCallback> setJniCallback(JNIEnv* env,
     return old;
 }
 
-static int check_AudioSystem_Command(status_t status)
+#define check_AudioSystem_Command(status) _check_AudioSystem_Command(__func__, (status))
+
+static int _check_AudioSystem_Command(const char* caller, status_t status)
 {
+    ALOGE_IF(status, "Command failed for %s: %d", caller, status);
     switch (status) {
     case DEAD_OBJECT:
         return kAudioStatusMediaServerDied;