Don't destroy a window's buffers when moving it
Change-Id: Ib08608373ae4299639c1b157421ba633e4293446
This commit is contained in:
@@ -215,6 +215,7 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
boolean mLastWasImTarget;
|
||||
|
||||
boolean mWindowAttributesChanged = false;
|
||||
int mWindowAttributesChangesFlag = 0;
|
||||
|
||||
// These can be accessed by any thread, must be protected with a lock.
|
||||
// Surface can never be reassigned or cleared (use Surface.clear()).
|
||||
@@ -439,6 +440,7 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
|
||||
mSoftInputMode = attrs.softInputMode;
|
||||
mWindowAttributesChanged = true;
|
||||
mWindowAttributesChangesFlag = WindowManager.LayoutParams.EVERYTHING_CHANGED;
|
||||
mAttachInfo.mRootView = view;
|
||||
mAttachInfo.mScalingRequired = mTranslator != null;
|
||||
mAttachInfo.mApplicationScale =
|
||||
@@ -640,7 +642,7 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
// preserve compatible window flag if exists.
|
||||
int compatibleWindowFlag =
|
||||
mWindowAttributes.flags & WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW;
|
||||
mWindowAttributes.copyFrom(attrs);
|
||||
mWindowAttributesChangesFlag = mWindowAttributes.copyFrom(attrs);
|
||||
mWindowAttributes.flags |= compatibleWindowFlag;
|
||||
|
||||
if (newView) {
|
||||
@@ -844,14 +846,17 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
|| mNewSurfaceNeeded;
|
||||
|
||||
WindowManager.LayoutParams params = null;
|
||||
int windowAttributesChanges = 0;
|
||||
if (mWindowAttributesChanged) {
|
||||
mWindowAttributesChanged = false;
|
||||
surfaceChanged = true;
|
||||
params = lp;
|
||||
windowAttributesChanges = mWindowAttributesChangesFlag;
|
||||
}
|
||||
CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get();
|
||||
if (compatibilityInfo.supportsScreen() == mLastInCompatMode) {
|
||||
params = lp;
|
||||
windowAttributesChanges |= WindowManager.LayoutParams.BUFFER_CHANGED;
|
||||
fullRedrawNeeded = true;
|
||||
mLayoutRequested = true;
|
||||
if (mLastInCompatMode) {
|
||||
@@ -862,6 +867,9 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
mLastInCompatMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
mWindowAttributesChangesFlag = 0;
|
||||
|
||||
Rect frame = mWinFrame;
|
||||
if (mFirst) {
|
||||
fullRedrawNeeded = true;
|
||||
@@ -1041,6 +1049,7 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
|| attachInfo.mSystemUiVisibility != oldVis
|
||||
|| attachInfo.mHasSystemUiListeners) {
|
||||
params = lp;
|
||||
windowAttributesChanges |= WindowManager.LayoutParams.BUFFER_CHANGED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1066,6 +1075,7 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
~WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST) |
|
||||
resizeMode;
|
||||
params = lp;
|
||||
windowAttributesChanges |= WindowManager.LayoutParams.BUFFER_CHANGED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1362,7 +1372,8 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
}
|
||||
}
|
||||
|
||||
if (hwInitialized || ((windowShouldResize || params != null) &&
|
||||
if (hwInitialized || ((windowShouldResize || (params != null &&
|
||||
(windowAttributesChanges & WindowManager.LayoutParams.BUFFER_CHANGED) != 0)) &&
|
||||
mAttachInfo.mHardwareRenderer != null &&
|
||||
mAttachInfo.mHardwareRenderer.isEnabled())) {
|
||||
mAttachInfo.mHardwareRenderer.setup(mWidth, mHeight);
|
||||
@@ -1637,6 +1648,7 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
||||
// Need to make sure we re-evaluate the window attributes next
|
||||
// time around, to ensure the window has the correct format.
|
||||
mWindowAttributesChanged = true;
|
||||
mWindowAttributesChangesFlag = 0;
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1252,7 +1252,11 @@ public interface WindowManager extends ViewManager {
|
||||
public static final int INPUT_FEATURES_CHANGED = 1<<15;
|
||||
/** {@hide} */
|
||||
public static final int PRIVATE_FLAGS_CHANGED = 1<<16;
|
||||
|
||||
/** {@hide} */
|
||||
public static final int BUFFER_CHANGED = 1<<17;
|
||||
/** {@hide} */
|
||||
public static final int EVERYTHING_CHANGED = 0xffffffff;
|
||||
|
||||
// internal buffer to backup/restore parameters under compatibility mode.
|
||||
private int[] mCompatibilityParamsBackup = null;
|
||||
|
||||
@@ -1261,11 +1265,11 @@ public interface WindowManager extends ViewManager {
|
||||
|
||||
if (width != o.width) {
|
||||
width = o.width;
|
||||
changes |= LAYOUT_CHANGED;
|
||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
if (height != o.height) {
|
||||
height = o.height;
|
||||
changes |= LAYOUT_CHANGED;
|
||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
if (x != o.x) {
|
||||
x = o.x;
|
||||
@@ -1277,19 +1281,19 @@ public interface WindowManager extends ViewManager {
|
||||
}
|
||||
if (horizontalWeight != o.horizontalWeight) {
|
||||
horizontalWeight = o.horizontalWeight;
|
||||
changes |= LAYOUT_CHANGED;
|
||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
if (verticalWeight != o.verticalWeight) {
|
||||
verticalWeight = o.verticalWeight;
|
||||
changes |= LAYOUT_CHANGED;
|
||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
if (horizontalMargin != o.horizontalMargin) {
|
||||
horizontalMargin = o.horizontalMargin;
|
||||
changes |= LAYOUT_CHANGED;
|
||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
if (verticalMargin != o.verticalMargin) {
|
||||
verticalMargin = o.verticalMargin;
|
||||
changes |= LAYOUT_CHANGED;
|
||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
if (type != o.type) {
|
||||
type = o.type;
|
||||
@@ -1297,7 +1301,7 @@ public interface WindowManager extends ViewManager {
|
||||
}
|
||||
if (flags != o.flags) {
|
||||
flags = o.flags;
|
||||
changes |= FLAGS_CHANGED;
|
||||
changes |= FLAGS_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
if (privateFlags != o.privateFlags) {
|
||||
privateFlags = o.privateFlags;
|
||||
@@ -1309,11 +1313,11 @@ public interface WindowManager extends ViewManager {
|
||||
}
|
||||
if (gravity != o.gravity) {
|
||||
gravity = o.gravity;
|
||||
changes |= LAYOUT_CHANGED;
|
||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
if (format != o.format) {
|
||||
format = o.format;
|
||||
changes |= FORMAT_CHANGED;
|
||||
changes |= FORMAT_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
if (windowAnimations != o.windowAnimations) {
|
||||
windowAnimations = o.windowAnimations;
|
||||
@@ -1352,7 +1356,7 @@ public interface WindowManager extends ViewManager {
|
||||
|
||||
if (screenOrientation != o.screenOrientation) {
|
||||
screenOrientation = o.screenOrientation;
|
||||
changes |= SCREEN_ORIENTATION_CHANGED;
|
||||
changes |= SCREEN_ORIENTATION_CHANGED | BUFFER_CHANGED;
|
||||
}
|
||||
|
||||
if (systemUiVisibility != o.systemUiVisibility
|
||||
|
||||
Reference in New Issue
Block a user