Merge "Allow IME snapshot to capture with secure layer for transition" into main
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index 57c7753..235deb2 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -232,8 +232,14 @@
         if (imeWindow != null && imeWindow.isVisible()) {
             final Rect bounds = imeWindow.getParentFrame();
             bounds.offsetTo(0, 0);
-            imeBuffer = ScreenCapture.captureLayersExcluding(imeWindow.getSurfaceControl(),
-                    bounds, 1.0f, pixelFormat, null);
+            ScreenCapture.LayerCaptureArgs captureArgs = new ScreenCapture.LayerCaptureArgs.Builder(
+                    imeWindow.getSurfaceControl())
+                    .setSourceCrop(bounds)
+                    .setFrameScale(1.0f)
+                    .setPixelFormat(pixelFormat)
+                    .setCaptureSecureLayers(true)
+                    .build();
+            imeBuffer = ScreenCapture.captureLayers(captureArgs);
         }
         return imeBuffer;
     }