diff options
11 files changed, 41 insertions, 19 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index e6c576825e67..86734b1c222c 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -1814,7 +1814,7 @@ public class Am extends BaseCommand { private void resizeStackUnchecked(int stackId, Rect bounds, int delayMs, boolean animate) { try { - mAm.resizeStack(stackId, bounds, false, false, animate); + mAm.resizeStack(stackId, bounds, false, false, animate, -1); Thread.sleep(delayMs); } catch (RemoteException e) { showError("Error: resizing stack " + e); diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 811a05bac077..5b3f6f9557e1 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -819,7 +819,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM final boolean allowResizeInDockedMode = data.readInt() == 1; final boolean preserveWindows = data.readInt() == 1; final boolean animate = data.readInt() == 1; - resizeStack(stackId, r, allowResizeInDockedMode, preserveWindows, animate); + final int animationDuration = data.readInt(); + resizeStack(stackId, + r, allowResizeInDockedMode, preserveWindows, animate, animationDuration); reply.writeNoException(); return true; } @@ -3881,7 +3883,8 @@ class ActivityManagerProxy implements IActivityManager } @Override public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode, - boolean preserveWindows, boolean animate) throws RemoteException { + boolean preserveWindows, boolean animate, int animationDuration) + throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); @@ -3895,6 +3898,7 @@ class ActivityManagerProxy implements IActivityManager data.writeInt(allowResizeInDockedMode ? 1 : 0); data.writeInt(preserveWindows ? 1 : 0); data.writeInt(animate ? 1 : 0); + data.writeInt(animationDuration); mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 8e87e2661361..0897d001802c 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -147,8 +147,23 @@ public interface IActivityManager extends IInterface { public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate, Rect initialBounds) throws RemoteException; public boolean moveTopActivityToPinnedStack(int stackId, Rect bounds) throws RemoteException; + + /** + * Resizes the input stack id to the given bounds. + * + * @param stackId Id of the stack to resize. + * @param bounds Bounds to resize the stack to or {@code null} for fullscreen. + * @param allowResizeInDockedMode True if the resize should be allowed when the docked stack is + * active. + * @param preserveWindows True if the windows of activities contained in the stack should be + * preserved. + * @param animate True if the stack resize should be animated. + * @param animationDuration The duration of the resize animation in milliseconds or -1 if the + * default animation duration should be used. + * @throws RemoteException + */ public void resizeStack(int stackId, Rect bounds, boolean allowResizeInDockedMode, - boolean preserveWindows, boolean animate) throws RemoteException; + boolean preserveWindows, boolean animate, int animationDuration) throws RemoteException; /** * Moves all tasks from the docked stack in the fullscreen stack and puts the top task of the diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java index e312fa2028a5..ef32f7e8777e 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java @@ -100,8 +100,8 @@ public class WindowManagerProxy { @Override public void run() { try { - ActivityManagerNative.getDefault().resizeStack(DOCKED_STACK_ID, null, true, true, - false); + ActivityManagerNative.getDefault().resizeStack( + DOCKED_STACK_ID, null, true, true, false, -1); } catch (RemoteException e) { Log.w(TAG, "Failed to resize stack: " + e); } diff --git a/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java b/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java index ff7ea276aa91..8db75344e483 100644 --- a/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java +++ b/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java @@ -385,7 +385,7 @@ public class PipManager { break; } try { - mActivityManager.resizeStack(PINNED_STACK_ID, mCurrentPipBounds, true, true, true); + mActivityManager.resizeStack(PINNED_STACK_ID, mCurrentPipBounds, true, true, true, -1); } catch (RemoteException e) { Log.e(TAG, "showPipMenu failed", e); } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 4f0f7704f0b8..1d5eb9bc7c48 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -9670,14 +9670,14 @@ public final class ActivityManagerService extends ActivityManagerNative @Override public void resizeStack(int stackId, Rect bounds, boolean allowResizeInDockedMode, - boolean preserveWindows, boolean animate) { + boolean preserveWindows, boolean animate, int animationDuration) { enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "resizeStack()"); long ident = Binder.clearCallingIdentity(); try { synchronized (this) { if (animate) { if (stackId == PINNED_STACK_ID) { - mWindowManager.animateResizePinnedStack(bounds); + mWindowManager.animateResizePinnedStack(bounds, animationDuration); } else { throw new IllegalArgumentException("Stack: " + stackId + " doesn't support animated resize."); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index d364d8569db0..7def1bd57aaf 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -2408,7 +2408,7 @@ public final class ActivityStackSupervisor implements DisplayListener { ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); resumeFocusedStackTopActivityLocked(); - mWindowManager.animateResizePinnedStack(bounds); + mWindowManager.animateResizePinnedStack(bounds, -1); mService.notifyActivityPinnedLocked(); } diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index efa74209afaa..af69c93b8a64 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -1483,7 +1483,8 @@ class ActivityStarter { if (mLaunchBounds != null) { final int stackId = mTargetStack.mStackId; if (StackId.resizeStackWithLaunchBounds(stackId)) { - mService.resizeStack(stackId, mLaunchBounds, true, !PRESERVE_WINDOWS, ANIMATE); + mService.resizeStack( + stackId, mLaunchBounds, true, !PRESERVE_WINDOWS, ANIMATE, -1); } else { mStartActivity.task.updateOverrideConfiguration(mLaunchBounds); } @@ -1571,7 +1572,7 @@ class ActivityStarter { stackId = stack.mStackId; } if (StackId.resizeStackWithLaunchBounds(stackId)) { - mService.resizeStack(stackId, mLaunchBounds, true, !PRESERVE_WINDOWS, ANIMATE); + mService.resizeStack(stackId, mLaunchBounds, true, !PRESERVE_WINDOWS, ANIMATE, -1); } } mTargetStack = mInTask.stack; diff --git a/services/core/java/com/android/server/wm/BoundsAnimationController.java b/services/core/java/com/android/server/wm/BoundsAnimationController.java index 79d3d84cfae2..b7d6062a3dc0 100644 --- a/services/core/java/com/android/server/wm/BoundsAnimationController.java +++ b/services/core/java/com/android/server/wm/BoundsAnimationController.java @@ -214,7 +214,7 @@ public class BoundsAnimationController { void getFullScreenBounds(Rect bounds); } - void animateBounds(final AnimateBoundsUser target, Rect from, Rect to) { + void animateBounds(final AnimateBoundsUser target, Rect from, Rect to, int animationDuration) { boolean moveToFullscreen = false; if (to == null) { to = new Rect(); @@ -242,7 +242,8 @@ public class BoundsAnimationController { new BoundsAnimator(target, from, to, moveToFullscreen, replacing); mRunningAnimations.put(target, animator); animator.setFloatValues(0f, 1f); - animator.setDuration(DEFAULT_APP_TRANSITION_DURATION * DEBUG_ANIMATION_SLOW_DOWN_FACTOR); + animator.setDuration((animationDuration != -1 ? animationDuration + : DEFAULT_APP_TRANSITION_DURATION) * DEBUG_ANIMATION_SLOW_DOWN_FACTOR); animator.setInterpolator(new LinearInterpolator()); animator.start(); } diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java index 60b2e4a68f6d..c6677670190e 100644 --- a/services/core/java/com/android/server/wm/TaskStack.java +++ b/services/core/java/com/android/server/wm/TaskStack.java @@ -1089,7 +1089,7 @@ public class TaskStack implements DimLayer.DimLayerUser, } } try { - mService.mActivityManager.resizeStack(mStackId, bounds, false, true, false); + mService.mActivityManager.resizeStack(mStackId, bounds, false, true, false, -1); } catch (RemoteException e) { } return true; diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 607a3e96ecba..b84ed7be9ad4 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -8241,8 +8241,8 @@ public class WindowManagerService extends IWindowManager.Stub break; case RESIZE_STACK: { try { - mActivityManager.resizeStack(msg.arg1, (Rect) msg.obj, msg.arg2 == 1, false, - false); + mActivityManager.resizeStack( + msg.arg1, (Rect) msg.obj, msg.arg2 == 1, false, false, -1); } catch (RemoteException e) { // This will not happen since we are in the same process. } @@ -10460,7 +10460,7 @@ public class WindowManagerService extends IWindowManager.Stub } } - public void animateResizePinnedStack(final Rect bounds) { + public void animateResizePinnedStack(final Rect bounds, final int animationDuration) { synchronized (mWindowMap) { final TaskStack stack = mStackIdToStack.get(PINNED_STACK_ID); if (stack == null) { @@ -10472,7 +10472,8 @@ public class WindowManagerService extends IWindowManager.Stub UiThread.getHandler().post(new Runnable() { @Override public void run() { - mBoundsAnimationController.animateBounds(stack, originalBounds, bounds); + mBoundsAnimationController.animateBounds( + stack, originalBounds, bounds, animationDuration); } }); } |