Merge "soundpool: allocate shared memory heap by client" into klp-dev
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 5f36cab..b771e3b 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2115,6 +2115,8 @@
     // and then that string will be logged at the next convenient opportunity.
     const char *logString = NULL;
 
+    checkSilentMode_l();
+
     while (!exitPending())
     {
         cpuStats.sample(myName);
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp
index 0705791..a6c1083 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.cpp
+++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp
@@ -184,6 +184,7 @@
 
     // NOTE: Not scaled like FPS range values are.
     previewFps = fpsFromRange(previewFpsRange[0], previewFpsRange[1]);
+    lastSetPreviewFps = previewFps;
     params.set(CameraParameters::KEY_PREVIEW_FRAME_RATE,
             previewFps);
 
@@ -1152,6 +1153,12 @@
         validatedParams.previewFps =
             fpsFromRange(validatedParams.previewFpsRange[0],
                          validatedParams.previewFpsRange[1]);
+
+        // Update our last-seen single preview FPS, needed for disambiguating
+        // when the application is intending to use the deprecated single-FPS
+        // setting vs. the range FPS setting
+        validatedParams.lastSetPreviewFps = newParams.getPreviewFrameRate();
+
         newParams.setPreviewFrameRate(validatedParams.previewFps);
     }
 
@@ -1187,12 +1194,15 @@
         }
     }
 
-    // PREVIEW_FRAME_RATE
-    // Deprecated, only use if the preview fps range is unchanged this time.
-    // The single-value FPS is the same as the minimum of the range.
+    // PREVIEW_FRAME_RATE Deprecated, only use if the preview fps range is
+    // unchanged this time.  The single-value FPS is the same as the minimum of
+    // the range.  To detect whether the application has changed the value of
+    // previewFps, compare against their last-set preview FPS instead of the
+    // single FPS we may have synthesized from a range FPS set.
     if (!fpsRangeChanged) {
         validatedParams.previewFps = newParams.getPreviewFrameRate();
-        if (validatedParams.previewFps != previewFps || recordingHintChanged) {
+        if (validatedParams.previewFps != lastSetPreviewFps ||
+                recordingHintChanged) {
             camera_metadata_ro_entry_t availableFrameRates =
                 staticInfo(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
             /**
@@ -1263,7 +1273,10 @@
                 String8::format("%d,%d",
                         validatedParams.previewFpsRange[0] * kFpsToApiScale,
                         validatedParams.previewFpsRange[1] * kFpsToApiScale));
-
+        // Update our last-seen single preview FPS, needed for disambiguating
+        // when the application is intending to use the deprecated single-FPS
+        // setting vs. the range FPS setting
+        validatedParams.lastSetPreviewFps = validatedParams.previewFps;
     }
 
     // PICTURE_SIZE
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.h b/services/camera/libcameraservice/api1/client2/Parameters.h
index b9ca7bf..0505b0e 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.h
+++ b/services/camera/libcameraservice/api1/client2/Parameters.h
@@ -46,6 +46,7 @@
 
     int previewWidth, previewHeight;
     int32_t previewFpsRange[2];
+    int lastSetPreviewFps; // the last single FPS value seen in a set call
     int previewFps; // deprecated, here only for tracking changes
     int previewFormat;