Merge "Clean up updating bounds after config/display info change" into nyc-dev
This commit is contained in:
@@ -110,11 +110,6 @@ public class TaskStack implements DimLayer.DimLayerUser,
|
|||||||
/** Detach this stack from its display when animation completes. */
|
/** Detach this stack from its display when animation completes. */
|
||||||
boolean mDeferDetach;
|
boolean mDeferDetach;
|
||||||
|
|
||||||
// Display rotation as of the last time the display information was updated for this stack.
|
|
||||||
private int mLastUpdateDisplayInfoRotation = -1;
|
|
||||||
// Display rotation as of the last time the configuration was updated for this stack.
|
|
||||||
private int mLastConfigChangedRotation = -1;
|
|
||||||
|
|
||||||
// Whether the stack and all its tasks is currently being drag-resized
|
// Whether the stack and all its tasks is currently being drag-resized
|
||||||
private boolean mDragResizing;
|
private boolean mDragResizing;
|
||||||
|
|
||||||
@@ -371,36 +366,27 @@ public class TaskStack implements DimLayer.DimLayerUser,
|
|||||||
final int newDensity = mDisplayContent.getDisplayInfo().logicalDensityDpi;
|
final int newDensity = mDisplayContent.getDisplayInfo().logicalDensityDpi;
|
||||||
if (mRotation == newRotation && mDensity == newDensity) {
|
if (mRotation == newRotation && mDensity == newDensity) {
|
||||||
setBounds(mTmpRect2);
|
setBounds(mTmpRect2);
|
||||||
} else {
|
|
||||||
mLastUpdateDisplayInfoRotation = newRotation;
|
|
||||||
updateBoundsAfterConfigChange(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the rotation or density didn't match, we'll update it in onConfigurationChanged.
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean onConfigurationChanged() {
|
boolean onConfigurationChanged() {
|
||||||
mLastConfigChangedRotation = getDisplayInfo().rotation;
|
return updateBoundsAfterConfigChange();
|
||||||
return updateBoundsAfterConfigChange(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean updateBoundsAfterConfigChange(boolean scheduleResize) {
|
private boolean updateBoundsAfterConfigChange() {
|
||||||
if (mFullscreen) {
|
if (mFullscreen) {
|
||||||
// Bounds will already be set correctly when display info is updated in the case of
|
// Bounds will already be set correctly when display info is updated in the case of
|
||||||
// fullscreen.
|
// fullscreen.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mLastConfigChangedRotation != mLastUpdateDisplayInfoRotation) {
|
|
||||||
// We wait for the rotation values after configuration change and display info. update
|
|
||||||
// to be equal before updating the bounds due to rotation change otherwise things might
|
|
||||||
// get out of alignment...
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final int newRotation = getDisplayInfo().rotation;
|
final int newRotation = getDisplayInfo().rotation;
|
||||||
final int newDensity = getDisplayInfo().logicalDensityDpi;
|
final int newDensity = getDisplayInfo().logicalDensityDpi;
|
||||||
|
|
||||||
if (mRotation == newRotation && mDensity == newDensity) {
|
if (mRotation == newRotation && mDensity == newDensity) {
|
||||||
// Nothing to do here if the rotation didn't change
|
// Nothing to do here as we already update the state in updateDisplayInfo.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,16 +402,7 @@ public class TaskStack implements DimLayer.DimLayerUser,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheduleResize) {
|
mBoundsAfterRotation.set(mTmpRect2);
|
||||||
// Post message to inform activity manager of the bounds change simulating
|
|
||||||
// a one-way call. We do this to prevent a deadlock between window manager
|
|
||||||
// lock and activity manager lock been held.
|
|
||||||
mService.mH.obtainMessage(RESIZE_STACK, mStackId,
|
|
||||||
0 /*allowResizeInDockedMode*/, mTmpRect2).sendToTarget();
|
|
||||||
} else {
|
|
||||||
mBoundsAfterRotation.set(mTmpRect2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user