diff options
| author | 2016-01-14 01:08:52 +0000 | |
|---|---|---|
| committer | 2016-01-14 01:08:52 +0000 | |
| commit | fdbdb9f9c6cd2f2cd1a494fb9b295dcaf4fd101c (patch) | |
| tree | f86296bfd6274546160b8aa4645e25e1dbe89f60 | |
| parent | 89a697a7e78de121a228b5a8d08a86ee76a40f1c (diff) | |
| parent | a0fdeec66caa4d70786c7f6f31f79a24eef9da10 (diff) | |
Merge changes I55d96ec3,I0ebc4639
* changes:
Reenable task preloading in recents
When creating docked stack, use SnapAlgorithm
5 files changed, 40 insertions, 13 deletions
diff --git a/core/java/com/android/internal/policy/DividerSnapAlgorithm.java b/core/java/com/android/internal/policy/DividerSnapAlgorithm.java index e79f1b8a3133..fdf5f8419ba0 100644 --- a/core/java/com/android/internal/policy/DividerSnapAlgorithm.java +++ b/core/java/com/android/internal/policy/DividerSnapAlgorithm.java @@ -62,6 +62,7 @@ public class DividerSnapAlgorithm { private final SnapTarget mDismissStartTarget; private final SnapTarget mDismissEndTarget; + private final SnapTarget mMiddleTarget; public DividerSnapAlgorithm(Resources res, float minFlingVelocityPxPerSecond, int displayWidth, int displayHeight, int dividerSize, boolean isHorizontalDivision, @@ -80,6 +81,7 @@ public class DividerSnapAlgorithm { mLastSplitTarget = mTargets.get(mTargets.size() - 2); mDismissStartTarget = mTargets.get(0); mDismissEndTarget = mTargets.get(mTargets.size() - 1); + mMiddleTarget = mTargets.get(mTargets.size() / 2); } public SnapTarget calculateSnapTarget(int position, float velocity) { @@ -215,6 +217,10 @@ public class DividerSnapAlgorithm { SnapTarget.FLAG_NONE)); } + public SnapTarget getMiddleTarget() { + return mMiddleTarget; + } + /** * Represents a snap target for the divider. */ diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java index ddeb8dcecf17..60a2ee5711ce 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java @@ -110,9 +110,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements /** Preloads the next task */ public void run() { - // TODO: Temporarily skip this if multi stack is enabled - /* - RecentsConfiguration config = RecentsConfiguration.getInstance(); + RecentsConfiguration config = Recents.getConfiguration(); if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) { RecentsTaskLoader loader = Recents.getTaskLoader(); SystemServicesProxy ssp = Recents.getSystemServices(); @@ -134,7 +132,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements launchOpts.onlyLoadPausedActivities = true; loader.loadTasks(mContext, plan, launchOpts); } - */ } } diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 2ee21688a8de..8e68aec18e4f 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -1179,8 +1179,12 @@ final class ActivityStack { prev.cpuTimeAtResume = 0; // reset it } - // Notfiy when the task stack has changed - mService.notifyTaskStackChangedLocked(); + // Notify when the task stack has changed, but only if visibilities changed (not just + // focus). + if (mStackSupervisor.mAppVisibilitiesChangedSinceLastPause) { + mService.notifyTaskStackChangedLocked(); + mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = false; + } } private void addToStopping(ActivityRecord r) { @@ -1257,6 +1261,7 @@ final class ActivityStack { ActivityContainer container = containers.get(containerNdx); container.setVisible(visible); } + mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = true; } // Find the first visible activity above the passed activity and if it is translucent return it diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 022b60b02d36..e837d9a0a610 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -399,6 +399,12 @@ public final class ActivityStackSupervisor implements DisplayListener { private final FindTaskResult mTmpFindTaskResult = new FindTaskResult(); /** + * Used to keep track whether app visibilities got changed since the last pause. Useful to + * determine whether to invoke the task stack change listener after pausing. + */ + boolean mAppVisibilitiesChangedSinceLastPause; + + /** * Description of a request to start a new activity, which has been held * due to app switches being disabled. */ diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java index f4140f0c0c5b..632c03376d60 100644 --- a/services/core/java/com/android/server/wm/TaskStack.java +++ b/services/core/java/com/android/server/wm/TaskStack.java @@ -37,6 +37,7 @@ import java.util.ArrayList; import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT; import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID; +import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.view.WindowManager.DOCKED_BOTTOM; import static android.view.WindowManager.DOCKED_INVALID; import static android.view.WindowManager.DOCKED_LEFT; @@ -549,20 +550,32 @@ public class TaskStack implements DimLayer.DimLayerUser { outBounds.set(mService.mDockedStackCreateBounds); return; } - // The initial bounds of the docked stack when it is created half the screen space and - // its bounds can be adjusted after that. The bounds of all other stacks are adjusted - // to occupy whatever screen space the docked stack isn't occupying. + + // The initial bounds of the docked stack when it is created about half the screen space + // and its bounds can be adjusted after that. The bounds of all other stacks are + // adjusted to occupy whatever screen space the docked stack isn't occupying. + final DisplayInfo di = mDisplayContent.getDisplayInfo(); + mService.mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight, + mTmpRect2); + final int position = new DividerSnapAlgorithm(mService.mContext.getResources(), + 0 /* minFlingVelocityPxPerSecond */, + di.logicalWidth, + di.logicalHeight, + dockDividerWidth, + mService.mCurConfiguration.orientation == ORIENTATION_PORTRAIT, + mTmpRect2).getMiddleTarget().position; + if (dockOnTopOrLeft) { if (splitHorizontally) { - outBounds.right = displayRect.centerX() - dockDividerWidth / 2; + outBounds.right = position; } else { - outBounds.bottom = displayRect.centerY() - dockDividerWidth / 2; + outBounds.bottom = position; } } else { if (splitHorizontally) { - outBounds.left = displayRect.centerX() + dockDividerWidth / 2; + outBounds.left = position - dockDividerWidth; } else { - outBounds.top = displayRect.centerY() + dockDividerWidth / 2; + outBounds.top = position - dockDividerWidth; } } return; |