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

Commit 3f93e802 authored by Jiaming Liu's avatar Jiaming Liu
Browse files

Remove logic that blocks surface update of system organized TF

This is a partial revert of ag/24271345. Now we have ag/25227916 merged
to allow RemoteTransition, we have a better mechanism to block unwanted
surface updates, so the original logic might not be needed any more.

Bug: 284050041
Test: atest TaskFragmentOrganizerControllerTest TaskFragmentTest WindowFlagsTest
Change-Id: I38d8d9c3099579dbe7b70b072f3b1b8f5fac00e4
parent 0bab1185
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -273,11 +273,6 @@ class TaskFragment extends WindowContainer<WindowContainer> {
     */
    boolean mClearedForReorderActivityToFront;

    /**
     * Whether the TaskFragment surface is managed by a system {@link TaskFragmentOrganizer}.
     */
    boolean mIsSurfaceManagedBySystemOrganizer = false;

    /**
     * When we are in the process of pausing an activity, before starting the
     * next one, this variable holds the activity that is currently being paused.
@@ -453,21 +448,13 @@ class TaskFragment extends WindowContainer<WindowContainer> {

    void setTaskFragmentOrganizer(@NonNull TaskFragmentOrganizerToken organizer, int uid,
            @NonNull String processName) {
        setTaskFragmentOrganizer(organizer, uid, processName,
                false /* isSurfaceManagedBySystemOrganizer */);
    }

    void setTaskFragmentOrganizer(@NonNull TaskFragmentOrganizerToken organizer, int uid,
            @NonNull String processName, boolean isSurfaceManagedBySystemOrganizer) {
        mTaskFragmentOrganizer = ITaskFragmentOrganizer.Stub.asInterface(organizer.asBinder());
        mTaskFragmentOrganizerUid = uid;
        mTaskFragmentOrganizerProcessName = processName;
        mIsSurfaceManagedBySystemOrganizer = isSurfaceManagedBySystemOrganizer;
    }

    void onTaskFragmentOrganizerRemoved() {
        mTaskFragmentOrganizer = null;
        mIsSurfaceManagedBySystemOrganizer = false;
    }

    /** Whether this TaskFragment is organized by the given {@code organizer}. */
@@ -2454,9 +2441,6 @@ class TaskFragment extends WindowContainer<WindowContainer> {
        if (mDelayOrganizedTaskFragmentSurfaceUpdate || mTaskFragmentOrganizer == null) {
            return;
        }
        if (mIsSurfaceManagedBySystemOrganizer) {
            return;
        }
        if (mTransitionController.isShellTransitionsEnabled()
                && !mTransitionController.isCollecting(this)) {
            // TaskFragmentOrganizer doesn't have access to the surface for security reasons, so
+1 −2
Original line number Diff line number Diff line
@@ -2117,8 +2117,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
        // actions.
        TaskFragmentOrganizerToken organizerToken = creationParams.getOrganizer();
        taskFragment.setTaskFragmentOrganizer(organizerToken,
                ownerActivity.getUid(), ownerActivity.info.processName,
                mTaskFragmentOrganizerController.isSystemOrganizer(organizerToken.asBinder()));
                ownerActivity.getUid(), ownerActivity.info.processName);
        final int position;
        if (creationParams.getPairedPrimaryFragmentToken() != null) {
            // When there is a paired primary TaskFragment, we want to place the new TaskFragment
+0 −15
Original line number Diff line number Diff line
@@ -27,12 +27,8 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.any;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyFloat;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyInt;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.clearInvocations;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.eq;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.never;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
@@ -129,17 +125,6 @@ public class TaskFragmentTest extends WindowTestsBase {
        assertEquals(parentSw, mTaskFragment.getConfiguration().smallestScreenWidthDp);
    }

    @Test
    public void testUpdateOrganizedTaskFragmentSurface_noSurfaceUpdateWhenOrganizedBySystem() {
        clearInvocations(mTransaction);
        mTaskFragment.mIsSurfaceManagedBySystemOrganizer = true;

        mTaskFragment.updateOrganizedTaskFragmentSurface();

        verify(mTransaction, never()).setPosition(eq(mLeash), anyFloat(), anyFloat());
        verify(mTransaction, never()).setWindowCrop(eq(mLeash), anyInt(), anyInt());
    }

    @Test
    public void testShouldStartChangeTransition_relativePositionChange() {
        final Task task = createTask(mDisplayContent, WINDOWING_MODE_MULTI_WINDOW,