Miscellaneous cleanup

Abbreviation framesReady to fRdy for new systrace.
Put inline const on one line.
Use local copy of mState in state.
Improve logging.
Line length 100.

Change-Id: I8201c3ce0e53fd464fd33d02544e52c342d40b68
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 9d07ed5..db5a7ab 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -226,7 +226,7 @@
      * This includes the latency due to AudioTrack buffer size, AudioMixer (if any)
      * and audio hardware driver.
      */
-            uint32_t     latency() const    { return mLatency; }
+            uint32_t    latency() const     { return mLatency; }
 
     /* getters, see constructors and set() */
 
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 0a2b0b0..40ff1bf 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -47,9 +47,9 @@
     *frameCount = 0;
 
     size_t size = 0;
-    if (AudioSystem::getInputBufferSize(sampleRate, format, channelMask, &size)
-            != NO_ERROR) {
-        ALOGE("AudioSystem could not query the input buffer size.");
+    status_t status = AudioSystem::getInputBufferSize(sampleRate, format, channelMask, &size);
+    if (status != NO_ERROR) {
+        ALOGE("AudioSystem could not query the input buffer size; status %d", status);
         return NO_INIT;
     }
 
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index e81267f..b3de526 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -464,7 +464,7 @@
         PlaybackThread *thread = checkPlaybackThread_l(output);
         PlaybackThread *effectThread = NULL;
         if (thread == NULL) {
-            ALOGE("unknown output thread");
+            ALOGE("no playback thread found for output handle %d", output);
             lStatus = BAD_VALUE;
             goto Exit;
         }
@@ -589,7 +589,7 @@
     Mutex::Autolock _l(mLock);
     PlaybackThread *thread = checkPlaybackThread_l(output);
     if (thread == NULL) {
-        ALOGW("latency() unknown thread %d", output);
+        ALOGW("latency(): no playback thread found for output handle %d", output);
         return 0;
     }
     return thread->latency();
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index 2832e96..24a6dfe 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -388,9 +388,9 @@
                 if (ATRACE_ENABLED()) {
                     // I wish we had formatted trace names
                     char traceName[16];
-                    strcpy(traceName, "framesReady");
-                    traceName[11] = i + (i < 10 ? '0' : 'A' - 10);
-                    traceName[12] = '\0';
+                    strcpy(traceName, "fRdy");
+                    traceName[4] = i + (i < 10 ? '0' : 'A' - 10);
+                    traceName[5] = '\0';
                     ATRACE_INT(traceName, framesReady);
                 }
                 FastTrackDump *ftDump = &dumpState->mTracks[i];
diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h
index adec938..a749d7a 100644
--- a/services/audioflinger/PlaybackTracks.h
+++ b/services/audioflinger/PlaybackTracks.h
@@ -77,15 +77,9 @@
 
     virtual size_t framesReady() const;
 
-    bool isPausing() const {
-        return mState == PAUSING;
-    }
-    bool isPaused() const {
-        return mState == PAUSED;
-    }
-    bool isResuming() const {
-        return mState == RESUMING;
-    }
+    bool isPausing() const { return mState == PAUSING; }
+    bool isPaused() const { return mState == PAUSED; }
+    bool isResuming() const { return mState == RESUMING; }
     bool isReady() const;
     void setPaused() { mState = PAUSED; }
     void reset();
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index ec8ffa0..9d98f0b 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2795,7 +2795,7 @@
                 // No buffers for this track. Give it a few chances to
                 // fill a buffer, then remove it from active list.
                 if (--(track->mRetryCount) <= 0) {
-                    ALOGV("BUFFER TIMEOUT: remove(%d) from active list on thread %p", name, this);
+                    ALOGI("BUFFER TIMEOUT: remove(%d) from active list on thread %p", name, this);
                     tracksToRemove->add(track);
                     // indicate to client process that the track was disabled because of underrun;
                     // it will then automatically call start() when data is available
@@ -3725,7 +3725,8 @@
                                 readInto = mRsmpInBuffer;
                                 mRsmpInIndex = 0;
                             }
-                            mBytesRead = mInput->stream->read(mInput->stream, readInto, mInputBytes);
+                            mBytesRead = mInput->stream->read(mInput->stream, readInto,
+                                    mInputBytes);
                             if (mBytesRead <= 0) {
                                 if ((mBytesRead < 0) && (mActiveTrack->mState == TrackBase::ACTIVE))
                                 {
diff --git a/services/audioflinger/TrackBase.h b/services/audioflinger/TrackBase.h
index fecbfda..fac7071 100644
--- a/services/audioflinger/TrackBase.h
+++ b/services/audioflinger/TrackBase.h
@@ -68,9 +68,7 @@
     // but putting it in TrackBase avoids the complexity of virtual inheritance
     virtual size_t  framesReady() const { return SIZE_MAX; }
 
-    audio_format_t format() const {
-        return mFormat;
-    }
+    audio_format_t format() const { return mFormat; }
 
     uint32_t channelCount() const { return mChannelCount; }
 
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index b816338..a6ab4f8 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -607,7 +607,7 @@
         track_state state = mState;
         // here the track could be either new, or restarted
         // in both cases "unstop" the track
-        if (mState == PAUSED) {
+        if (state == PAUSED) {
             mState = TrackBase::RESUMING;
             ALOGV("PAUSED => RESUMING (%d) on thread %p", mName, this);
         } else {