Fix invalid divider state while rotating am: 160a3c578c

am: 4472858029

Change-Id: Ia669727e19aa6e036f333be281b5fd125596ae17
This commit is contained in:
Jorim Jaggi
2016-08-27 01:48:34 +00:00
committed by android-build-merger
3 changed files with 18 additions and 43 deletions

View File

@@ -637,7 +637,7 @@ class DisplayContent {
*/
TaskStack getDockedStackVisibleForUserLocked() {
final TaskStack stack = mService.mStackIdToStack.get(DOCKED_STACK_ID);
return (stack != null && stack.isVisibleForUserLocked()) ? stack : null;
return (stack != null && stack.isVisibleLocked(true /* ignoreKeyguard */)) ? stack : null;
}
/**

View File

@@ -677,19 +677,6 @@ class Task implements DimLayer.DimLayerUser {
return (tokensCount != 0) && mAppTokens.get(tokensCount - 1).showForAllUsers;
}
boolean isVisibleForUser() {
for (int i = mAppTokens.size() - 1; i >= 0; i--) {
final AppWindowToken appToken = mAppTokens.get(i);
for (int j = appToken.allAppWindows.size() - 1; j >= 0; j--) {
WindowState window = appToken.allAppWindows.get(j);
if (!window.isHiddenFromUserLocked()) {
return true;
}
}
}
return false;
}
boolean isVisible() {
for (int i = mAppTokens.size() - 1; i >= 0; i--) {
final AppWindowToken appToken = mAppTokens.get(i);

View File

@@ -398,23 +398,21 @@ public class TaskStack implements DimLayer.DimLayerUser,
return false;
}
final int oldDockSide = mStackId == DOCKED_STACK_ID ? getDockSide() : DOCKED_INVALID;
mTmpRect2.set(mBounds);
mDisplayContent.rotateBounds(mRotation, newRotation, mTmpRect2);
if (mStackId == DOCKED_STACK_ID) {
repositionDockedStackAfterRotation(mTmpRect2);
snapDockedStackAfterRotation(mTmpRect2);
final int newDockSide = getDockSide(mTmpRect2);
if (oldDockSide != newDockSide) {
// Update the dock create mode and clear the dock create bounds, these
// might change after a rotation and the original values will be invalid.
mService.setDockedStackCreateStateLocked(
(newDockSide == DOCKED_LEFT || newDockSide == DOCKED_TOP)
? DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT
: DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT,
null);
mDisplayContent.getDockedDividerController().notifyDockSideChanged(newDockSide);
}
// Update the dock create mode and clear the dock create bounds, these
// might change after a rotation and the original values will be invalid.
mService.setDockedStackCreateStateLocked(
(newDockSide == DOCKED_LEFT || newDockSide == DOCKED_TOP)
? DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT
: DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT,
null);
mDisplayContent.getDockedDividerController().notifyDockSideChanged(newDockSide);
}
mBoundsAfterRotation.set(mTmpRect2);
@@ -890,7 +888,7 @@ public class TaskStack implements DimLayer.DimLayerUser,
mAdjustImeAmount = adjustAmount;
mAdjustDividerAmount = adjustDividerAmount;
updateAdjustedBounds();
return isVisibleForUserLocked();
return isVisibleLocked(true /* ignoreKeyguard */);
} else {
return false;
}
@@ -926,7 +924,7 @@ public class TaskStack implements DimLayer.DimLayerUser,
if (minimizeAmount != mMinimizeAmount) {
mMinimizeAmount = minimizeAmount;
updateAdjustedBounds();
return isVisibleForUserLocked();
return isVisibleLocked(true /* ignoreKeyguard*/);
} else {
return false;
}
@@ -943,7 +941,7 @@ public class TaskStack implements DimLayer.DimLayerUser,
void beginImeAdjustAnimation() {
for (int j = mTasks.size() - 1; j >= 0; j--) {
final Task task = mTasks.get(j);
if (task.isVisibleForUser()) {
if (task.isVisible()) {
task.setDragResizing(true, DRAG_RESIZE_MODE_DOCKED_DIVIDER);
task.addWindowsWaitingForDrawnIfResizingChanged();
}
@@ -1233,9 +1231,13 @@ public class TaskStack implements DimLayer.DimLayerUser,
}
boolean isVisibleLocked() {
return isVisibleLocked(false /* ignoreKeyguard */);
}
boolean isVisibleLocked(boolean ignoreKeyguard) {
final boolean keyguardOn = mService.mPolicy.isKeyguardShowingOrOccluded()
&& !mService.mAnimator.mKeyguardGoingAway;
if (keyguardOn && !StackId.isAllowedOverLockscreen(mStackId)) {
if (!ignoreKeyguard && keyguardOn && !StackId.isAllowedOverLockscreen(mStackId)) {
// The keyguard is showing and the stack shouldn't show on top of the keyguard.
return false;
}
@@ -1252,20 +1254,6 @@ public class TaskStack implements DimLayer.DimLayerUser,
return false;
}
/**
* @return true if a the stack is visible for the current in user, ignoring any other visibility
* aspects, and false otherwise
*/
boolean isVisibleForUserLocked() {
for (int i = mTasks.size() - 1; i >= 0; i--) {
final Task task = mTasks.get(i);
if (task.isVisibleForUser()) {
return true;
}
}
return false;
}
boolean isDragResizing() {
return mDragResizing;
}