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

Commit e96570e2 authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Refactor AttachInfo.mGlobalSystemUiVisibility"

parents 7f8743d5 1828adfa
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -28786,11 +28786,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
         */
        int mDisabledSystemUiVisibility;
        /**
         * Last global system UI visibility reported by the window manager.
         */
        int mGlobalSystemUiVisibility = -1;
        /**
         * True if a view in this hierarchy has an OnSystemUiVisibilityChangeListener
         * attached.
+26 −23
Original line number Diff line number Diff line
@@ -436,6 +436,8 @@ public final class ViewRootImpl implements ViewParent,
    @UnsupportedAppUsage
    final View.AttachInfo mAttachInfo;
    final SystemUiVisibilityInfo mCompatibleVisibilityInfo;
    int mDispatchedSystemUiVisibility =
            ViewRootImpl.sNewInsetsMode == NEW_INSETS_MODE_FULL ? 0 : -1;
    InputQueue.Callback mInputQueueCallback;
    InputQueue mInputQueue;
    @UnsupportedAppUsage
@@ -1946,11 +1948,33 @@ public final class ViewRootImpl implements ViewParent,
        } else {
            info.globalVisibility |= systemUiFlag;
        }
        if (mAttachInfo.mGlobalSystemUiVisibility != info.globalVisibility) {
        if (mDispatchedSystemUiVisibility != info.globalVisibility) {
            scheduleTraversals();
        }
    }

    private void handleDispatchSystemUiVisibilityChanged(SystemUiVisibilityInfo args) {
        if (mSeq != args.seq && sNewInsetsMode != NEW_INSETS_MODE_FULL) {
            // The sequence has changed, so we need to update our value and make
            // sure to do a traversal afterward so the window manager is given our
            // most recent data.
            mSeq = args.seq;
            mAttachInfo.mForceReportNewAttributes = true;
            scheduleTraversals();
        }
        if (mView == null) return;
        if (args.localChanges != 0) {
            mView.updateLocalSystemUiVisibility(args.localValue, args.localChanges);
            args.localChanges = 0;
        }

        final int visibility = args.globalVisibility & View.SYSTEM_UI_CLEARABLE_FLAGS;
        if (mDispatchedSystemUiVisibility != visibility) {
            mDispatchedSystemUiVisibility = visibility;
            mView.dispatchSystemUiVisibilityChanged(visibility);
        }
    }

    @VisibleForTesting
    public static void adjustLayoutParamsForCompatibility(WindowManager.LayoutParams inOutParams) {
        if (sNewInsetsMode != NEW_INSETS_MODE_FULL) {
@@ -7183,28 +7207,6 @@ public final class ViewRootImpl implements ViewParent,
        event.recycle();
    }

    public void handleDispatchSystemUiVisibilityChanged(SystemUiVisibilityInfo args) {
        if (mSeq != args.seq && sNewInsetsMode != NEW_INSETS_MODE_FULL) {
            // The sequence has changed, so we need to update our value and make
            // sure to do a traversal afterward so the window manager is given our
            // most recent data.
            mSeq = args.seq;
            mAttachInfo.mForceReportNewAttributes = true;
            scheduleTraversals();
        }
        if (mView == null) return;
        if (args.localChanges != 0) {
            mView.updateLocalSystemUiVisibility(args.localValue, args.localChanges);
            args.localChanges = 0;
        }

        int visibility = args.globalVisibility&View.SYSTEM_UI_CLEARABLE_FLAGS;
        if (visibility != mAttachInfo.mGlobalSystemUiVisibility) {
            mAttachInfo.mGlobalSystemUiVisibility = visibility;
            mView.dispatchSystemUiVisibilityChanged(visibility);
        }
    }

    /**
     * Notify that the window title changed
     */
@@ -8374,6 +8376,7 @@ public final class ViewRootImpl implements ViewParent,
        mHandler.sendMessage(msg);
    }

    // TODO(118118435): Remove this after migration
    public void dispatchSystemUiVisibilityChanged(int seq, int globalVisibility,
            int localValue, int localChanges) {
        SystemUiVisibilityInfo args = new SystemUiVisibilityInfo();