Merge "Revert commits related to wallpaper cropping" into nyc-dev

This commit is contained in:
Chong Zhang
2016-05-27 21:08:40 +00:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 103 deletions

View File

@@ -606,7 +606,12 @@ public class DockedStackDividerController implements DimLayerUser {
private void setMinimizedDockedStack(boolean minimized) { private void setMinimizedDockedStack(boolean minimized) {
final TaskStack stack = mDisplayContent.getDockedStackVisibleForUserLocked(); final TaskStack stack = mDisplayContent.getDockedStackVisibleForUserLocked();
notifyDockedStackMinimizedChanged(minimized, 0); notifyDockedStackMinimizedChanged(minimized, 0);
setMinimizeAmount(stack, minimized ? 1f : 0f); if (stack == null) {
return;
}
if (stack.setAdjustedForMinimizedDock(minimized ? 1f : 0f)) {
mService.mWindowPlacerLocked.performSurfacePlacement();
}
} }
private boolean isAnimationMaximizing() { private boolean isAnimationMaximizing() {
@@ -690,8 +695,11 @@ public class DockedStackDividerController implements DimLayerUser {
float t = Math.min(1f, (float) (now - mAnimationStartTime) / mAnimationDuration); float t = Math.min(1f, (float) (now - mAnimationStartTime) / mAnimationDuration);
t = (isAnimationMaximizing() ? TOUCH_RESPONSE_INTERPOLATOR : mMinimizedDockInterpolator) t = (isAnimationMaximizing() ? TOUCH_RESPONSE_INTERPOLATOR : mMinimizedDockInterpolator)
.getInterpolation(t); .getInterpolation(t);
setMinimizeAmount(stack, getMinimizeAmount(stack, t)); if (stack != null) {
if (stack.setAdjustedForMinimizedDock(getMinimizeAmount(stack, t))) {
mService.mWindowPlacerLocked.performSurfacePlacement();
}
}
if (t >= 1.0f) { if (t >= 1.0f) {
mAnimatingForMinimizedDockedStack = false; mAnimatingForMinimizedDockedStack = false;
return false; return false;
@@ -700,42 +708,6 @@ public class DockedStackDividerController implements DimLayerUser {
} }
} }
void setMinimizeAmount(TaskStack dockedStack, float minimizeAmount) {
final ArrayList<TaskStack> stacks = mDisplayContent.getStacks();
// If the docked stack is not visible, clear the complementary stack on all stacks.
if (dockedStack == null) {
for (int i = stacks.size() - 1; i >= 0; --i) {
final TaskStack stack = stacks.get(i);
stack.resetAdjustedForComplementDock();
}
return;
}
// Otherwise if the docked stack minimize amount has changed, update the adjusted bounds
// on the other stack that's currently visible, so that the stack's getDimBounds()
// occupies what's left by the docked stack. This is needed so that stuff like wallpaper
// gets cropped properly to the area left by the dock.
if (dockedStack.setAdjustedForMinimizedDock(minimizeAmount)) {
final boolean adjusted =
dockedStack.isVisibleForUserLocked() && minimizeAmount != 0.0f;
dockedStack.getDimBounds(mTmpRect2);
int dockSide = dockedStack.getDockSide();
for (int i = stacks.size() - 1; i >= 0; --i) {
final TaskStack stack = stacks.get(i);
if (stack == dockedStack) {
continue;
}
if (stack.isVisibleLocked() && adjusted) {
stack.setAdjustedForComplementDock(mTmpRect2, dockSide);
} else {
stack.resetAdjustedForComplementDock();
}
}
mService.mWindowPlacerLocked.performSurfacePlacement();
}
}
private float getInterpolatedAnimationValue(float t) { private float getInterpolatedAnimationValue(float t) {
return t * mAnimationTarget + (1 - t) * mAnimationStart; return t * mAnimationTarget + (1 - t) * mAnimationStart;
} }

View File

@@ -123,7 +123,6 @@ public class TaskStack implements DimLayer.DimLayerUser,
private float mAdjustImeAmount; private float mAdjustImeAmount;
private float mAdjustDividerAmount; private float mAdjustDividerAmount;
private final int mDockedStackMinimizeThickness; private final int mDockedStackMinimizeThickness;
private boolean mAdjustedForForComplementDock;
// If this is true, we are in the bounds animating mode. // If this is true, we are in the bounds animating mode.
// The task will be down or upscaled to perfectly fit the // The task will be down or upscaled to perfectly fit the
@@ -243,9 +242,7 @@ public class TaskStack implements DimLayer.DimLayerUser,
insetBounds = mFullyAdjustedImeBounds; insetBounds = mFullyAdjustedImeBounds;
} }
} }
if (!mAdjustedForForComplementDock) { alignTasksToAdjustedBounds(adjusted ? mAdjustedBounds : mBounds, insetBounds);
alignTasksToAdjustedBounds(adjusted ? mAdjustedBounds : mBounds, insetBounds);
}
mDisplayContent.layoutNeeded = true; mDisplayContent.layoutNeeded = true;
} }
@@ -864,7 +861,6 @@ public class TaskStack implements DimLayer.DimLayerUser,
mImeWin = imeWin; mImeWin = imeWin;
mImeGoingAway = false; mImeGoingAway = false;
if (!mAdjustedForIme || forceUpdate) { if (!mAdjustedForIme || forceUpdate) {
mAdjustedForForComplementDock = false;
mAdjustedForIme = true; mAdjustedForIme = true;
mAdjustImeAmount = 0f; mAdjustImeAmount = 0f;
mAdjustDividerAmount = 0f; mAdjustDividerAmount = 0f;
@@ -927,12 +923,10 @@ public class TaskStack implements DimLayer.DimLayerUser,
* @return Whether the amount has changed and a layout is needed. * @return Whether the amount has changed and a layout is needed.
*/ */
boolean setAdjustedForMinimizedDock(float minimizeAmount) { boolean setAdjustedForMinimizedDock(float minimizeAmount) {
mAdjustedForForComplementDock = false;
if (minimizeAmount != mMinimizeAmount) { if (minimizeAmount != mMinimizeAmount) {
mMinimizeAmount = minimizeAmount; mMinimizeAmount = minimizeAmount;
updateAdjustedBounds(); updateAdjustedBounds();
return true; return isVisibleForUserLocked();
} else { } else {
return false; return false;
} }
@@ -942,33 +936,6 @@ public class TaskStack implements DimLayer.DimLayerUser,
return mMinimizeAmount != 0f; return mMinimizeAmount != 0f;
} }
void setAdjustedForComplementDock(Rect dockBounds, int dockSide) {
if (mMinimizeAmount != 0f || mAdjustedForIme) {
return;
}
mTmpAdjustedBounds.set(mBounds);
if (dockSide == DOCKED_TOP) {
mTmpAdjustedBounds.top = dockBounds.bottom;
} else if (dockSide == DOCKED_LEFT) {
mTmpAdjustedBounds.left = dockBounds.right;
} else if (dockSide == DOCKED_RIGHT) {
mTmpAdjustedBounds.right = dockBounds.left;
} else {
Slog.w(TAG_WM, "setAdjustedForComplementDock: invalid dock side " + dockSide);
return;
}
mAdjustedForForComplementDock = true;
setAdjustedBounds(mTmpAdjustedBounds);
}
void resetAdjustedForComplementDock() {
if (mAdjustedForForComplementDock) {
mAdjustedForForComplementDock = false;
mTmpAdjustedBounds.setEmpty();
setAdjustedBounds(mTmpAdjustedBounds);
}
}
/** /**
* Puts all visible tasks that are adjusted for IME into resizing mode and adds the windows * Puts all visible tasks that are adjusted for IME into resizing mode and adds the windows
* to the list of to be drawn windows the service is waiting for. * to the list of to be drawn windows the service is waiting for.

View File

@@ -23,7 +23,6 @@ import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
import static android.view.WindowManager.LayoutParams.FLAG_SCALED; import static android.view.WindowManager.LayoutParams.FLAG_SCALED;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static com.android.server.wm.AppWindowAnimator.sDummyAnimation; import static com.android.server.wm.AppWindowAnimator.sDummyAnimation;
import static com.android.server.wm.DragResizeMode.DRAG_RESIZE_MODE_FREEFORM; import static com.android.server.wm.DragResizeMode.DRAG_RESIZE_MODE_FREEFORM;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
@@ -1328,33 +1327,6 @@ class WindowStateAnimator {
return; return;
} }
// We crop wallpaper windows to the stack bounds of their current target to avoid them
// showing behind transparent windows in other stacks in split-screen mode.
if (w.getBaseType() == TYPE_WALLPAPER) {
final WindowState wallpaperTarget = mWallpaperControllerLocked.getWallpaperTarget();
if (wallpaperTarget != null) {
final Task task = wallpaperTarget.getTask();
final WindowStateAnimator winAnimator = wallpaperTarget.mWinAnimator;
// We can only crop the wallpaper using final crop with stack bounds if the target
// is not animating, or if it's animating with clip mode STACK_CLIP_AFTER_ANIM.
// If it's animating with mode STACK_CLIP_NONE, we shouldn't crop either the task
// itself or the wallpaper. If it's animating with STACK_CLIP_BEFORE_ANIM, the crop
// is before the transform on the task itself.
final boolean useFinalCropOnWallpaper = !winAnimator.isAnimationSet()
|| winAnimator.resolveStackClip() == STACK_CLIP_AFTER_ANIM;
if (task != null && !task.isFullscreen()
&& task.cropWindowsToStackBounds()
&& useFinalCropOnWallpaper){
final TaskStack stack = task.mStack;
if (stack != null && !stack.isFullscreen()) {
stack.getDimBounds(mTmpStackBounds);
finalClipRect.set(mTmpStackBounds);
}
}
}
return;
}
final Task task = w.getTask(); final Task task = w.getTask();
if (task == null || !task.cropWindowsToStackBounds()) { if (task == null || !task.cropWindowsToStackBounds()) {
return; return;