From 19dd84195e8acdbff6fe07fe1c35c1d5156d06d2 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Wed, 3 Jun 2020 08:45:39 -0400 Subject: [PATCH] Controls UI - Handle all apps removed Add a sanity check before showing controls, just in case all apps were removed while the controls views are shown. Fixes: 158009684 Test: Remove/disable all controlsproviderservice apps Change-Id: I72710353c3c7dd977c6fab87af99fe863b0fc3a3 --- .../systemui/controls/ui/ControlsUiControllerImpl.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt index 35ebac5b1ed5b..d31b6eb9d8572 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt @@ -129,7 +129,10 @@ class ControlsUiControllerImpl @Inject constructor ( SelectionItem(it.loadLabel(), "", it.loadIcon(), it.componentName) } uiExecutor.execute { - onResult(lastItems) + parent.removeAllViews() + if (lastItems.size > 0) { + onResult(lastItems) + } } } } @@ -189,8 +192,6 @@ class ControlsUiControllerImpl @Inject constructor ( } private fun showSeedingView(items: List) { - parent.removeAllViews() - val inflater = LayoutInflater.from(context) inflater.inflate(R.layout.controls_no_favorites, parent, true) val subtitle = parent.requireViewById(R.id.controls_subtitle) @@ -198,8 +199,6 @@ class ControlsUiControllerImpl @Inject constructor ( } private fun showInitialSetupView(items: List) { - parent.removeAllViews() - val inflater = LayoutInflater.from(context) inflater.inflate(R.layout.controls_no_favorites, parent, true) @@ -263,7 +262,6 @@ class ControlsUiControllerImpl @Inject constructor ( } private fun showControlsView(items: List) { - parent.removeAllViews() controlViewsById.clear() createListView()