From 7607e48cfa8fa6d68abbfc41cc24d3de853252d8 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Thu, 9 Nov 2023 13:48:18 +0000 Subject: Hide Private tabs when in quiet mode Check hideInSettingsInQuietMode user property - If this user property is set then we should check if the user is in quiet mode or not - only when the user is not in quiet mode, should we show this user in Settings. This is for the Private Profile which sets this user property. Without this change, the Private profile tab is always shown irrespective of the quiet mode. Also, check the SHOW_IN_SETTINGS_SEPARATE instead of SHOW_IN_LAUNCHER_SEPARATE Bug: 309935782 Test: manual Change-Id: Icaef8d853932236246bac169ad83399fbef18bec --- .../spaprivileged/template/common/UserProfilePager.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/SettingsLib/SpaPrivileged/src/com/android/settingslib/spaprivileged/template/common/UserProfilePager.kt b/packages/SettingsLib/SpaPrivileged/src/com/android/settingslib/spaprivileged/template/common/UserProfilePager.kt index 5447f21fd417..1c92696efd29 100644 --- a/packages/SettingsLib/SpaPrivileged/src/com/android/settingslib/spaprivileged/template/common/UserProfilePager.kt +++ b/packages/SettingsLib/SpaPrivileged/src/com/android/settingslib/spaprivileged/template/common/UserProfilePager.kt @@ -57,15 +57,18 @@ fun UserProfilePager(content: @Composable (userGroup: UserGroup) -> Unit) { private fun UserManager.getUserGroups(): List { val userGroupList = mutableListOf() - val profileToShowInSettingsList = getProfiles(UserHandle.myUserId()) - .map { userInfo -> userInfo to getUserProperties(userInfo.userHandle).showInSettings } + val profileToShowInSettings = getProfiles(UserHandle.myUserId()) + .map { userInfo -> userInfo to getUserProperties(userInfo.userHandle) } - profileToShowInSettingsList.filter { it.second == UserProperties.SHOW_IN_SETTINGS_WITH_PARENT } + profileToShowInSettings + .filter { it.second.showInSettings == UserProperties.SHOW_IN_SETTINGS_WITH_PARENT } .takeIf { it.isNotEmpty() } ?.map { it.first } ?.let { userInfos -> userGroupList += UserGroup(userInfos) } - profileToShowInSettingsList.filter { it.second == UserProperties.SHOW_IN_LAUNCHER_SEPARATE } + profileToShowInSettings + .filter { it.second.showInSettings == UserProperties.SHOW_IN_SETTINGS_SEPARATE && + (!it.second.hideInSettingsInQuietMode || !it.first.isQuietModeEnabled) } .forEach { userGroupList += UserGroup(userInfos = listOf(it.first)) } return userGroupList -- cgit v1.2.3-59-g8ed1b