Loading services/core/java/com/android/server/wm/ActivityRecord.java +7 −1 Original line number Diff line number Diff line Loading @@ -2065,7 +2065,8 @@ final class ActivityRecord extends ConfigurationContainer { * - should be either the topmost in task, or right below the top activity that is finishing * If all of these conditions are not met at the same time, the activity cannot be made active. */ private boolean shouldMakeActive(ActivityRecord activeActivity) { @VisibleForTesting boolean shouldMakeActive(ActivityRecord activeActivity) { // If the activity is stopped, stopping, cycle to an active state. We avoid doing // this when there is an activity waiting to become translucent as the extra binder // calls will lead to noticeable jank. A later call to Loading @@ -2080,6 +2081,11 @@ final class ActivityRecord extends ConfigurationContainer { return false; } if (!mStackSupervisor.readyToResume()) { // Making active is currently deferred (e.g. because an activity launch is in progress). return false; } if (this.mLaunchTaskBehind) { // This activity is being launched from behind, which means that it's not intended to be // presented to user right now, even if it's set to be visible. Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +11 −0 Original line number Diff line number Diff line Loading @@ -368,4 +368,15 @@ public class ActivityRecordTests extends ActivityTestsBase { verify(mService.getLifecycleManager()).scheduleTransaction(eq(mActivity.app.getThread()), eq(mActivity.appToken), eq(expected)); } @Test public void testShouldMakeActive_deferredResume() { mActivity.setState(ActivityStack.ActivityState.STOPPED, "Testing"); mSupervisor.beginDeferResume(); assertEquals(false, mActivity.shouldMakeActive(null /* activeActivity */)); mSupervisor.endDeferResume(); assertEquals(true, mActivity.shouldMakeActive(null /* activeActivity */)); } } Loading
services/core/java/com/android/server/wm/ActivityRecord.java +7 −1 Original line number Diff line number Diff line Loading @@ -2065,7 +2065,8 @@ final class ActivityRecord extends ConfigurationContainer { * - should be either the topmost in task, or right below the top activity that is finishing * If all of these conditions are not met at the same time, the activity cannot be made active. */ private boolean shouldMakeActive(ActivityRecord activeActivity) { @VisibleForTesting boolean shouldMakeActive(ActivityRecord activeActivity) { // If the activity is stopped, stopping, cycle to an active state. We avoid doing // this when there is an activity waiting to become translucent as the extra binder // calls will lead to noticeable jank. A later call to Loading @@ -2080,6 +2081,11 @@ final class ActivityRecord extends ConfigurationContainer { return false; } if (!mStackSupervisor.readyToResume()) { // Making active is currently deferred (e.g. because an activity launch is in progress). return false; } if (this.mLaunchTaskBehind) { // This activity is being launched from behind, which means that it's not intended to be // presented to user right now, even if it's set to be visible. Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +11 −0 Original line number Diff line number Diff line Loading @@ -368,4 +368,15 @@ public class ActivityRecordTests extends ActivityTestsBase { verify(mService.getLifecycleManager()).scheduleTransaction(eq(mActivity.app.getThread()), eq(mActivity.appToken), eq(expected)); } @Test public void testShouldMakeActive_deferredResume() { mActivity.setState(ActivityStack.ActivityState.STOPPED, "Testing"); mSupervisor.beginDeferResume(); assertEquals(false, mActivity.shouldMakeActive(null /* activeActivity */)); mSupervisor.endDeferResume(); assertEquals(true, mActivity.shouldMakeActive(null /* activeActivity */)); } }