Move starting window dim layers behind the activity window layers

- Currently, the dim layer is shown directly behind the requested window,
  which for translucent snapshot starting windows can cause the dim layer
  to show above the app window which is animating behind the starting
  window. Instead, when applying the dim layer to the starting window,
  override the layer to be behind the last window layer for the activity
  that the starting window represents.
- Also fix issue where the dim amount was not being copied for the snapshot
  starting window.

Bug: 63076430
Test: Launch assistant from Recents
Change-Id: I1f031e517a51ef7e1d6243b792c69997e10ea5b2
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
index a96d224..469dab4 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
@@ -20,6 +20,7 @@
 import static android.graphics.Color.alpha;
 import static android.view.SurfaceControl.HIDDEN;
 import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND;
 import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
 import static android.view.WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES;
 import static android.view.WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE;
@@ -159,6 +160,7 @@
             windowFlags = mainWindow.getAttrs().flags;
             windowPrivateFlags = mainWindow.getAttrs().privateFlags;
 
+            layoutParams.dimAmount = mainWindow.getAttrs().dimAmount;
             layoutParams.type = TYPE_APPLICATION_STARTING;
             layoutParams.format = snapshot.getSnapshot().getFormat();
             layoutParams.flags = (windowFlags & ~FLAG_INHERIT_EXCLUDES)