Fix locking for mMasterVolume and mMute

mMasterVolume and mMute are both protected by mutex in AudioFlinger class, but
there were two places where they were accessed without a mutex.

Also make AudioFlinger::mMasterMute private not protected.

Change-Id: Ia3897daeb5c50313df5bcc071824357526237f3e
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 9fb666e..d267497 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -646,12 +646,14 @@
 
 float AudioFlinger::masterVolume() const
 {
-    return mMasterVolume;
+    Mutex::Autolock _l(mLock);
+    return masterVolume_l();
 }
 
 bool AudioFlinger::masterMute() const
 {
-    return mMasterMute;
+    Mutex::Autolock _l(mLock);
+    return masterMute_l();
 }
 
 status_t AudioFlinger::setStreamVolume(int stream, float value, int output)
@@ -1379,8 +1381,10 @@
 
     readOutputParameters();
 
-    mMasterVolume = mAudioFlinger->masterVolume();
-    mMasterMute = mAudioFlinger->masterMute();
+    // Assumes constructor is called by AudioFlinger with it's mLock held,
+    // but it would be safer to explicitly pass these as parameters
+    mMasterVolume = mAudioFlinger->masterVolume_l();
+    mMasterMute = mAudioFlinger->masterMute_l();
 
     for (int stream = 0; stream < AUDIO_STREAM_CNT; stream++) {
         mStreamTypes[stream].volume = mAudioFlinger->streamVolumeInternal(stream);