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

Commit 95da7aee authored by Massimo Carli's avatar Massimo Carli
Browse files

[55/n] Rename confusing variable name

The name resolvedOrientation is ambiguous because it could
be misinterpreted as the final orientation after considering
all factors, including those in resolveOverrideConfiguration().

However, at this point in the code, it only reflects the
immediate override state, which can be further modified by
subclasses overriding getOverrideOrientation().

Therefore, actualOverrideOrientation is a more accurate name
as it represents the actual override orientation that will be
used later.

Flag: EXEMPT Small fix
Bug: 360865550
Test: m

Change-Id: Ief309362de7743d0cc7bc86678c5b68ad29dc7ef
parent 8bd52970
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -1680,26 +1680,27 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
     * Sets the specified orientation of this container. It percolates this change upward along the
     * hierarchy to let each level of the hierarchy a chance to respond to it.
     *
     * @param orientation the specified orientation. Needs to be one of {@link ScreenOrientation}.
     * @param requestedOrientation the specified orientation. Needs to be one of
     *                             {@link ScreenOrientation}.
     * @param requestingContainer the container which orientation request has changed. Mostly used
     *                            to ensure it gets correct configuration.
     * @return the resolved override orientation of this window container.
     */
    @ScreenOrientation
    int setOrientation(@ScreenOrientation int orientation,
    int setOrientation(@ScreenOrientation int requestedOrientation,
            @Nullable WindowContainer requestingContainer) {
        if (getOverrideOrientation() == orientation) {
            return orientation;
        if (getOverrideOrientation() == requestedOrientation) {
            return requestedOrientation;
        }
        setOverrideOrientation(orientation);
        setOverrideOrientation(requestedOrientation);
        final WindowContainer parent = getParent();
        if (parent == null) {
            return orientation;
            return requestedOrientation;
        }
        // The derived class can return a result that is different from the given orientation.
        final int resolvedOrientation = getOverrideOrientation();
        final int actualOverrideOrientation = getOverrideOrientation();
        if (getConfiguration().orientation != getRequestedConfigurationOrientation(
                false /* forDisplay */, resolvedOrientation)
                false /* forDisplay */, actualOverrideOrientation)
                // Update configuration directly only if the change won't be dispatched from
                // ancestor. This prevents from computing intermediate configuration when the
                // parent also needs to be updated from the ancestor. E.g. the app requests
@@ -1707,12 +1708,12 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
                // the task can be updated to portrait first so the configuration can be
                // computed in a consistent environment.
                && (inMultiWindowMode()
                        || !handlesOrientationChangeFromDescendant(orientation))) {
                        || !handlesOrientationChangeFromDescendant(requestedOrientation))) {
            // Resolve the requested orientation.
            onConfigurationChanged(parent.getConfiguration());
        }
        onDescendantOrientationChanged(requestingContainer);
        return resolvedOrientation;
        return actualOverrideOrientation;
    }

    @ScreenOrientation