Allow Device Management Role Holder to update Settings strings.

Test: manual
Bug: 188414370
Change-Id: I6e1a06619799a9e99382d791e72e2e4518f93cac
This commit is contained in:
Jonathan Scott
2022-01-19 15:19:08 +00:00
parent 47d115c3ff
commit e0d439472f
55 changed files with 788 additions and 231 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings;
import static android.app.admin.DevicePolicyResources.Strings.Settings.PERSONAL_CATEGORY_HEADER;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_CATEGORY_HEADER;
import static android.widget.LinearLayout.LayoutParams.MATCH_PARENT;
import static android.widget.LinearLayout.LayoutParams.WRAP_CONTENT;
@@ -82,6 +84,7 @@ public class TrustedCredentialsSettings extends InstrumentedFragment
private static final String TAG = "TrustedCredentialsSettings";
private DevicePolicyManager mDevicePolicyManager;
private UserManager mUserManager;
private KeyguardManager mKeyguardManager;
private int mTrustAllCaUserId;
@@ -179,6 +182,7 @@ public class TrustedCredentialsSettings extends InstrumentedFragment
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Activity activity = getActivity();
mDevicePolicyManager = activity.getSystemService(DevicePolicyManager.class);
mUserManager = (UserManager) activity.getSystemService(Context.USER_SERVICE);
mKeyguardManager = (KeyguardManager) activity
.getSystemService(Context.KEYGUARD_SERVICE);
@@ -385,9 +389,12 @@ public class TrustedCredentialsSettings extends InstrumentedFragment
final TextView title = (TextView) convertView.findViewById(android.R.id.title);
if (getUserInfoByGroup(groupPosition).isManagedProfile()) {
title.setText(R.string.category_work);
title.setText(mDevicePolicyManager.getString(WORK_CATEGORY_HEADER,
() -> getString(R.string.category_work)));
} else {
title.setText(R.string.category_personal);
title.setText(mDevicePolicyManager.getString(PERSONAL_CATEGORY_HEADER,
() -> getString(R.string.category_personal)));
}
title.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_END);