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

Commit 7adb5b9f authored by Robin Lee's avatar Robin Lee Committed by Android (Google) Code Review
Browse files

Merge "Update surface visibility state when forcing visible" into udc-qpr-dev

parents 77ad50a4 450cb0f9
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -700,7 +700,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    private boolean mCurrentLaunchCanTurnScreenOn = true;

    /** Whether our surface was set to be showing in the last call to {@link #prepareSurfaces} */
    private boolean mLastSurfaceShowing;
    boolean mLastSurfaceShowing;

    /**
     * The activity is opaque and fills the entire space of this task.
@@ -5345,11 +5345,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                // Finish should only ever commit visibility=false, so we can check full containment
                // rather than just direct membership.
                inFinishingTransition = mTransitionController.inFinishingTransition(this);
                if (!inFinishingTransition && (visible || !mDisplayContent.isSleeping())) {
                if (!inFinishingTransition) {
                    if (visible) {
                        if (!mDisplayContent.isSleeping() || canShowWhenLocked()) {
                            mTransitionController.onVisibleWithoutCollectingTransition(this,
                                    Debug.getCallers(1, 1));
                    } else {
                        }
                    } else if (!mDisplayContent.isSleeping()) {
                        Slog.w(TAG, "Set invisible without transition " + this);
                    }
                }
+2 −0
Original line number Diff line number Diff line
@@ -87,9 +87,11 @@ class ActivityRecordInputSink {
                activityBelowInTask.mAllowedTouchUid == mActivityRecord.getUid()
                        || activityBelowInTask.isUid(mActivityRecord.getUid()));
        if (allowPassthrough || !mIsCompatEnabled || mActivityRecord.isInTransition()) {
            // Set to non-touchable, so the touch events can pass through.
            mInputWindowHandleWrapper.setInputConfigMasked(InputConfig.NOT_TOUCHABLE,
                    InputConfig.NOT_TOUCHABLE);
        } else {
            // Set to touchable, so it can block by intercepting the touch events.
            mInputWindowHandleWrapper.setInputConfigMasked(0, InputConfig.NOT_TOUCHABLE);
        }
        mInputWindowHandleWrapper.setDisplayId(mActivityRecord.getDisplayId());
+8 −0
Original line number Diff line number Diff line
@@ -971,11 +971,19 @@ class TransitionController {
    private void enforceSurfaceVisible(WindowContainer<?> wc) {
        if (wc.mSurfaceControl == null) return;
        wc.getSyncTransaction().show(wc.mSurfaceControl);
        final ActivityRecord ar = wc.asActivityRecord();
        if (ar != null) {
            ar.mLastSurfaceShowing = true;
        }
        // Force showing the parents because they may be hidden by previous transition.
        for (WindowContainer<?> p = wc.getParent(); p != null && p != wc.mDisplayContent;
                p = p.getParent()) {
            if (p.mSurfaceControl != null) {
                p.getSyncTransaction().show(p.mSurfaceControl);
                final Task task = p.asTask();
                if (task != null) {
                    task.mLastSurfaceShowing = true;
                }
            }
        }
        wc.scheduleAnimation();
+13 −3
Original line number Diff line number Diff line
@@ -1179,10 +1179,12 @@ public class ActivityRecordTests extends WindowTestsBase {
    @Test
    public void testFinishActivityIfPossible_nonVisibleNoAppTransition() {
        registerTestTransitionPlayer();
        spyOn(mRootWindowContainer.mTransitionController);
        final ActivityRecord bottomActivity = createActivityWithTask();
        bottomActivity.setVisibility(false);
        bottomActivity.setState(STOPPED, "test");
        bottomActivity.mLastSurfaceShowing = false;
        final ActivityRecord activity = createActivityWithTask();
        // Put an activity on top of test activity to make it invisible and prevent us from
        // accidentally resuming the topmost one again.
        new ActivityBuilder(mAtm).build();
        activity.setVisibleRequested(false);
        activity.setState(STOPPED, "test");

@@ -1190,6 +1192,14 @@ public class ActivityRecordTests extends WindowTestsBase {

        verify(activity.mDisplayContent, never()).prepareAppTransition(eq(TRANSIT_CLOSE));
        assertFalse(activity.inTransition());

        // finishIfPossible -> completeFinishing -> addToFinishingAndWaitForIdle
        // -> resumeFocusedTasksTopActivities
        assertTrue(bottomActivity.isState(RESUMED));
        assertTrue(bottomActivity.isVisible());
        verify(mRootWindowContainer.mTransitionController).onVisibleWithoutCollectingTransition(
                eq(bottomActivity), any());
        assertTrue(bottomActivity.mLastSurfaceShowing);
    }

    /**