Merge changes I55d96ec3,I0ebc4639
* changes: Reenable task preloading in recents When creating docked stack, use SnapAlgorithm
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -398,6 +398,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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user