Merge "Make sure to report wait result when clean up activities"

This commit is contained in:
TreeHugger Robot
2019-03-25 03:43:22 +00:00
committed by Android (Google) Code Review
3 changed files with 10 additions and 16 deletions

View File

@@ -2160,8 +2160,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.
@@ -2350,7 +2349,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;
@@ -2361,7 +2360,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;

View File

@@ -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);

View File

@@ -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;