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,9 @@
package com.android.settings.notification;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_APPS_CANNOT_ACCESS_NOTIFICATION_SETTINGS;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_NOTIFICATION_LISTENER_BLOCKED;
import android.annotation.Nullable;
import android.app.NotificationManager;
import android.app.admin.DevicePolicyManager;
@@ -103,7 +106,9 @@ public class NotificationAccessSettings extends EmptyTextSettings {
if (UserManager.get(mContext).isManagedProfile()) {
// Apps in the work profile do not support notification listeners.
Toast.makeText(mContext, R.string.notification_settings_work_profile,
Toast.makeText(mContext,
mDpm.getString(WORK_APPS_CANNOT_ACCESS_NOTIFICATION_SETTINGS,
() -> mContext.getString(R.string.notification_settings_work_profile)),
Toast.LENGTH_SHORT).show();
finish();
}
@@ -163,7 +168,9 @@ public class NotificationAccessSettings extends EmptyTextSettings {
if (managedProfileId != UserHandle.USER_NULL
&& !mDpm.isNotificationListenerServicePermitted(
service.packageName, managedProfileId)) {
pref.setSummary(R.string.work_profile_notification_access_blocked_summary);
pref.setSummary(mDpm.getString(WORK_PROFILE_NOTIFICATION_LISTENER_BLOCKED,
() -> getString(
R.string.work_profile_notification_access_blocked_summary)));
}
pref.setOnPreferenceClickListener(preference -> {
final Bundle args = new Bundle();