Save window when an app died while it's visible

- If an app died visible, keep the dead window and leave it on screen.

- Apply 50% dim over the dead window to indicate it's no longer active.

- Monitor touch inputs on the dead window and restart the app on tap.

bug: 24913379
Change-Id: I911da4e6135f2bffaf3b1bbe6f911ff689a278ff
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index aca0f5b..eef8e17 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -670,7 +670,7 @@
                     handleNotObscuredLocked(w, innerDw, innerDh);
                 }
 
-                w.handleFlagDimBehind();
+                w.applyDimLayerIfNeeded();
 
                 if (isDefaultDisplay && obscuredChanged
                         && mWallpaperControllerLocked.isWallpaperTarget(w) && w.isVisibleLw()) {
@@ -781,7 +781,7 @@
                                         + " a=" + winAnimator.mAnimating);
                             }
                         }
-                        if (w != atoken.startingWindow) {
+                        if (w != atoken.startingWindow && !w.mAppDied) {
                             if (!atoken.mAppAnimator.freezingScreen || !w.mAppFreezing) {
                                 atoken.numInterestingWindows++;
                                 if (w.isDrawnLw()) {