SF: Apply color matrix to newly connected displays

When a transaction adds/changes/removes displays, set the global color
matrix on CompositionRefreshArgs so it gets applied to new displays on
the next composite.

Fixes: 321965883
Test: Connect external display while colors are inverted.
Test: ColorMatrixTest
Change-Id: I34af02d491243e06e6ba0cec1c9f044a2eb5a49d
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index d86de84..8512219 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3775,6 +3775,9 @@
         mVisibleRegionsDirty = true;
         mUpdateInputInfo = true;
 
+        // Apply the current color matrix to any added or changed display.
+        mCurrentState.colorMatrixChanged = true;
+
         // find the displays that were removed
         // (ie: in drawing state but not in current state)
         // also handle displays that changed
@@ -4273,7 +4276,6 @@
     }
 
     mDrawingState = mCurrentState;
-    // clear the "changed" flags in current state
     mCurrentState.colorMatrixChanged = false;
 
     if (mVisibleRegionsDirty) {