Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java +24 −1 Original line number Diff line number Diff line Loading @@ -125,6 +125,7 @@ public class PipBoundsState { private @Nullable Runnable mOnMinimalSizeChangeCallback; private @Nullable TriConsumer<Boolean, Integer, Boolean> mOnShelfVisibilityChangeCallback; private List<Consumer<Rect>> mOnPipExclusionBoundsChangeCallbacks = new ArrayList<>(); private List<Consumer<Float>> mOnAspectRatioChangedCallbacks = new ArrayList<>(); // the size of the current bounds relative to the max size spec private float mBoundsScale; Loading Loading @@ -297,7 +298,12 @@ public class PipBoundsState { /** Set the PIP aspect ratio. */ public void setAspectRatio(float aspectRatio) { if (Float.compare(mAspectRatio, aspectRatio) != 0) { mAspectRatio = aspectRatio; for (Consumer<Float> callback : mOnAspectRatioChangedCallbacks) { callback.accept(mAspectRatio); } } } /** Get the PIP aspect ratio. */ Loading Loading @@ -527,6 +533,23 @@ public class PipBoundsState { mOnPipExclusionBoundsChangeCallbacks.remove(onPipExclusionBoundsChangeCallback); } /** Adds callback to listen on aspect ratio change. */ public void addOnAspectRatioChangedCallback( @NonNull Consumer<Float> onAspectRatioChangedCallback) { if (!mOnAspectRatioChangedCallbacks.contains(onAspectRatioChangedCallback)) { mOnAspectRatioChangedCallbacks.add(onAspectRatioChangedCallback); onAspectRatioChangedCallback.accept(mAspectRatio); } } /** Removes callback to listen on aspect ratio change. */ public void removeOnAspectRatioChangedCallback( @NonNull Consumer<Float> onAspectRatioChangedCallback) { if (mOnAspectRatioChangedCallbacks.contains(onAspectRatioChangedCallback)) { mOnAspectRatioChangedCallbacks.remove(onAspectRatioChangedCallback); } } public LauncherState getLauncherState() { return mLauncherState; } Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java +1 −0 Original line number Diff line number Diff line Loading @@ -219,6 +219,7 @@ public class PipTouchHandler { mMotionHelper, pipTaskOrganizer, mPipBoundsAlgorithm.getSnapAlgorithm(), this::onAccessibilityShowMenu, this::updateMovementBounds, this::animateToUnStashedState, mainExecutor); mPipBoundsState.addOnAspectRatioChangedCallback(this::updateMinMaxSize); // TODO(b/181599115): This should really be initializes as part of the pip controller, but // until all PIP implementations derive from the controller, just initialize the touch handler Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTouchHandler.java +1 −0 Original line number Diff line number Diff line Loading @@ -208,6 +208,7 @@ public class PipTouchHandler { new PipResizeGestureHandler(context, pipBoundsAlgorithm, pipBoundsState, mTouchState, this::updateMovementBounds, pipUiEventLogger, menuController, mainExecutor, mPipPerfHintController); mPipBoundsState.addOnAspectRatioChangedCallback(this::updateMinMaxSize); if (PipUtils.isPip2ExperimentEnabled()) { shellInit.addInitCallback(this::onInit, this); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java +24 −1 Original line number Diff line number Diff line Loading @@ -125,6 +125,7 @@ public class PipBoundsState { private @Nullable Runnable mOnMinimalSizeChangeCallback; private @Nullable TriConsumer<Boolean, Integer, Boolean> mOnShelfVisibilityChangeCallback; private List<Consumer<Rect>> mOnPipExclusionBoundsChangeCallbacks = new ArrayList<>(); private List<Consumer<Float>> mOnAspectRatioChangedCallbacks = new ArrayList<>(); // the size of the current bounds relative to the max size spec private float mBoundsScale; Loading Loading @@ -297,7 +298,12 @@ public class PipBoundsState { /** Set the PIP aspect ratio. */ public void setAspectRatio(float aspectRatio) { if (Float.compare(mAspectRatio, aspectRatio) != 0) { mAspectRatio = aspectRatio; for (Consumer<Float> callback : mOnAspectRatioChangedCallbacks) { callback.accept(mAspectRatio); } } } /** Get the PIP aspect ratio. */ Loading Loading @@ -527,6 +533,23 @@ public class PipBoundsState { mOnPipExclusionBoundsChangeCallbacks.remove(onPipExclusionBoundsChangeCallback); } /** Adds callback to listen on aspect ratio change. */ public void addOnAspectRatioChangedCallback( @NonNull Consumer<Float> onAspectRatioChangedCallback) { if (!mOnAspectRatioChangedCallbacks.contains(onAspectRatioChangedCallback)) { mOnAspectRatioChangedCallbacks.add(onAspectRatioChangedCallback); onAspectRatioChangedCallback.accept(mAspectRatio); } } /** Removes callback to listen on aspect ratio change. */ public void removeOnAspectRatioChangedCallback( @NonNull Consumer<Float> onAspectRatioChangedCallback) { if (mOnAspectRatioChangedCallbacks.contains(onAspectRatioChangedCallback)) { mOnAspectRatioChangedCallbacks.remove(onAspectRatioChangedCallback); } } public LauncherState getLauncherState() { return mLauncherState; } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java +1 −0 Original line number Diff line number Diff line Loading @@ -219,6 +219,7 @@ public class PipTouchHandler { mMotionHelper, pipTaskOrganizer, mPipBoundsAlgorithm.getSnapAlgorithm(), this::onAccessibilityShowMenu, this::updateMovementBounds, this::animateToUnStashedState, mainExecutor); mPipBoundsState.addOnAspectRatioChangedCallback(this::updateMinMaxSize); // TODO(b/181599115): This should really be initializes as part of the pip controller, but // until all PIP implementations derive from the controller, just initialize the touch handler Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTouchHandler.java +1 −0 Original line number Diff line number Diff line Loading @@ -208,6 +208,7 @@ public class PipTouchHandler { new PipResizeGestureHandler(context, pipBoundsAlgorithm, pipBoundsState, mTouchState, this::updateMovementBounds, pipUiEventLogger, menuController, mainExecutor, mPipPerfHintController); mPipBoundsState.addOnAspectRatioChangedCallback(this::updateMinMaxSize); if (PipUtils.isPip2ExperimentEnabled()) { shellInit.addInitCallback(this::onInit, this); Loading