Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8779fae8 authored by Chaohui Wang's avatar Chaohui Wang Committed by Android (Google) Code Review
Browse files

Merge "Remove primaryUserOnly param from AppListPage" into udc-qpr-dev

parents cffafd6d 4db5832c
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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 },
+3 −9
Original line number Diff line number Diff line
@@ -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 }