Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7fa8f964 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Make sure only the top-most running activity can be active" into rvc-dev am: 3b6ade6a

Change-Id: Ia99a6797ca5469be87c52e2ae69b0b64da8c0f14
parents 42bba8f8 3b6ade6a
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -4785,16 +4785,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (!task.hasChild(this)) {
            throw new IllegalStateException("Activity not found in its task");
        }
        final ActivityRecord activityAbove = task.getActivityAbove(this);
        if (activityAbove == null) {
            // It's the topmost activity in the task - should become resumed now
            return true;
        }
        // Check if activity above is finishing now and this one becomes the topmost in task.
        if (activityAbove.finishing) {
            return true;
        }
        return false;
        return task.topRunningActivity() == this;
    }

    void handleAlreadyVisible() {
+10 −0
Original line number Diff line number Diff line
@@ -487,6 +487,16 @@ public class ActivityRecordTests extends ActivityTestsBase {
        assertEquals(true, mActivity.shouldMakeActive(null /* activeActivity */));
    }

    @Test
    public void testShouldMakeActive_nonTopVisible() {
        ActivityRecord finishingActivity = new ActivityBuilder(mService).setTask(mTask).build();
        finishingActivity.finishing = true;
        ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build();
        mActivity.setState(ActivityStack.ActivityState.STOPPED, "Testing");

        assertEquals(false, mActivity.shouldMakeActive(null /* activeActivity */));
    }

    @Test
    public void testShouldResume_stackVisibility() {
        mActivity.setState(ActivityStack.ActivityState.STOPPED, "Testing");