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

Commit fe8c0109 authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Add logs for PiP exclusion bounds" into main

parents bca12d55 52691b0d
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -189,6 +189,8 @@ public class PipBoundsState implements PipDisplayLayoutState.DisplayIdListener {
    /** Set the current PIP bounds. */
    public void setBounds(@NonNull Rect bounds) {
        mBounds.set(bounds);
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "Update exclusion bounds to %s", bounds);
        for (Consumer<Rect> callback : mOnPipExclusionBoundsChangeCallbacks) {
            callback.accept(bounds);
        }
@@ -595,10 +597,10 @@ public class PipBoundsState implements PipDisplayLayoutState.DisplayIdListener {
     * Back-gesture handler, to avoid conflicting with PiP when it's stashed.
     */
    public void addPipExclusionBoundsChangeCallback(
            @Nullable Consumer<Rect> onPipExclusionBoundsChangeCallback) {
            @NonNull Consumer<Rect> onPipExclusionBoundsChangeCallback) {
        if (onPipExclusionBoundsChangeCallback != null) {
            mOnPipExclusionBoundsChangeCallbacks.add(onPipExclusionBoundsChangeCallback);
        for (Consumer<Rect> callback : mOnPipExclusionBoundsChangeCallbacks) {
            callback.accept(getBounds());
            onPipExclusionBoundsChangeCallback.accept(getBounds());
        }
    }

@@ -606,9 +608,11 @@ public class PipBoundsState implements PipDisplayLayoutState.DisplayIdListener {
     * Remove a callback that was previously added.
     */
    public void removePipExclusionBoundsChangeCallback(
            @Nullable Consumer<Rect> onPipExclusionBoundsChangeCallback) {
            @NonNull Consumer<Rect> onPipExclusionBoundsChangeCallback) {
        if (onPipExclusionBoundsChangeCallback != null) {
            mOnPipExclusionBoundsChangeCallbacks.remove(onPipExclusionBoundsChangeCallback);
        }
    }

    /** Adds callback to listen on aspect ratio change. */
    public void addOnAspectRatioChangedCallback(
+4 −0
Original line number Diff line number Diff line
@@ -778,6 +778,8 @@ public class PipController implements ConfigurationChangeListener,
        @Override
        public void addPipExclusionBoundsChangeListener(Consumer<Rect> listener) {
            mMainExecutor.execute(() -> {
                ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                        "addPipExclusionBoundsChangeListener: %s", listener);
                mPipBoundsState.addPipExclusionBoundsChangeCallback(listener);
            });
        }
@@ -785,6 +787,8 @@ public class PipController implements ConfigurationChangeListener,
        @Override
        public void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) {
            mMainExecutor.execute(() -> {
                ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                        "removePipExclusionBoundsChangeListener: %s", listener);
                mPipBoundsState.removePipExclusionBoundsChangeCallback(listener);
            });
        }