Fix recents crashing during docked stack resize.

Whether acitvity window should be preserved during the relaunch is
controlled by the activity manager and the existence of
non-client-decor should not affect it. For example, docked activities
will not have non-client-decor, but we would like to preserve them
anyway.

Bug: 24573657
Change-Id: I5d4852c3b7c26ac3ec1bbc105639f75b67d1d3ad
This commit is contained in:
Filip Gruszczynski
2015-10-04 16:43:48 -07:00
parent d1728e7656
commit 14418daa09
3 changed files with 4 additions and 22 deletions

View File

@@ -3956,13 +3956,12 @@ public final class ActivityThread {
}
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.

View File

@@ -28,9 +28,8 @@ import android.content.Context;
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 class Window {
*/
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) {
}

View File

@@ -488,7 +488,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
public void clearContentView() {
if (mNonClientDecorView.getChildCount() > 1) {
if (mNonClientDecorView != null && mNonClientDecorView.getChildCount() > 1) {
mNonClientDecorView.removeViewAt(1);
}
}
@@ -5413,15 +5413,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
* @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;