Merge "Revert "Remove activity and window stacks when last task is removed.""
This commit is contained in:
committed by
Android (Google) Code Review
commit
e5afd8293d
@@ -7878,7 +7878,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
synchronized (this) {
|
||||
enforceCallingPermission(android.Manifest.permission.READ_FRAME_BUFFER,
|
||||
"getTaskThumbnail()");
|
||||
TaskRecord tr = mStackSupervisor.anyTaskForIdLocked(id, false);
|
||||
TaskRecord tr = mStackSupervisor.anyTaskForIdLocked(id);
|
||||
if (tr != null) {
|
||||
return tr.getTaskThumbnailLocked();
|
||||
}
|
||||
@@ -7991,7 +7991,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
@Override
|
||||
public void setTaskResizeable(int taskId, boolean resizeable) {
|
||||
synchronized (this) {
|
||||
TaskRecord task = mStackSupervisor.anyTaskForIdLocked(taskId, false);
|
||||
TaskRecord task = mStackSupervisor.anyTaskForIdLocked(taskId);
|
||||
if (task == null) {
|
||||
Slog.w(TAG, "setTaskResizeable: taskId=" + taskId + " not found");
|
||||
return;
|
||||
@@ -8158,7 +8158,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
* @return Returns true if the given task was found and removed.
|
||||
*/
|
||||
private boolean removeTaskByIdLocked(int taskId, boolean killProcess) {
|
||||
TaskRecord tr = mStackSupervisor.anyTaskForIdLocked(taskId, false);
|
||||
TaskRecord tr = mStackSupervisor.anyTaskForIdLocked(taskId);
|
||||
if (tr != null) {
|
||||
tr.removeTaskActivitiesLocked();
|
||||
cleanUpRemovedTaskLocked(tr, killProcess);
|
||||
@@ -8411,7 +8411,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
synchronized (this) {
|
||||
TaskRecord tr = mStackSupervisor.anyTaskForIdLocked(taskId, false);
|
||||
TaskRecord tr = mStackSupervisor.anyTaskForIdLocked(taskId);
|
||||
return tr != null && tr.stack != null && tr.stack.isHomeStack();
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -4247,8 +4247,6 @@ final class ActivityStack {
|
||||
mActivityContainer.onTaskListEmptyLocked();
|
||||
}
|
||||
}
|
||||
|
||||
task.stack = null;
|
||||
}
|
||||
|
||||
TaskRecord createTaskRecord(int taskId, ActivityInfo info, Intent intent,
|
||||
|
||||
@@ -471,16 +471,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
||||
}
|
||||
|
||||
TaskRecord anyTaskForIdLocked(int id) {
|
||||
return anyTaskForIdLocked(id, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link TaskRecord} for the input id if available. Null otherwise.
|
||||
* @param id Id of the task we would like returned.
|
||||
* @param restoreFromRecents If the id was not in the active list, but was found in recents,
|
||||
* restore the task from recents to the active list.
|
||||
*/
|
||||
TaskRecord anyTaskForIdLocked(int id, boolean restoreFromRecents) {
|
||||
int numDisplays = mActivityDisplays.size();
|
||||
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
|
||||
ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
|
||||
@@ -501,10 +491,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!restoreFromRecents) {
|
||||
return task;
|
||||
}
|
||||
|
||||
if (!restoreRecentTaskLocked(task)) {
|
||||
if (DEBUG_RECENTS) Slog.w(TAG, "Couldn't restore task id=" + id + " found in recents");
|
||||
return null;
|
||||
@@ -539,7 +525,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
||||
if (mCurTaskId <= 0) {
|
||||
mCurTaskId = 1;
|
||||
}
|
||||
} while (anyTaskForIdLocked(mCurTaskId, false) != null);
|
||||
} while (anyTaskForIdLocked(mCurTaskId) != null);
|
||||
return mCurTaskId;
|
||||
}
|
||||
|
||||
@@ -2731,7 +2717,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
||||
final ArrayList<ActivityStack> homeDisplayStacks = mHomeStack.mStacks;
|
||||
for (int stackNdx = homeDisplayStacks.size() - 1; stackNdx >= 0; --stackNdx) {
|
||||
final ActivityStack tmpStack = homeDisplayStacks.get(stackNdx);
|
||||
if (!tmpStack.isHomeStack() && tmpStack.mFullscreen) {
|
||||
if (!tmpStack.isHomeStack()) {
|
||||
stack = tmpStack;
|
||||
break;
|
||||
}
|
||||
@@ -3993,10 +3979,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
||||
}
|
||||
|
||||
void onTaskListEmptyLocked() {
|
||||
mHandler.removeMessages(CONTAINER_TASK_LIST_EMPTY_TIMEOUT, this);
|
||||
detachLocked();
|
||||
deleteActivityContainer(this);
|
||||
mHandler.obtainMessage(CONTAINER_CALLBACK_TASK_LIST_EMPTY, this).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -4085,6 +4067,13 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
||||
return false;
|
||||
}
|
||||
|
||||
void onTaskListEmptyLocked() {
|
||||
mHandler.removeMessages(CONTAINER_TASK_LIST_EMPTY_TIMEOUT, this);
|
||||
detachLocked();
|
||||
deleteActivityContainer(this);
|
||||
mHandler.obtainMessage(CONTAINER_CALLBACK_TASK_LIST_EMPTY, this).sendToTarget();
|
||||
}
|
||||
|
||||
private void setSurfaceIfReadyLocked() {
|
||||
if (DEBUG_STACK) Slog.v(TAG, "setSurfaceIfReadyLocked: mDrawn=" + mDrawn +
|
||||
" mContainerState=" + mContainerState + " mSurface=" + mSurface);
|
||||
|
||||
Reference in New Issue
Block a user