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

Commit 718d2324 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8803172 from faf0b610 to tm-qpr1-release

Change-Id: Iaed15c8dcc323a1f4c4bb072efae91ec35cd7ab9
parents 7761800f faf0b610
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ public class ScrollCaptureConnection extends IScrollCaptureConnection.Stub imple

    @BinderThread
    @Override
    public void close() {
    public synchronized void close() {
        Trace.instantForTrack(TRACE_TAG_GRAPHICS, TRACE_TRACK, "close");
        if (mActive) {
            Log.w(TAG, "close(): capture session still active! Ending now.");
+1 −0
Original line number Diff line number Diff line
@@ -2801,6 +2801,7 @@ public final class ViewRootImpl implements ViewParent,
        if (viewVisibilityChanged) {
            mAttachInfo.mWindowVisibility = viewVisibility;
            host.dispatchWindowVisibilityChanged(viewVisibility);
            mAttachInfo.mTreeObserver.dispatchOnWindowVisibilityChange(viewVisibility);
            if (viewUserVisibilityChanged) {
                host.dispatchVisibilityAggregated(viewVisibility == View.VISIBLE);
            }
+84 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public final class ViewTreeObserver {
    // Recursive listeners use CopyOnWriteArrayList
    private CopyOnWriteArrayList<OnWindowFocusChangeListener> mOnWindowFocusListeners;
    private CopyOnWriteArrayList<OnWindowAttachListener> mOnWindowAttachListeners;
    private CopyOnWriteArrayList<OnWindowVisibilityChangeListener> mOnWindowVisibilityListeners;
    private CopyOnWriteArrayList<OnGlobalFocusChangeListener> mOnGlobalFocusListeners;
    @UnsupportedAppUsage
    private CopyOnWriteArrayList<OnTouchModeChangeListener> mOnTouchModeChangeListeners;
@@ -105,6 +106,21 @@ public final class ViewTreeObserver {
        public void onWindowFocusChanged(boolean hasFocus);
    }

    /**
     * Interface definition for a callback to be invoked when the view hierarchy's window
     * visibility changes.
     *
     * @hide
     */
    public interface OnWindowVisibilityChangeListener {
        /**
         * Callback method to be invoked when the window visibility changes in the view tree.
         *
         * @param visibility The new visibility of the window.
         */
        void onWindowVisibilityChanged(@View.Visibility int visibility);
    }

    /**
     * Interface definition for a callback to be invoked when the focus state within
     * the view tree changes.
@@ -386,6 +402,14 @@ public final class ViewTreeObserver {
            }
        }

        if (observer.mOnWindowVisibilityListeners != null) {
            if (mOnWindowVisibilityListeners != null) {
                mOnWindowVisibilityListeners.addAll(observer.mOnWindowVisibilityListeners);
            } else {
                mOnWindowVisibilityListeners = observer.mOnWindowVisibilityListeners;
            }
        }

        if (observer.mOnGlobalFocusListeners != null) {
            if (mOnGlobalFocusListeners != null) {
                mOnGlobalFocusListeners.addAll(observer.mOnGlobalFocusListeners);
@@ -540,6 +564,49 @@ public final class ViewTreeObserver {
    }

    /**
     * Register a callback to be invoked when the window visibility changes.
     *
     * @param listener The callback to add
     *
     * @throws IllegalStateException If {@link #isAlive()} returns false
     *
     * @hide
     */
    public void addOnWindowVisibilityChangeListener(
            @NonNull OnWindowVisibilityChangeListener listener) {
        checkIsAlive();

        if (mOnWindowVisibilityListeners == null) {
            mOnWindowVisibilityListeners =
                new CopyOnWriteArrayList<OnWindowVisibilityChangeListener>();
        }

        mOnWindowVisibilityListeners.add(listener);
    }

    /**
     * Remove a previously installed window visibility callback.
     *
     * @param victim The callback to remove
     *
     * @throws IllegalStateException If {@link #isAlive()} returns false
     *
     * @see #addOnWindowVisibilityChangeListener(
     * android.view.ViewTreeObserver.OnWindowVisibilityChangeListener)
     *
     * @hide
     */
    public void removeOnWindowVisibilityChangeListener(
            @NonNull OnWindowVisibilityChangeListener victim) {
        checkIsAlive();
        if (mOnWindowVisibilityListeners == null) {
            return;
        }

        mOnWindowVisibilityListeners.remove(victim);
    }

    /*
     * Register a callback to be invoked when the focus state within the view tree changes.
     *
     * @param listener The callback to add
@@ -1025,6 +1092,23 @@ public final class ViewTreeObserver {
        }
    }

    /**
     * Notifies registered listeners that window visibility has changed.
     */
    void dispatchOnWindowVisibilityChange(int visibility) {
        // NOTE: because of the use of CopyOnWriteArrayList, we *must* use an iterator to
        // perform the dispatching. The iterator is a safe guard against listeners that
        // could mutate the list by calling the various add/remove methods. This prevents
        // the array from being modified while we iterate it.
        final CopyOnWriteArrayList<OnWindowVisibilityChangeListener> listeners =
                mOnWindowVisibilityListeners;
        if (listeners != null && listeners.size() > 0) {
            for (OnWindowVisibilityChangeListener listener : listeners) {
                listener.onWindowVisibilityChanged(visibility);
            }
        }
    }

    /**
     * Notifies registered listeners that focus has changed.
     */
+17 −12
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.view;

import static android.view.Gravity.DISPLAY_CLIP_HORIZONTAL;
import static android.view.Gravity.DISPLAY_CLIP_VERTICAL;
import static android.view.InsetsState.ITYPE_IME;
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
import static android.view.InsetsState.ITYPE_STATUS_BAR;
@@ -275,17 +273,9 @@ public class WindowLayout {
            Gravity.applyDisplay(attrs.gravity, outDisplayFrame, outFrame);
        }

        if (extendedByCutout && !displayCutoutSafe.contains(outFrame)) {
            mTempRect.set(outFrame);

            // Move the frame into displayCutoutSafe.
            final int clipFlags = DISPLAY_CLIP_VERTICAL | DISPLAY_CLIP_HORIZONTAL;
            Gravity.applyDisplay(attrs.gravity & ~clipFlags, displayCutoutSafe,
        if (extendedByCutout) {
            extendFrameByCutout(attrs.gravity, displayCutoutSafe, outDisplayFrame, outFrame,
                    mTempRect);

            if (mTempRect.intersect(outDisplayFrame)) {
                outFrame.union(mTempRect);
            }
        }

        if (DEBUG) Log.d(TAG, "computeFrames " + attrs.getTitle()
@@ -301,6 +291,21 @@ public class WindowLayout {
                + " requestedVisibilities=" + requestedVisibilities);
    }

    public static void extendFrameByCutout(int gravity, Rect displayCutoutSafe,
            Rect displayFrame, Rect inOutFrame, Rect tempRect) {
        if (displayCutoutSafe.contains(inOutFrame)) {
            return;
        }
        tempRect.set(inOutFrame);

        // Move the frame into displayCutoutSafe.
        Gravity.applyDisplay(0 /* gravity */, displayCutoutSafe, tempRect);

        if (tempRect.intersect(displayFrame)) {
            inOutFrame.union(tempRect);
        }
    }

    public static void computeSurfaceSize(WindowManager.LayoutParams attrs, Rect maxBounds,
            int requestedWidth, int requestedHeight, Rect winFrame, boolean dragResizing,
            Point outSurfaceSize) {
+4 −3
Original line number Diff line number Diff line
@@ -150,15 +150,16 @@ constructor(
    fun showFromDialog(
        dialog: Dialog,
        animateFrom: Dialog,
        cuj: DialogCuj? = null,
        animateBackgroundBoundsChange: Boolean = false
    ) {
        val view =
            openedDialogs.firstOrNull { it.dialog == animateFrom }?.dialogContentWithBackground
                ?: throw IllegalStateException(
                    "The animateFrom dialog was not animated using " +
                        "DialogLaunchAnimator.showFrom(View|Dialog)"
                )
        showFromView(dialog, view, animateBackgroundBoundsChange = animateBackgroundBoundsChange)
                        "DialogLaunchAnimator.showFrom(View|Dialog)")
        showFromView(
            dialog, view, animateBackgroundBoundsChange = animateBackgroundBoundsChange, cuj = cuj)
    }

    /**
Loading