From 37d84c35be908618e8d9f58223cee91586ef8bf4 Mon Sep 17 00:00:00 2001 From: Alejandro Nijamkin Date: Fri, 14 Oct 2022 11:30:12 -0700 Subject: [PATCH] Removes user icon tinting. This fixes b/253637739 where the guest user icon color is incorrect in both the status bar and quick settings action footer when the footer is revealed. The reason it was affecting status bar was because setting the tint mutates the drawable that both components share. Either way, removing this unnecessary tinting fixes the issue. Fix: 253637739 Test: updated one unit test and manually verified that both the primary user and the guest user look as expected in both the status bar and the quick settings footer in both dark and light theme on a tablet Change-Id: Ib7fba1c39dbdf5ea1c252d58b468c4c5f83ee5e8 --- .../ui/viewmodel/FooterActionsViewModel.kt | 24 ++++++++----------- .../viewmodel/FooterActionsViewModelTest.kt | 10 -------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt index 11d955580983f..d3c06f60bc904 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt @@ -23,7 +23,6 @@ import androidx.lifecycle.DefaultLifecycleObserver import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner import com.android.settingslib.Utils -import com.android.settingslib.drawable.UserIconDrawable import com.android.systemui.R import com.android.systemui.animation.Expandable import com.android.systemui.common.shared.model.ContentDescription @@ -250,22 +249,19 @@ class FooterActionsViewModel( status: UserSwitcherStatusModel.Enabled ): FooterActionsButtonViewModel { val icon = status.currentUserImage!! - val iconTint = - if (status.isGuestUser && icon !is UserIconDrawable) { - Utils.getColorAttrDefaultColor(context, android.R.attr.colorForeground) - } else { - null - } return FooterActionsButtonViewModel( id = R.id.multi_user_switch, - Icon.Loaded( - icon, - ContentDescription.Loaded(userSwitcherContentDescription(status.currentUserName)), - ), - iconTint, - R.drawable.qs_footer_action_circle, - this::onUserSwitcherClicked, + icon = + Icon.Loaded( + icon, + ContentDescription.Loaded( + userSwitcherContentDescription(status.currentUserName) + ), + ), + iconTint = null, + background = R.drawable.qs_footer_action_circle, + onClick = this::onUserSwitcherClicked, ) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt index 2a4996f259dcf..760bb9bec5597 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt @@ -192,16 +192,6 @@ class FooterActionsViewModelTest : SysuiTestCase() { // UserManager change. assertThat(iconTint()).isNull() - // Trigger a user info change: there should now be a tint. - userInfoController.updateInfo { userAccount = "doe" } - assertThat(iconTint()) - .isEqualTo( - Utils.getColorAttrDefaultColor( - context, - android.R.attr.colorForeground, - ) - ) - // Make sure we don't tint the icon if it is a user image (and not the default image), even // in guest mode. userInfoController.updateInfo { this.picture = mock() }