Return correct config from getActiveConfig()

In Android Q we made changing the active display config via
setActiveConfig() or setAllowedDisplayConfigs() a non-blocking call, but
we didn't update getActiveConfig() to account for this, which made it
possible for clients to call setActiveConfig() followed by
getActiveConfig() and get the previous config value back, instead of the
value the client just set.

Make getActiveConfig() first check to see if a config change is pending,
and if so, return the pending value instead of the current value.

Bug: 139392135

Test: Ran with some extra logs, confirmed we now return the pending
value (when we have one) from getActiveConfig().

Change-Id: I7665fd1f29073b2a3f5414defef0103270bf1f9f
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index c01d3aa..604b290 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -871,7 +871,16 @@
         return BAD_VALUE;
     }
 
-    return display->getActiveConfig();
+    if (display->isPrimary()) {
+        std::lock_guard<std::mutex> lock(mActiveConfigLock);
+        if (mDesiredActiveConfigChanged) {
+            return mDesiredActiveConfig.configId;
+        } else {
+            return display->getActiveConfig();
+        }
+    } else {
+        return display->getActiveConfig();
+    }
 }
 
 void SurfaceFlinger::setDesiredActiveConfig(const ActiveConfigInfo& info) {