From b1e1a873224ad406aaba106974a4c64cbf81bd46 Mon Sep 17 00:00:00 2001 From: Caitlin Cassidy Date: Wed, 12 May 2021 14:31:29 +0000 Subject: [PATCH] [Ongoing Call Chip] Ensure the chip is at least 48x48dp for accessibility. (Also remove a TODO that seems to be fixed now.) Test: manual Bug: 183229367 Change-Id: Id19cdc35eb31d6a451e15e0a9bc03e78c65c745e --- .../SystemUI/res/layout/ongoing_call_chip.xml | 62 +++++++++++-------- .../phone/CollapsedStatusBarFragment.java | 2 +- .../ongoingcall/OngoingCallController.kt | 6 +- .../ongoingcall/OngoingCallChronometerTest.kt | 4 +- .../ongoingcall/OngoingCallControllerTest.kt | 11 ++-- 5 files changed, 45 insertions(+), 40 deletions(-) diff --git a/packages/SystemUI/res/layout/ongoing_call_chip.xml b/packages/SystemUI/res/layout/ongoing_call_chip.xml index 90214b781ba10..f8175d4766305 100644 --- a/packages/SystemUI/res/layout/ongoing_call_chip.xml +++ b/packages/SystemUI/res/layout/ongoing_call_chip.xml @@ -13,37 +13,45 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + - - - - - + android:layout_height="@dimen/ongoing_appops_chip_height" + android:layout_gravity="center_vertical" + android:gravity="center" + android:background="@drawable/ongoing_call_chip_bg" + android:paddingStart="@dimen/ongoing_call_chip_side_padding" + android:paddingEnd="@dimen/ongoing_call_chip_side_padding" + android:contentDescription="@string/ongoing_phone_call_content_description" + android:minWidth="@dimen/min_clickable_item_size" + > - + + + + + + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java index 7b0d30b2409b8..4752f3e6f0e08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java @@ -80,7 +80,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue private NetworkController mNetworkController; private LinearLayout mSystemIconArea; private View mClockView; - private ViewGroup mOngoingCallChip; + private View mOngoingCallChip; private View mNotificationIconAreaInner; private View mCenteredIconArea; private int mDisabled1; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt index 3fa87dd1a63e7..a0198950f3d64 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt @@ -23,7 +23,7 @@ import android.app.Notification import android.app.Notification.CallStyle.CALL_TYPE_ONGOING import android.content.Intent import android.util.Log -import android.view.ViewGroup +import android.view.View import android.widget.Chronometer import com.android.systemui.R import com.android.systemui.animation.ActivityLaunchAnimator @@ -57,7 +57,7 @@ class OngoingCallController @Inject constructor( private var ongoingCallInfo: OngoingCallInfo? = null /** True if the application managing the call is visible to the user. */ private var isCallAppVisible: Boolean = true - private var chipView: ViewGroup? = null + private var chipView: View? = null private var uidObserver: IUidObserver.Stub? = null private val mListeners: MutableList = mutableListOf() @@ -105,7 +105,7 @@ class OngoingCallController @Inject constructor( * * Should only be called from [CollapsedStatusBarFragment]. */ - fun setChipView(chipView: ViewGroup) { + fun setChipView(chipView: View) { this.chipView = chipView if (hasOngoingCall()) { updateChip() diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallChronometerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallChronometerTest.kt index 0e77bb36d68f8..e32af605955ba 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallChronometerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallChronometerTest.kt @@ -20,7 +20,6 @@ import android.testing.AndroidTestingRunner import android.testing.TestableLooper import android.view.LayoutInflater import android.view.View -import android.widget.LinearLayout import androidx.test.filters.SmallTest import com.android.systemui.R import com.android.systemui.SysuiTestCase @@ -48,8 +47,7 @@ class OngoingCallChronometerTest : SysuiTestCase() { fun setUp() { allowTestableLooperAsMainThread() TestableLooper.get(this).runWithLooper { - val chipView = LayoutInflater.from(mContext) - .inflate(R.layout.ongoing_call_chip, null) as LinearLayout + val chipView = LayoutInflater.from(mContext).inflate(R.layout.ongoing_call_chip, null) textView = chipView.findViewById(R.id.ongoing_call_chip_time)!! measureTextView() calculateDoesNotFixText() diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt index 930377ae55121..3a71ecf42699f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt @@ -27,6 +27,7 @@ import android.service.notification.NotificationListenerService.REASON_USER_STOP import android.testing.AndroidTestingRunner import android.testing.TestableLooper import android.view.LayoutInflater +import android.view.View import android.widget.LinearLayout import androidx.test.filters.SmallTest import com.android.internal.logging.testing.UiEventLoggerFake @@ -80,14 +81,13 @@ class OngoingCallControllerTest : SysuiTestCase() { @Mock private lateinit var mockActivityStarter: ActivityStarter @Mock private lateinit var mockIActivityManager: IActivityManager - private lateinit var chipView: LinearLayout + private lateinit var chipView: View @Before fun setUp() { allowTestableLooperAsMainThread() TestableLooper.get(this).runWithLooper { - chipView = LayoutInflater.from(mContext) - .inflate(R.layout.ongoing_call_chip, null) as LinearLayout + chipView = LayoutInflater.from(mContext).inflate(R.layout.ongoing_call_chip, null) } MockitoAnnotations.initMocks(this) @@ -225,10 +225,9 @@ class OngoingCallControllerTest : SysuiTestCase() { // Start an ongoing call. notifCollectionListener.onEntryUpdated(createOngoingCallNotifEntry()) - lateinit var newChipView: LinearLayout + lateinit var newChipView: View TestableLooper.get(this).runWithLooper { - newChipView = LayoutInflater.from(mContext) - .inflate(R.layout.ongoing_call_chip, null) as LinearLayout + newChipView = LayoutInflater.from(mContext).inflate(R.layout.ongoing_call_chip, null) } // Change the chip view associated with the controller.