summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Manish Singh <psych@google.com> 2023-11-09 13:48:18 +0000
committer Manish Singh <psych@google.com> 2023-11-09 13:59:16 +0000
commit7607e48cfa8fa6d68abbfc41cc24d3de853252d8 (patch)
tree98b1f28ef42ba0e73d7d9e1e0bdf953643abedae
parent17fe3ebea9e683e077cb96746b6b7eb07cf8084d (diff)
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
-rw-r--r--packages/SettingsLib/SpaPrivileged/src/com/android/settingslib/spaprivileged/template/common/UserProfilePager.kt11
1 files 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<UserGroup> {
val userGroupList = mutableListOf<UserGroup>()
- 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