* commit 'd68cd8cc40226dfd0b63227b6c186de4a4fd9ba0': Restore window manager stack order on user switch.
This commit is contained in:
@ -551,9 +551,6 @@ final class ActivityStack {
|
|||||||
* Move the activities around in the stack to bring a user to the foreground.
|
* Move the activities around in the stack to bring a user to the foreground.
|
||||||
*/
|
*/
|
||||||
final void switchUserLocked(int userId) {
|
final void switchUserLocked(int userId) {
|
||||||
if (VALIDATE_TOKENS) {
|
|
||||||
validateAppTokensLocked();
|
|
||||||
}
|
|
||||||
if (mCurrentUser == userId) {
|
if (mCurrentUser == userId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -564,11 +561,16 @@ final class ActivityStack {
|
|||||||
for (int i = 0; i < index; ++i) {
|
for (int i = 0; i < index; ++i) {
|
||||||
TaskRecord task = mTaskHistory.get(i);
|
TaskRecord task = mTaskHistory.get(i);
|
||||||
if (task.userId == userId) {
|
if (task.userId == userId) {
|
||||||
|
if (DEBUG_TASKS) Slog.d(TAG, "switchUserLocked: stack=" + getStackId() +
|
||||||
|
" moving " + task + " to top");
|
||||||
mTaskHistory.remove(i);
|
mTaskHistory.remove(i);
|
||||||
mTaskHistory.add(task);
|
mTaskHistory.add(task);
|
||||||
--index;
|
--index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (VALIDATE_TOKENS) {
|
||||||
|
validateAppTokensLocked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void minimalResumeActivityLocked(ActivityRecord r) {
|
void minimalResumeActivityLocked(ActivityRecord r) {
|
||||||
@ -2951,6 +2953,7 @@ final class ActivityStack {
|
|||||||
for (int taskNdx = top; taskNdx >= 0; --taskNdx) {
|
for (int taskNdx = top; taskNdx >= 0; --taskNdx) {
|
||||||
final TaskRecord task = mTaskHistory.get(taskNdx);
|
final TaskRecord task = mTaskHistory.get(taskNdx);
|
||||||
if (task.isHomeTask()) {
|
if (task.isHomeTask()) {
|
||||||
|
if (DEBUG_TASKS || DEBUG_STACK) Slog.d(TAG, "moveHomeTaskToTop: moving " + task);
|
||||||
mTaskHistory.remove(taskNdx);
|
mTaskHistory.remove(taskNdx);
|
||||||
mTaskHistory.add(top, task);
|
mTaskHistory.add(top, task);
|
||||||
mWindowManager.moveTaskToTop(task.taskId);
|
mWindowManager.moveTaskToTop(task.taskId);
|
||||||
|
@ -68,9 +68,8 @@ import android.os.SystemClock;
|
|||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.util.EventLog;
|
import android.util.EventLog;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseIntArray;
|
||||||
|
|
||||||
import android.util.SparseBooleanArray;
|
|
||||||
import com.android.internal.app.HeavyWeightSwitcherActivity;
|
import com.android.internal.app.HeavyWeightSwitcherActivity;
|
||||||
import com.android.internal.os.TransferPipe;
|
import com.android.internal.os.TransferPipe;
|
||||||
import com.android.server.am.ActivityManagerService.PendingActivityLaunch;
|
import com.android.server.am.ActivityManagerService.PendingActivityLaunch;
|
||||||
@ -204,8 +203,8 @@ public final class ActivityStackSupervisor {
|
|||||||
*/
|
*/
|
||||||
final PowerManager.WakeLock mGoingToSleep;
|
final PowerManager.WakeLock mGoingToSleep;
|
||||||
|
|
||||||
/** State of the stacks when user switched, indexed by userId. */
|
/** Stack id of the front stack when user switched, indexed by userId. */
|
||||||
SparseBooleanArray mUserHomeInFront = new SparseBooleanArray(2);
|
SparseIntArray mUserStackInFront = new SparseIntArray(2);
|
||||||
|
|
||||||
public ActivityStackSupervisor(ActivityManagerService service, Context context,
|
public ActivityStackSupervisor(ActivityManagerService service, Context context,
|
||||||
Looper looper) {
|
Looper looper) {
|
||||||
@ -1927,7 +1926,7 @@ public final class ActivityStackSupervisor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void removeUserLocked(int userId) {
|
void removeUserLocked(int userId) {
|
||||||
mUserHomeInFront.delete(userId);
|
mUserStackInFront.delete(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2248,8 +2247,8 @@ public final class ActivityStackSupervisor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean switchUserLocked(int userId, UserStartedState uss) {
|
boolean switchUserLocked(int userId, UserStartedState uss) {
|
||||||
mUserHomeInFront.put(mCurrentUser, isFrontStack(mHomeStack));
|
mUserStackInFront.put(mCurrentUser, getFocusedStack().getStackId());
|
||||||
final boolean homeInFront = mUserHomeInFront.get(userId, true);
|
final int restoreStackId = mUserStackInFront.get(userId, HOME_STACK_ID);
|
||||||
mCurrentUser = userId;
|
mCurrentUser = userId;
|
||||||
|
|
||||||
mStartingUsers.add(uss);
|
mStartingUsers.add(uss);
|
||||||
@ -2257,7 +2256,13 @@ public final class ActivityStackSupervisor {
|
|||||||
mStacks.get(stackNdx).switchUserLocked(userId);
|
mStacks.get(stackNdx).switchUserLocked(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActivityStack stack = getStack(restoreStackId);
|
||||||
|
if (stack == null) {
|
||||||
|
stack = mHomeStack;
|
||||||
|
}
|
||||||
|
final boolean homeInFront = stack.isHomeStack();
|
||||||
moveHomeStack(homeInFront);
|
moveHomeStack(homeInFront);
|
||||||
|
mWindowManager.moveTaskToTop(stack.topTask().taskId);
|
||||||
return homeInFront;
|
return homeInFront;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2351,7 +2356,7 @@ public final class ActivityStackSupervisor {
|
|||||||
pw.print(prefix); pw.print("mStackState="); pw.println(stackStateToString(mStackState));
|
pw.print(prefix); pw.print("mStackState="); pw.println(stackStateToString(mStackState));
|
||||||
pw.print(prefix); pw.println("mSleepTimeout: " + mSleepTimeout);
|
pw.print(prefix); pw.println("mSleepTimeout: " + mSleepTimeout);
|
||||||
pw.print(prefix); pw.println("mCurTaskId: " + mCurTaskId);
|
pw.print(prefix); pw.println("mCurTaskId: " + mCurTaskId);
|
||||||
pw.print(prefix); pw.println("mUserHomeInFront: " + mUserHomeInFront);
|
pw.print(prefix); pw.println("mUserStackInFront: " + mUserStackInFront);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<ActivityRecord> getDumpActivitiesLocked(String name) {
|
ArrayList<ActivityRecord> getDumpActivitiesLocked(String name) {
|
||||||
|
Reference in New Issue
Block a user