Make sure to report wait result when clean up activities
Starting activity with ‘-W’ option from shell waited forever because activity was brought to top, but being removed from waiting visible activities (due to process was gone) without reporting the wait result. Also correcting the component to avoid waiting for a top finishing activity. Bug: 117579987 Test: atest ActivityManagerAmStartOptionsTests Change-Id: I7c1e6781544f0d794225a13fdf417475ff0598a3
This commit is contained in:
@@ -2159,8 +2159,7 @@ final class ActivityRecord extends ConfigurationContainer {
|
||||
}
|
||||
|
||||
if (nowVisible) {
|
||||
// We won't get a call to reportActivityVisibleLocked() so dismiss lockscreen now.
|
||||
mStackSupervisor.reportActivityVisibleLocked(this);
|
||||
mStackSupervisor.stopWaitingForActivityVisible(this);
|
||||
}
|
||||
|
||||
// Schedule an idle timeout in case the app doesn't do it for us.
|
||||
@@ -2349,7 +2348,7 @@ final class ActivityRecord extends ConfigurationContainer {
|
||||
final @LaunchState int launchState = info != null ? info.getLaunchState() : -1;
|
||||
mStackSupervisor.reportActivityLaunchedLocked(false /* timeout */, this,
|
||||
windowsDrawnDelayMs, launchState);
|
||||
mStackSupervisor.sendWaitingVisibleReportLocked(this);
|
||||
mStackSupervisor.stopWaitingForActivityVisible(this);
|
||||
finishLaunchTickingLocked();
|
||||
if (task != null) {
|
||||
task.hasBeenVisible = true;
|
||||
@@ -2360,7 +2359,7 @@ final class ActivityRecord extends ConfigurationContainer {
|
||||
/** Called when the windows associated app window container are visible. */
|
||||
public void onWindowsVisible() {
|
||||
synchronized (mAtmService.mGlobalLock) {
|
||||
mStackSupervisor.reportActivityVisibleLocked(this);
|
||||
mStackSupervisor.stopWaitingForActivityVisible(this);
|
||||
if (DEBUG_SWITCH) Log.v(TAG_SWITCH, "windowsVisibleLocked(): " + this);
|
||||
if (!nowVisible) {
|
||||
nowVisible = true;
|
||||
|
||||
@@ -553,18 +553,10 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
// down to the max limit while they are still waiting to finish.
|
||||
mFinishingActivities.remove(r);
|
||||
|
||||
for (int i = mWaitingForActivityVisible.size() - 1; i >= 0; --i) {
|
||||
if (mWaitingForActivityVisible.get(i).matches(r.mActivityComponent)) {
|
||||
mWaitingForActivityVisible.remove(i);
|
||||
}
|
||||
}
|
||||
stopWaitingForActivityVisible(r);
|
||||
}
|
||||
|
||||
void reportActivityVisibleLocked(ActivityRecord r) {
|
||||
sendWaitingVisibleReportLocked(r);
|
||||
}
|
||||
|
||||
void sendWaitingVisibleReportLocked(ActivityRecord r) {
|
||||
void stopWaitingForActivityVisible(ActivityRecord r) {
|
||||
boolean changed = false;
|
||||
for (int i = mWaitingForActivityVisible.size() - 1; i >= 0; --i) {
|
||||
final WaitInfo w = mWaitingForActivityVisible.get(i);
|
||||
|
||||
@@ -1538,10 +1538,13 @@ class ActivityStarter {
|
||||
if (!mAddingToTask && mReuseTask == null) {
|
||||
// We didn't do anything... but it was needed (a.k.a., client don't use that
|
||||
// intent!) And for paranoia, make sure we have correctly resumed the top activity.
|
||||
|
||||
resumeTargetStackIfNeeded();
|
||||
if (outActivity != null && outActivity.length > 0) {
|
||||
outActivity[0] = reusedActivity;
|
||||
// The reusedActivity could be finishing, for example of starting an
|
||||
// activity with FLAG_ACTIVITY_CLEAR_TOP flag. In that case, return the
|
||||
// top running activity in the task instead.
|
||||
outActivity[0] = reusedActivity.finishing
|
||||
? reusedActivity.getTaskRecord().getTopActivity() : reusedActivity;
|
||||
}
|
||||
|
||||
return mMovedToFront ? START_TASK_TO_FRONT : START_DELIVERED_TO_TOP;
|
||||
|
||||
Reference in New Issue
Block a user