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

Commit b042d4aa authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Merge "Fix remaining to-do items of building TaskFragment" into sc-v2-dev

parents a2ac4727 d9cb138e
Loading
Loading
Loading
Loading
+2 −18
Original line number Diff line number Diff line
@@ -1334,7 +1334,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                updatePictureInPictureMode(null, false);
            } else {
                mLastReportedMultiWindowMode = inMultiWindowMode;
                computeConfigurationAfterMultiWindowModeChange();
                // If the activity is in stopping or stopped state, for instance, it's in the
                // split screen task and not the top one, the last configuration it should keep
                // is the one before multi-window mode change.
@@ -1361,26 +1360,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            // precede the configuration change from the resize.
            mLastReportedPictureInPictureMode = inPictureInPictureMode;
            mLastReportedMultiWindowMode = inPictureInPictureMode;
            if (targetRootTaskBounds != null && !targetRootTaskBounds.isEmpty()) {
                computeConfigurationAfterMultiWindowModeChange();
            }
            ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS,
                    true /* ignoreVisibility */);
        }
    }

    private void computeConfigurationAfterMultiWindowModeChange() {
        final Configuration newConfig = new Configuration();
        final TaskFragment taskFrag = getTaskFragment();
        newConfig.setTo(taskFrag.getRequestedOverrideConfiguration());
        Rect outBounds = newConfig.windowConfiguration.getBounds();
        // TODO(b/189384393): which parent does this Activity really needed?
        // I guess we should either call getRootTask or getDisplayArea for this case.
        final Configuration parentConfig = taskFrag.getParent().getConfiguration();
        taskFrag.adjustForMinimalTaskDimensions(outBounds, outBounds, parentConfig);
        taskFrag.computeConfigResourceOverrides(newConfig, parentConfig);
    }

    Task getTask() {
        return task;
    }
@@ -3207,8 +3191,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        // Clear last paused activity to ensure top activity can be resumed during sleeping.
        if (isNextNotYetVisible && mDisplayContent.isSleeping()
                && next == next.getRootTask().mLastPausedActivity) {
            next.getRootTask().mLastPausedActivity = null;
                && next == next.getTaskFragment().mLastPausedActivity) {
            next.getTaskFragment().clearLastPausedActivity();
        }

        if (isCurrentVisible) {
+4 −5
Original line number Diff line number Diff line
@@ -1657,7 +1657,6 @@ class ActivityStarter {
     *
     * Note: This method should only be called from {@link #startActivityUnchecked}.
     */

    // TODO(b/152429287): Make it easier to exercise code paths through startActivityInner
    @VisibleForTesting
    int startActivityInner(final ActivityRecord r, ActivityRecord sourceRecord,
@@ -1764,7 +1763,7 @@ class ActivityStarter {
        mStartActivity.logStartActivity(
                EventLogTags.WM_CREATE_ACTIVITY, mStartActivity.getTask());

        mTargetRootTask.mLastPausedActivity = null;
        mStartActivity.getTaskFragment().clearLastPausedActivity();

        mRootWindowContainer.startPowerModeLaunchIfNeeded(
                false /* forceSend */, mStartActivity);
@@ -2041,7 +2040,7 @@ class ActivityStarter {
        }

        // For paranoia, make sure we have correctly resumed the top activity.
        topRootTask.mLastPausedActivity = null;
        top.getTaskFragment().clearLastPausedActivity();
        if (mDoResume) {
            mRootWindowContainer.resumeFocusedTasksTopActivities();
        }
@@ -2137,7 +2136,7 @@ class ActivityStarter {
                task.moveActivityToFrontLocked(act);
                act.updateOptionsLocked(mOptions);
                deliverNewIntent(act, intentGrants);
                mTargetRootTask.mLastPausedActivity = null;
                act.getTaskFragment().clearLastPausedActivity();
            } else {
                mAddingToTask = true;
            }
@@ -2565,7 +2564,7 @@ class ActivityStarter {
     */
    private void setTargetRootTaskIfNeeded(ActivityRecord intentActivity) {
        mTargetRootTask = intentActivity.getRootTask();
        mTargetRootTask.mLastPausedActivity = null;
        intentActivity.getTaskFragment().clearLastPausedActivity();
        Task intentTask = intentActivity.getTask();
        // If the target task is not in the front, then we need to bring it to the front...
        // except...  well, with SINGLE_TASK_LAUNCH it's not entirely clear. We'd like to have
+2 −0
Original line number Diff line number Diff line
@@ -3543,6 +3543,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        }
    }

    // TODO(b/191434136): handle this properly when we add multi-window support on secondary
    //  display.
    private void calculateDefaultMinimalSizeOfResizeableTasks() {
        final Resources res = mService.mContext.getResources();
        final float minimalSize = res.getDimension(
+7 −0
Original line number Diff line number Diff line
@@ -1474,6 +1474,13 @@ class Task extends TaskFragment {
        // Make sure the list of display UID allowlists is updated
        // now that this record is in a new task.
        mRootWindowContainer.updateUIDsPresentOnDisplay();

        // Only pass minimum dimensions for pure TaskFragment. Task's minimum dimensions must be
        // passed from Task constructor.
        final TaskFragment childTaskFrag = child.asTaskFragment();
        if (childTaskFrag != null && childTaskFrag.asTask() == null) {
            childTaskFrag.setMinDimensions(mMinWidth, mMinHeight);
        }
    }

    /** Called when an {@link ActivityRecord} is added as a descendant */
+1 −1
Original line number Diff line number Diff line
@@ -1405,7 +1405,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
        // Clear last paused activity if focused root task changed while sleeping, so that the
        // top activity of current focused task can be resumed.
        if (mDisplayContent.isSleeping()) {
            currentFocusedTask.mLastPausedActivity = null;
            currentFocusedTask.clearLastPausedActivity();
        }

        mLastFocusedRootTask = prevFocusedTask;
Loading