From 84dedaffac0640322a17f2e2d4ce0fd8d281d112 Mon Sep 17 00:00:00 2001 From: Jacqueline Bronger Date: Thu, 24 Mar 2022 16:09:08 +0100 Subject: [PATCH 1/3] Fix orientation change between PiPs when collapsed Bug: 226571625 Fixes: 226571625 Test: manual - open vertical expanded PiP, close PiP, open horizontal expanded PiP Change-Id: I574e53d496b9b03539970f380b4ee1a5ec5d36fc --- .../src/com/android/wm/shell/pip/tv/TvPipBoundsAlgorithm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..40a5ae3313ec9 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,10 +95,10 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: getEntryDestinationBounds()", TAG); } + updateExpandedPipSize(); if (mTvPipBoundsState.isTvExpandedPipSupported() && mTvPipBoundsState.getDesiredTvExpandedAspectRatio() != 0 && !mTvPipBoundsState.isTvPipManuallyCollapsed()) { - updateExpandedPipSize(); updateGravityOnExpandToggled(Gravity.NO_GRAVITY, true); mTvPipBoundsState.setTvPipExpanded(true); } From b258b21892b5c1143008bcbc4db52a6cc30f8880 Mon Sep 17 00:00:00 2001 From: Jacqueline Bronger Date: Fri, 25 Mar 2022 11:29:48 +0100 Subject: [PATCH 2/3] Fix gravity issue when enabling expanded PiP (TV) Bug: 226570096 Fixes: 226570096 Test: manual - open expanded PiP, close PiP, open regular PiP, add expanded aspect ratio to the PiP Change-Id: I951db94a23ee1c885dfa508ea02f1329f604742e --- .../com/android/wm/shell/pip/tv/TvPipBoundsAlgorithm.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 40a5ae3313ec9..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 @@ -96,12 +96,13 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm { "%s: getEntryDestinationBounds()", TAG); } updateExpandedPipSize(); - if (mTvPipBoundsState.isTvExpandedPipSupported() + final boolean isPipExpanded = mTvPipBoundsState.isTvExpandedPipSupported() && mTvPipBoundsState.getDesiredTvExpandedAspectRatio() != 0 - && !mTvPipBoundsState.isTvPipManuallyCollapsed()) { + && !mTvPipBoundsState.isTvPipManuallyCollapsed(); + if (isPipExpanded) { updateGravityOnExpandToggled(Gravity.NO_GRAVITY, true); - mTvPipBoundsState.setTvPipExpanded(true); } + mTvPipBoundsState.setTvPipExpanded(isPipExpanded); return getTvPipBounds().getBounds(); } From 04fcd21d6c06cbd8b7759e2e4dc2c876e15cb031 Mon Sep 17 00:00:00 2001 From: Jacqueline Bronger Date: Fri, 25 Mar 2022 13:51:57 +0100 Subject: [PATCH 3/3] Fix NPE when PiP actions, but no close action set Bug: 226566586 Fixes: 226566586 Test: manual Change-Id: Ia7343c994a08fa3eba90decee83d65a0e91c43fe --- .../Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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());