Merge "Fix recents crashing during docked stack resize."
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 4b8efab..9f24de8 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -3956,13 +3956,12 @@
                 }
                 IBinder wtoken = v.getWindowToken();
                 if (r.activity.mWindowAdded) {
-                    boolean reuseForResize = r.window.hasNonClientDecorView() && r.mPreserveWindow;
-                    if (r.onlyLocalRequest || reuseForResize) {
+                    if (r.onlyLocalRequest || r.mPreserveWindow) {
                         // Hold off on removing this until the new activity's
                         // window is being added.
                         r.mPendingRemoveWindow = r.window;
                         r.mPendingRemoveWindowManager = wm;
-                        if (reuseForResize) {
+                        if (r.mPreserveWindow) {
                             // We can only keep the part of the view hierarchy that we control,
                             // everything else must be removed, because it might not be able to
                             // behave properly when activity is relaunching.
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 5f4e7af..13544851 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -28,9 +28,8 @@
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
 import android.graphics.PixelFormat;
-import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
 import android.media.session.MediaController;
 import android.net.Uri;
 import android.os.Bundle;
@@ -2007,16 +2006,6 @@
      */
     public abstract void setNavigationBarColor(@ColorInt int color);
 
-    /**
-     * Get information whether the activity has non client decoration view. These views are used in
-     * the multi window environment, to provide dragging handle and maximize/close buttons.
-     *
-     * @hide
-     */
-    public boolean hasNonClientDecorView() {
-        return false;
-    }
-
     /** @hide */
     public void setTheme(int resId) {
     }
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index c9b8119..23c4047 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -488,7 +488,7 @@
     }
 
     public void clearContentView() {
-        if (mNonClientDecorView.getChildCount() > 1) {
+        if (mNonClientDecorView != null && mNonClientDecorView.getChildCount() > 1) {
             mNonClientDecorView.removeViewAt(1);
         }
     }
@@ -5413,16 +5413,10 @@
      * @Return Returns true if the window should show a shadow.
      **/
     private boolean nonClientDecorHasShadow(int workspaceId) {
-        // TODO(skuhne): Add side by side mode here to add a decor.
         return workspaceId == FREEFORM_WORKSPACE_STACK_ID;
     }
 
     @Override
-    public boolean hasNonClientDecorView() {
-        return mNonClientDecorView != null;
-    }
-
-    @Override
     public void setTheme(int resid) {
         mTheme = resid;
         if (mDecor != null) {