diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipBoundsAlgorithm.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipBoundsAlgorithm.java index d6dacd14f5364..1aefd77419aaf 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipBoundsAlgorithm.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipBoundsAlgorithm.java @@ -95,13 +95,14 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: getEntryDestinationBounds()", TAG); } - if (mTvPipBoundsState.isTvExpandedPipSupported() + updateExpandedPipSize(); + final boolean isPipExpanded = mTvPipBoundsState.isTvExpandedPipSupported() && mTvPipBoundsState.getDesiredTvExpandedAspectRatio() != 0 - && !mTvPipBoundsState.isTvPipManuallyCollapsed()) { - updateExpandedPipSize(); + && !mTvPipBoundsState.isTvPipManuallyCollapsed(); + if (isPipExpanded) { updateGravityOnExpandToggled(Gravity.NO_GRAVITY, true); - mTvPipBoundsState.setTvPipExpanded(true); } + mTvPipBoundsState.setTvPipExpanded(isPipExpanded); return getTvPipBounds().getBounds(); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java index ccd054aa7680d..9529d04fe1852 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java @@ -303,7 +303,7 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { */ private boolean actionsMatch(RemoteAction action1, RemoteAction action2) { if (action1 == action2) return true; - if (action1 == null) return false; + if (action1 == null || action2 == null) return false; return Objects.equals(action1.getTitle(), action2.getTitle()) && Objects.equals(action1.getContentDescription(), action2.getContentDescription()) && Objects.equals(action1.getActionIntent(), action2.getActionIntent());