Fix invalid divider state while rotating

am: 160a3c578c

Change-Id: I9ddd0ea9b17b1efa30db044dc1a822980d3dcfab
This commit is contained in:
Jorim Jaggi
2016-08-27 01:42:04 +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() { TaskStack getDockedStackVisibleForUserLocked() {
final TaskStack stack = mService.mStackIdToStack.get(DOCKED_STACK_ID); 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; 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() { boolean isVisible() {
for (int i = mAppTokens.size() - 1; i >= 0; i--) { for (int i = mAppTokens.size() - 1; i >= 0; i--) {
final AppWindowToken appToken = mAppTokens.get(i); final AppWindowToken appToken = mAppTokens.get(i);

View File

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