From 0fbf9d56bc0452f927aced702a3b0fe630ba5a95 Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Mon, 20 Mar 2023 17:27:05 +0000 Subject: [PATCH] [Ongoing Call] Don't show the ongoing call chip when there's a HUN. Fixes: 262555609 Test: have ongoing call chip on launcher, then display HUN -> ongoing call chip hidden Test: have ongoing call chip while in a different app, then display HUN -> ongoing call chip hidden Test: atest CollapsedStatusBarFragmentTest Change-Id: I70e0e72a5dbc00c08e6b791afb87f7da290560fa --- .../phone/fragment/CollapsedStatusBarFragment.java | 10 +++++++--- .../fragment/CollapsedStatusBarFragmentTest.java | 13 +++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java index 2fe714533f5ac..4a15000d54e02 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java @@ -453,9 +453,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue protected int adjustDisableFlags(int state) { boolean headsUpVisible = mStatusBarFragmentComponent.getHeadsUpAppearanceController().shouldBeVisible(); - if (headsUpVisible) { - state |= DISABLE_CLOCK; - } if (!mKeyguardStateController.isLaunchTransitionFadingAway() && !mKeyguardStateController.isKeyguardFadingAway() @@ -473,6 +470,13 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue state |= DISABLE_ONGOING_CALL_CHIP; } + if (headsUpVisible) { + // Disable everything on the left side of the status bar, since the app name for the + // heads up notification appears there instead. + state |= DISABLE_CLOCK; + state |= DISABLE_ONGOING_CALL_CHIP; + } + return state; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java index 1e5782b91be8e..fa6ab236d5a1f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java @@ -332,6 +332,19 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { mFragment.getView().findViewById(R.id.ongoing_call_chip).getVisibility()); } + @Test + public void disable_hasOngoingCallButAlsoHun_chipHidden() { + CollapsedStatusBarFragment fragment = resumeAndGetFragment(); + + when(mOngoingCallController.hasOngoingCall()).thenReturn(true); + when(mHeadsUpAppearanceController.shouldBeVisible()).thenReturn(true); + + fragment.disable(DEFAULT_DISPLAY, 0, 0, false); + + assertEquals(View.GONE, + mFragment.getView().findViewById(R.id.ongoing_call_chip).getVisibility()); + } + @Test public void disable_ongoingCallEnded_chipHidden() { CollapsedStatusBarFragment fragment = resumeAndGetFragment();