Add missing settings strings.

Also re-enable and fix tests.

Test: manual
Fixes: 226183482
Fixes: 218799125
Fixes: 219375624

Change-Id: I9605f1f4e2e834baf63e015e96639567c5481b5f
This commit is contained in:
Jonathan Scott
2022-04-11 09:49:17 +00:00
parent afe6d302e4
commit b7f4f56cad
63 changed files with 470 additions and 88 deletions

View File

@@ -18,6 +18,8 @@ package com.android.settings.notification;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS;
import static android.app.admin.DevicePolicyResources.Strings.Settings.LOCK_SCREEN_HIDE_WORK_NOTIFICATION_CONTENT;
import static android.app.admin.DevicePolicyResources.Strings.Settings.LOCK_SCREEN_SHOW_WORK_NOTIFICATION_CONTENT;
import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
@@ -158,8 +160,13 @@ public class LockScreenNotificationPreferenceController extends AbstractPreferen
ArrayList<CharSequence> entries = new ArrayList<>();
ArrayList<CharSequence> values = new ArrayList<>();
String summaryShowEntry = mContext.getString(
R.string.lock_screen_notifications_summary_show_profile);
DevicePolicyManager devicePolicyManager =
mContext.getSystemService(DevicePolicyManager.class);
String summaryShowEntry = devicePolicyManager
.getResources().getString(LOCK_SCREEN_SHOW_WORK_NOTIFICATION_CONTENT,
() -> mContext.getString(
R.string.lock_screen_notifications_summary_show_profile));
String summaryShowEntryValue = Integer.toString(
R.string.lock_screen_notifications_summary_show_profile);
entries.add(summaryShowEntry);
@@ -168,8 +175,10 @@ public class LockScreenNotificationPreferenceController extends AbstractPreferen
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS | KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS);
if (mSecureProfile) {
String summaryHideEntry = mContext.getString(
R.string.lock_screen_notifications_summary_hide_profile);
String summaryHideEntry = devicePolicyManager
.getResources().getString(LOCK_SCREEN_HIDE_WORK_NOTIFICATION_CONTENT,
() -> mContext.getString(
R.string.lock_screen_notifications_summary_hide_profile));
String summaryHideEntryValue = Integer.toString(
R.string.lock_screen_notifications_summary_hide_profile);
entries.add(summaryHideEntry);

View File

@@ -18,11 +18,14 @@ package com.android.settings.notification;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS;
import static android.app.admin.DevicePolicyResources.Strings.Settings.LOCK_SCREEN_HIDE_WORK_NOTIFICATION_CONTENT;
import static android.app.admin.DevicePolicyResources.Strings.Settings.LOCK_SCREEN_SHOW_WORK_NOTIFICATION_CONTENT;
import static android.provider.Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS;
import static android.provider.Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS;
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import android.app.admin.DevicePolicyManager;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
@@ -115,6 +118,7 @@ public class RedactionInterstitial extends SettingsActivity {
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
DevicePolicyManager devicePolicyManager = getSystemService(DevicePolicyManager.class);
mRadioGroup = (RadioGroup) view.findViewById(R.id.radio_group);
mShowAllButton = (RestrictedRadioButton) view.findViewById(R.id.show_all);
mRedactSensitiveButton =
@@ -126,9 +130,15 @@ public class RedactionInterstitial extends SettingsActivity {
if (UserManager.get(getContext()).isManagedProfile(mUserId)) {
((TextView) view.findViewById(R.id.sud_layout_description))
.setText(R.string.lock_screen_notifications_interstitial_message_profile);
mShowAllButton.setText(R.string.lock_screen_notifications_summary_show_profile);
mShowAllButton.setText(devicePolicyManager
.getResources().getString(LOCK_SCREEN_SHOW_WORK_NOTIFICATION_CONTENT,
() -> getString(
R.string.lock_screen_notifications_summary_show_profile)));
mRedactSensitiveButton
.setText(R.string.lock_screen_notifications_summary_hide_profile);
.setText(devicePolicyManager.getResources().getString(
LOCK_SCREEN_HIDE_WORK_NOTIFICATION_CONTENT,
() -> getString(
R.string.lock_screen_notifications_summary_hide_profile)));
((RadioButton) view.findViewById(R.id.hide_all)).setVisibility(View.GONE);
}

View File

@@ -19,6 +19,7 @@ package com.android.settings.notification;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_ALARM_RINGTONE_TITLE;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_NOTIFICATION_RINGTONE_TITLE;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_RINGTONE_TITLE;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_SOUND_SETTINGS_SECTION_HEADER;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_USE_PERSONAL_SOUNDS_SUMMARY;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_USE_PERSONAL_SOUNDS_TITLE;
@@ -70,6 +71,8 @@ public class SoundWorkSettings extends DashboardFragment implements OnActivityRe
mRequestPreference = findPreference(selectedPreference);
}
}
replaceEnterprisePreferenceScreenTitle(
WORK_PROFILE_SOUND_SETTINGS_SECTION_HEADER, R.string.sound_work_settings);
replaceEnterpriseStringTitle("work_use_personal_sounds",
WORK_PROFILE_USE_PERSONAL_SOUNDS_TITLE, R.string.work_use_personal_sounds_title);
replaceEnterpriseStringSummary("work_use_personal_sounds",
@@ -79,7 +82,7 @@ public class SoundWorkSettings extends DashboardFragment implements OnActivityRe
WORK_PROFILE_RINGTONE_TITLE, R.string.work_ringtone_title);
replaceEnterpriseStringTitle("work_alarm_ringtone",
WORK_PROFILE_ALARM_RINGTONE_TITLE, R.string.work_alarm_ringtone_title);
replaceEnterpriseStringTitle("work_notification",
replaceEnterpriseStringTitle("work_notification_ringtone",
WORK_PROFILE_NOTIFICATION_RINGTONE_TITLE,
R.string.work_notification_ringtone_title);
}