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

Commit b78a7718 authored by Manish Singh's avatar Manish Singh Committed by Android (Google) Code Review
Browse files

Merge changes from topic "ps_tab_framework" into main

* changes:
  Allow the title to be updated for any profile type
  Add override key for pref to enable auto-sync Private Space data
  Add a way to specify Private Space title in settings
parents eb5b53a2 1eaa4688
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1171,6 +1171,12 @@ public final class DevicePolicyResources {
             */
            public static final String WORK_CATEGORY_HEADER = PREFIX + "WORK_CATEGORY_HEADER";

            /**
             * Header for items under the private user
             */
            public static final String PRIVATE_CATEGORY_HEADER =
                    PREFIX + "PRIVATE_CATEGORY_HEADER";

            /**
             * Header for items under the personal user
             */
@@ -1207,6 +1213,12 @@ public final class DevicePolicyResources {
             */
            public static final String AUTO_SYNC_WORK_DATA = PREFIX + "AUTO_SYNC_WORK_DATA";

            /**
             * Text for toggle to enable auto-sycing private data
             */
            public static final String AUTO_SYNC_PRIVATE_DATA = PREFIX
                    + "AUTO_SYNC_PRIVATE_DATA";

            /**
             * Summary for "More security settings" section when a work profile is on the device.
             */
+5 −1
Original line number Diff line number Diff line
@@ -18,8 +18,10 @@ package com.android.settingslib.spaprivileged.model.enterprise

import android.app.admin.DevicePolicyManager
import android.app.admin.DevicePolicyResources.Strings.Settings.PERSONAL_CATEGORY_HEADER
import android.app.admin.DevicePolicyResources.Strings.Settings.PRIVATE_CATEGORY_HEADER
import android.app.admin.DevicePolicyResources.Strings.Settings.WORK_CATEGORY_HEADER
import android.content.Context
import android.content.pm.UserInfo
import com.android.settingslib.R

class EnterpriseRepository(private val context: Context) {
@@ -30,8 +32,10 @@ class EnterpriseRepository(private val context: Context) {
    fun getEnterpriseString(updatableStringId: String, resId: Int): String =
        checkNotNull(resources.getString(updatableStringId) { context.getString(resId) })

    fun getProfileTitle(isManagedProfile: Boolean): String = if (isManagedProfile) {
    fun getProfileTitle(userInfo: UserInfo): String = if (userInfo.isManagedProfile) {
        getEnterpriseString(WORK_CATEGORY_HEADER, R.string.category_work)
    } else if (userInfo.isPrivateProfile) {
        getEnterpriseString(PRIVATE_CATEGORY_HEADER, R.string.category_private)
    } else {
        getEnterpriseString(PERSONAL_CATEGORY_HEADER, R.string.category_personal)
    }
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ fun UserProfilePager(content: @Composable (userGroup: UserGroup) -> Unit) {
        val enterpriseRepository = EnterpriseRepository(context)
        userGroups.map { userGroup ->
            enterpriseRepository.getProfileTitle(
                isManagedProfile = userGroup.userInfos.first().isManagedProfile,
                userGroup.userInfos.first(),
            )
        }
    }
+2 −0
Original line number Diff line number Diff line
@@ -518,6 +518,8 @@
    <string name="category_personal">Personal</string>
    <!-- Header for items under the work user [CHAR LIMIT=30] -->
    <string name="category_work">Work</string>
    <!-- Header for items under the private profile user [CHAR LIMIT=30] -->
    <string name="category_private">Private</string>
    <!-- Header for items under the clone user [CHAR LIMIT=30] -->
    <string name="category_clone">Clone</string>