summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wei Sheng Shih <wilsonshih@google.com> 2024-04-15 02:29:33 +0000
committer Wei Sheng Shih <wilsonshih@google.com> 2024-04-15 03:52:03 +0000
commit6b8dc68ca33a76f3612960ee80c84c186fb1246f (patch)
tree0793fc8489c5a3abd715b6b93437291758a6bfff
parentbec26a072882e596d27ec1a6ed1ba700ad5cc310 (diff)
Revert "Correct activity's lifecycle when the process was killed in background."
This reverts commit bec26a072882e596d27ec1a6ed1ba700ad5cc310. Reason for revert: 334702695 Change-Id: I4faa1b19476517c25908f7cdd37ea12cb1ad5183 Merged-In: I80756609fe643877971408934b19ad97aa0ae746
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskSupervisor.java11
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java5
2 files changed, 5 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
index 81fb78a26316..2cda1f55b038 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
@@ -57,7 +57,6 @@ import static com.android.server.wm.ActivityRecord.State.PAUSED;
import static com.android.server.wm.ActivityRecord.State.PAUSING;
import static com.android.server.wm.ActivityRecord.State.RESTARTING_PROCESS;
import static com.android.server.wm.ActivityRecord.State.RESUMED;
-import static com.android.server.wm.ActivityRecord.State.STOPPING;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_ALL;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_CLEANUP;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_IDLE;
@@ -105,7 +104,6 @@ import android.app.servertransaction.ActivityLifecycleItem;
import android.app.servertransaction.LaunchActivityItem;
import android.app.servertransaction.PauseActivityItem;
import android.app.servertransaction.ResumeActivityItem;
-import android.app.servertransaction.StopActivityItem;
import android.companion.virtual.VirtualDeviceManager;
import android.content.ComponentName;
import android.content.Context;
@@ -946,10 +944,8 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
if (andResume) {
lifecycleItem = ResumeActivityItem.obtain(r.token, isTransitionForward,
r.shouldSendCompatFakeFocus());
- } else if (r.isVisibleRequested()) {
- lifecycleItem = PauseActivityItem.obtain(r.token);
} else {
- lifecycleItem = StopActivityItem.obtain(r.token);
+ lifecycleItem = PauseActivityItem.obtain(r.token);
}
// Schedule transaction.
@@ -1016,7 +1012,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
// As part of the process of launching, ActivityThread also performs
// a resume.
rootTask.minimalResumeActivityLocked(r);
- } else if (r.isVisibleRequested()) {
+ } else {
// This activity is not starting in the resumed state... which should look like we asked
// it to pause+stop (but remain visible), and it has done so and reported back the
// current icicle and other state.
@@ -1024,9 +1020,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
+ "(starting in paused state)", r);
r.setState(PAUSED, "realStartActivityLocked");
mRootWindowContainer.executeAppTransitionForAllDisplay();
- } else {
- // This activity is starting while invisible, so it should be stopped.
- r.setState(STOPPING, "realStartActivityLocked");
}
// Perform OOM scoring after the activity state is set, so the process can be updated with
// the latest state.
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java
index da437c4d1d18..32b3558ba397 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java
@@ -33,7 +33,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
import static com.android.server.wm.ActivityRecord.State.PAUSED;
-import static com.android.server.wm.ActivityRecord.State.STOPPING;
import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE;
import static com.android.server.wm.WindowContainer.POSITION_TOP;
@@ -165,12 +164,13 @@ public class RecentsAnimationTest extends WindowTestsBase {
ActivityRecord recentsActivity = recentsStack.getTopNonFinishingActivity();
// The activity is started in background so it should be invisible and will be stopped.
assertThat(recentsActivity).isNotNull();
- assertThat(recentsActivity.getState()).isEqualTo(STOPPING);
+ assertThat(mSupervisor.mStoppingActivities).contains(recentsActivity);
assertFalse(recentsActivity.isVisibleRequested());
// Assume it is stopped to test next use case.
recentsActivity.activityStopped(null /* newIcicle */, null /* newPersistentState */,
null /* description */);
+ mSupervisor.mStoppingActivities.remove(recentsActivity);
spyOn(recentsActivity);
// Start when the recents activity exists. It should ensure the configuration.
@@ -178,6 +178,7 @@ public class RecentsAnimationTest extends WindowTestsBase {
null /* recentsAnimationRunner */);
verify(recentsActivity).ensureActivityConfiguration(eq(true) /* ignoreVisibility */);
+ assertThat(mSupervisor.mStoppingActivities).contains(recentsActivity);
}
@Test