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

Commit 7239f180 authored by Robin Lee's avatar Robin Lee Committed by Automerger Merge Worker
Browse files

Merge "Update surface visibility state when forcing visible" into udc-qpr-dev am: 7adb5b9f

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


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


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


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

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


    /**
    /**