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

Commit a4cc3a93 authored by Evan Rosky's avatar Evan Rosky
Browse files

Remove TaskRecord.updateOverrideConfig

Removing updateOverrideConfig since configs are already
updated via setBounds.

Bug: 119687367
Test: WmTests
Change-Id: Ib7a819404738b31e3a583e4e203ef6d9de47a02f
parent 9727c058
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -4410,7 +4410,13 @@ class ActivityStack extends ConfigurationContainer {
        for (int i = mTaskHistory.size() - 1; i >= 0; i--) {
            final TaskRecord task = mTaskHistory.get(i);
            if (task.isResizeable()) {
                task.updateOverrideConfiguration(taskBounds, tempTaskInsetBounds);
                if (tempTaskInsetBounds != null && !tempTaskInsetBounds.isEmpty()) {
                    task.setDisplayedBounds(taskBounds);
                    task.setBounds(tempTaskInsetBounds);
                } else {
                    task.setDisplayedBounds(null);
                    task.setBounds(taskBounds);
                }
            }
        }

@@ -4816,7 +4822,7 @@ class ActivityStack extends ConfigurationContainer {
        if (!mStackSupervisor.getLaunchParamsController()
                .layoutTask(task, info.windowLayout, activity, source, options)
                && !matchParentBounds() && task.isResizeable() && !isLockscreenShown) {
            task.updateOverrideConfiguration(getRequestedOverrideBounds());
            task.setBounds(getRequestedOverrideBounds());
        }
        task.createTask(toTop, (info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0);
        return task;
+1 −1
Original line number Diff line number Diff line
@@ -1402,7 +1402,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        boolean reparented = false;
        if (task.isResizeable() && canUseActivityOptionsLaunchBounds(options)) {
            final Rect bounds = options.getLaunchBounds();
            task.updateOverrideConfiguration(bounds);
            task.setBounds(bounds);

            ActivityStack stack =
                    mRootActivityContainer.getLaunchStack(null, options, task, ON_TOP);
+1 −1
Original line number Diff line number Diff line
@@ -2533,7 +2533,7 @@ class ActivityStarter {
            mService.resizeStack(
                    stack.mStackId, bounds, true, !PRESERVE_WINDOWS, ANIMATE, -1);
        } else {
            task.updateOverrideConfiguration(bounds);
            task.setBounds(bounds);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ class LaunchParamsController {

            if (task.getStack().inFreeformWindowingMode()) {
                // Only set bounds if it's in freeform mode.
                task.updateOverrideConfiguration(mTmpParams.mBounds);
                task.setBounds(mTmpParams.mBounds);
                return true;
            }

+10 −41
Original line number Diff line number Diff line
@@ -513,7 +513,7 @@ class TaskRecord extends ConfigurationContainer {
        if (!getWindowConfiguration().persistTaskBounds()) {
            // Reset current bounds for task whose bounds shouldn't be persisted so it uses
            // default configuration the next time it launches.
            updateOverrideConfiguration(null);
            setBounds(null);
        }
        mService.getTaskChangeNotificationController().notifyTaskRemoved(taskId);
    }
@@ -566,7 +566,7 @@ class TaskRecord extends ConfigurationContainer {
                // Task doesn't exist in window manager yet (e.g. was restored from recents).
                // All we can do for now is update the bounds so it can be used when the task is
                // added to window manager.
                updateOverrideConfiguration(bounds);
                setBounds(bounds);
                if (!inFreeformWindowingMode()) {
                    // re-restore the task so it can have the proper stack association.
                    mService.mStackSupervisor.restoreRecentTaskLocked(this, null, !ON_TOP);
@@ -585,7 +585,11 @@ class TaskRecord extends ConfigurationContainer {

            Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizeTask_" + taskId);

            final boolean updatedConfig = updateOverrideConfiguration(bounds);
            boolean updatedConfig = false;
            mTmpConfig.setTo(getResolvedOverrideConfiguration());
            if (setBounds(bounds) != BOUNDS_CHANGE_NONE) {
                updatedConfig = !mTmpConfig.equals(getResolvedOverrideConfiguration());
            }
            // This variable holds information whether the configuration didn't change in a significant

            // way and the activity was kept the way it was. If it's false, it means the activity
@@ -1805,15 +1809,6 @@ class TaskRecord extends ConfigurationContainer {
        }
    }

    /**
     * Update task's override configuration based on the bounds.
     * @param bounds The bounds of the task.
     * @return True if the override configuration was updated.
     */
    boolean updateOverrideConfiguration(Rect bounds) {
        return updateOverrideConfiguration(bounds, null /* insetBounds */);
    }

    void setLastNonFullscreenBounds(Rect bounds) {
        if (mLastNonFullscreenBounds == null) {
            mLastNonFullscreenBounds = new Rect(bounds);
@@ -1822,32 +1817,6 @@ class TaskRecord extends ConfigurationContainer {
        }
    }

    /**
     * Update task's override configuration based on the bounds.
     * @param bounds The bounds of the task.
     * @param insetBounds The bounds used to calculate the system insets, which is used here to
     *                    subtract the navigation bar/status bar size from the screen size reported
     *                    to the application. See {@link IActivityTaskManager#resizeDockedStack}.
     * @return True if the override configuration was updated.
     */
    boolean updateOverrideConfiguration(Rect bounds, @Nullable Rect insetBounds) {
        final boolean hasSetDisplayedBounds = (insetBounds != null && !insetBounds.isEmpty());
        if (hasSetDisplayedBounds) {
            setDisplayedBounds(bounds);
        } else {
            setDisplayedBounds(null);
        }
        // "steady" bounds do not include any temporary offsets from animation or interaction.
        Rect steadyBounds = hasSetDisplayedBounds ? insetBounds : bounds;
        if (equivalentRequestedOverrideBounds(steadyBounds)) {
            return false;
        }

        mTmpConfig.setTo(getResolvedOverrideConfiguration());
        setBounds(steadyBounds);
        return !mTmpConfig.equals(getResolvedOverrideConfiguration());
    }

    /**
     * This should be called when an child activity changes state. This should only
     * be called from
@@ -2299,7 +2268,7 @@ class TaskRecord extends ConfigurationContainer {

    Rect updateOverrideConfigurationFromLaunchBounds() {
        final Rect bounds = getLaunchBounds();
        updateOverrideConfiguration(bounds);
        setBounds(bounds);
        if (bounds != null && !bounds.isEmpty()) {
            // TODO: Review if we actually want to do this - we are setting the launch bounds
            // directly here.
@@ -2324,12 +2293,12 @@ class TaskRecord extends ConfigurationContainer {
                return;
            }
            if (mLastNonFullscreenBounds != null) {
                updateOverrideConfiguration(mLastNonFullscreenBounds);
                setBounds(mLastNonFullscreenBounds);
            } else {
                mService.mStackSupervisor.getLaunchParamsController().layoutTask(this, null);
            }
        } else {
            updateOverrideConfiguration(inStack.getRequestedOverrideBounds());
            setBounds(inStack.getRequestedOverrideBounds());
        }
    }