Remove primaryUserOnly param from AppListPage
Because userInfo.isPrimary is not exists in Headless System User Mode. Fix: 284902200 Test: Manually on device with Headless System User Mode Change-Id: I9bf7ccf3bf9c38ef4152dc069f991cf55c24f559
This commit is contained in:
@@ -42,7 +42,6 @@ fun <T : AppRecord> AppListPage(
|
||||
showInstantApps: Boolean = false,
|
||||
noMoreOptions: Boolean = false,
|
||||
matchAnyUserForAdmin: Boolean = false,
|
||||
primaryUserOnly: Boolean = false,
|
||||
noItemMessage: String? = null,
|
||||
moreOptions: @Composable MoreOptionsScope.() -> Unit = {},
|
||||
header: @Composable () -> Unit = {},
|
||||
@@ -60,7 +59,7 @@ fun <T : AppRecord> AppListPage(
|
||||
}
|
||||
},
|
||||
) { bottomPadding, searchQuery ->
|
||||
UserProfilePager(primaryUserOnly) { userGroup ->
|
||||
UserProfilePager { userGroup ->
|
||||
val appListInput = AppListInput(
|
||||
config = AppListConfig(
|
||||
userIds = userGroup.userInfos.map { it.id },
|
||||
|
||||
@@ -38,14 +38,9 @@ data class UserGroup(
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun UserProfilePager(
|
||||
primaryUserOnly: Boolean = false,
|
||||
content: @Composable (userGroup: UserGroup) -> Unit,
|
||||
) {
|
||||
fun UserProfilePager(content: @Composable (userGroup: UserGroup) -> Unit) {
|
||||
val context = LocalContext.current
|
||||
val userGroups = remember {
|
||||
context.userManager.getUserGroups(primaryUserOnly)
|
||||
}
|
||||
val userGroups = remember { context.userManager.getUserGroups() }
|
||||
val titles = remember {
|
||||
val enterpriseRepository = EnterpriseRepository(context)
|
||||
userGroups.map { userGroup ->
|
||||
@@ -60,10 +55,9 @@ fun UserProfilePager(
|
||||
}
|
||||
}
|
||||
|
||||
private fun UserManager.getUserGroups(primaryUserOnly: Boolean): List<UserGroup> {
|
||||
private fun UserManager.getUserGroups(): List<UserGroup> {
|
||||
val userGroupList = mutableListOf<UserGroup>()
|
||||
val profileToShowInSettingsList = getProfiles(UserHandle.myUserId())
|
||||
.filter { userInfo -> !primaryUserOnly || userInfo.isPrimary }
|
||||
.map { userInfo -> userInfo to getUserProperties(userInfo.userHandle).showInSettings }
|
||||
|
||||
profileToShowInSettingsList.filter { it.second == UserProperties.SHOW_IN_SETTINGS_WITH_PARENT }
|
||||
|
||||
Reference in New Issue
Block a user