Revert "DO NOT MERGE -- Revert the following two commits as they're causing flickering"

This reverts commit 44bd57ee25484bd74025c116f8a83d1df5990f34.

bug: 30831873
bug: 30790402
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index a9624cf..1f385df 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -17,7 +17,9 @@
 package com.android.server.wm;
 
 import static android.app.ActivityManager.StackId;
+import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
 import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
+import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
@@ -357,8 +359,14 @@
                 // placement for this window during this period, one or more frame will
                 // show up with wrong position or scale.
                 win.mWinAnimator.mAnimating = false;
+
+                if (win.mDestroying) {
+                    win.mDestroying = false;
+                    service.mDestroySurface.remove(win);
+                }
             }
         }
+        requestUpdateWallpaperIfNeeded();
     }
 
     void destroySurfaces() {
@@ -406,6 +414,9 @@
             if (displayContent != null && !displayList.contains(displayContent)) {
                 displayList.add(displayContent);
             }
+            if (cleanupOnResume) {
+                win.requestUpdateWallpaperIfNeeded();
+            }
             win.mDestroying = false;
         }
         for (int i = 0; i < displayList.size(); i++) {