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

Commit 8d44d530 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Update layout direction if ViewRoot is preserved" into tm-qpr-dev am:...

Merge "Update layout direction if ViewRoot is preserved" into tm-qpr-dev am: 3c282790 am: 97fdee39

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20158130



Change-Id: Ia3c413d17e02c436ef22459c4b387d6fe890eb72
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 27fc753b 97fdee39
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -1101,7 +1101,7 @@ public final class ViewRootImpl implements ViewParent,

        // Update the last resource config in case the resource configuration was changed while
        // activity relaunched.
        mLastConfigurationFromResources.setTo(getConfiguration());
        updateLastConfigurationFromResources(getConfiguration());
    }

    private Configuration getConfiguration() {
@@ -5424,13 +5424,7 @@ public final class ViewRootImpl implements ViewParent,
            // Update the display with new DisplayAdjustments.
            updateInternalDisplay(mDisplay.getDisplayId(), localResources);

            final int lastLayoutDirection = mLastConfigurationFromResources.getLayoutDirection();
            final int currentLayoutDirection = config.getLayoutDirection();
            mLastConfigurationFromResources.setTo(config);
            if (lastLayoutDirection != currentLayoutDirection
                    && mViewLayoutDirectionInitial == View.LAYOUT_DIRECTION_INHERIT) {
                mView.setLayoutDirection(currentLayoutDirection);
            }
            updateLastConfigurationFromResources(config);
            mView.dispatchConfigurationChanged(config);

            // We could have gotten this {@link Configuration} update after we called
@@ -5444,6 +5438,17 @@ public final class ViewRootImpl implements ViewParent,
        updateForceDarkMode();
    }

    private void updateLastConfigurationFromResources(Configuration resConfig) {
        final int lastLayoutDirection = mLastConfigurationFromResources.getLayoutDirection();
        final int currentLayoutDirection = resConfig.getLayoutDirection();
        mLastConfigurationFromResources.setTo(resConfig);
        // Update layout direction in case the language or screen layout is changed.
        if (lastLayoutDirection != currentLayoutDirection && mView != null
                && mViewLayoutDirectionInitial == View.LAYOUT_DIRECTION_INHERIT) {
            mView.setLayoutDirection(currentLayoutDirection);
        }
    }

    /**
     * Return true if child is an ancestor of parent, (or equal to the parent).
     */