diff --git a/res/layout/redaction_interstitial.xml b/res/layout/redaction_interstitial.xml index e80b3996134..06dc6aa40ff 100644 --- a/res/layout/redaction_interstitial.xml +++ b/res/layout/redaction_interstitial.xml @@ -24,6 +24,7 @@ android:paddingEnd="?attr/side_margin"> Choose PIN/PW/Pattern > Notification redaction interstitial: Title for the screen asking the user how they want their notifications to appear when the device is locked [CHAR LIMIT=30] --> Notifications + + Show all profile notification content + + + Hide sensitive profile notification content + + + Don\u2019t show profile notifications at all + + + When your device is locked, how do you want profile notifications to show? + + + Profile notifications + Notifications diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java index 2fd012e311a..7e45da10bce 100644 --- a/src/com/android/settings/ChooseLockPassword.java +++ b/src/com/android/settings/ChooseLockPassword.java @@ -399,7 +399,7 @@ public class ChooseLockPassword extends SettingsActivity { } protected Intent getRedactionInterstitialIntent(Context context) { - return RedactionInterstitial.createStartIntent(context); + return RedactionInterstitial.createStartIntent(context, mUserId); } protected void updateStage(Stage stage) { diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java index 960ec1a0c85..2c8fd202362 100644 --- a/src/com/android/settings/ChooseLockPattern.java +++ b/src/com/android/settings/ChooseLockPattern.java @@ -465,7 +465,7 @@ public class ChooseLockPattern extends SettingsActivity { } protected Intent getRedactionInterstitialIntent(Context context) { - return RedactionInterstitial.createStartIntent(context); + return RedactionInterstitial.createStartIntent(context, mUserId); } public void handleLeftButton() { diff --git a/src/com/android/settings/SetupRedactionInterstitial.java b/src/com/android/settings/SetupRedactionInterstitial.java index 4939aeaf7a7..e967297af91 100644 --- a/src/com/android/settings/SetupRedactionInterstitial.java +++ b/src/com/android/settings/SetupRedactionInterstitial.java @@ -21,6 +21,7 @@ import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; +import android.os.UserHandle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -39,7 +40,7 @@ import com.android.setupwizardlib.view.NavigationBar; public class SetupRedactionInterstitial extends RedactionInterstitial { public static Intent createStartIntent(Context ctx) { - Intent startIntent = RedactionInterstitial.createStartIntent(ctx); + Intent startIntent = RedactionInterstitial.createStartIntent(ctx, UserHandle.myUserId()); if (startIntent != null) { startIntent.setClass(ctx, SetupRedactionInterstitial.class); startIntent.putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, false) diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java index 07c0dfe4eb5..8b5da8780a4 100644 --- a/src/com/android/settings/fingerprint/FingerprintSettings.java +++ b/src/com/android/settings/fingerprint/FingerprintSettings.java @@ -304,7 +304,7 @@ public class FingerprintSettings extends SubSettings { TextView v = (TextView) LayoutInflater.from(view.getContext()).inflate( R.layout.fingerprint_settings_footer, null); EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled( - getActivity(), DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT); + getActivity(), DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT, mUserId); v.setText(LearnMoreSpan.linkify(getText(admin != null ? R.string.security_settings_fingerprint_enroll_disclaimer_lockscreen_disabled : R.string.security_settings_fingerprint_enroll_disclaimer), diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java index a81bb13c2a7..17571c9e475 100644 --- a/src/com/android/settings/notification/ConfigureNotificationSettings.java +++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java @@ -192,7 +192,7 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment { private void setRestrictedIfNotificationFeaturesDisabled(CharSequence entry, CharSequence entryValue, int keyguardNotificationFeatures) { EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled( - mContext, keyguardNotificationFeatures); + mContext, keyguardNotificationFeatures, UserHandle.myUserId()); if (admin != null) { RestrictedItem item = new RestrictedItem(entry, entryValue, admin); mLockscreen.addRestrictedItem(item); diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java index 2f871c47274..bd1dfe803ac 100644 --- a/src/com/android/settings/notification/RedactionInterstitial.java +++ b/src/com/android/settings/notification/RedactionInterstitial.java @@ -19,18 +19,21 @@ package com.android.settings.notification; import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.os.UserManager; import android.provider.Settings; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RadioButton; import android.widget.RadioGroup; +import android.widget.TextView; import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.settings.R; import com.android.settings.RestrictedRadioButton; import com.android.settings.SettingsActivity; import com.android.settings.SettingsPreferenceFragment; +import com.android.settings.Utils; import com.android.settingslib.RestrictedLockUtils; import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS; @@ -57,14 +60,17 @@ public class RedactionInterstitial extends SettingsActivity { * @return An intent to launch the activity is if is available, @null if the activity is not * available to be launched. */ - public static Intent createStartIntent(Context ctx) { + public static Intent createStartIntent(Context ctx, int userId) { return new Intent(ctx, RedactionInterstitial.class) .putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, true) .putExtra(EXTRA_PREFS_SET_BACK_TEXT, (String) null) .putExtra(EXTRA_PREFS_SET_NEXT_TEXT, ctx.getString( R.string.app_notifications_dialog_done)) .putExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, - R.string.lock_screen_notifications_interstitial_title); + Utils.isManagedProfile(UserManager.get(ctx), userId) + ? R.string.lock_screen_notifications_interstitial_title_profile + : R.string.lock_screen_notifications_interstitial_title) + .putExtra(Intent.EXTRA_USER_ID, userId); } public static class RedactionInterstitialFragment extends SettingsPreferenceFragment @@ -73,6 +79,7 @@ public class RedactionInterstitial extends SettingsActivity { private RadioGroup mRadioGroup; private RestrictedRadioButton mShowAllButton; private RestrictedRadioButton mRedactSensitiveButton; + private int mUserId; @Override protected int getMetricsCategory() { @@ -90,9 +97,21 @@ public class RedactionInterstitial extends SettingsActivity { super.onViewCreated(view, savedInstanceState); mRadioGroup = (RadioGroup) view.findViewById(R.id.radio_group); mShowAllButton = (RestrictedRadioButton) view.findViewById(R.id.show_all); - mRedactSensitiveButton = (RestrictedRadioButton) view.findViewById(R.id.redact_sensitive); + mRedactSensitiveButton = + (RestrictedRadioButton) view.findViewById(R.id.redact_sensitive); mRadioGroup.setOnCheckedChangeListener(this); + mUserId = Utils.getUserIdFromBundle( + getContext(), getActivity().getIntent().getExtras()); + if (Utils.isManagedProfile(UserManager.get(getContext()), mUserId)) { + ((TextView) view.findViewById(R.id.message)) + .setText(R.string.lock_screen_notifications_interstitial_message_profile); + mShowAllButton.setText(R.string.lock_screen_notifications_summary_show_profile); + mRedactSensitiveButton + .setText(R.string.lock_screen_notifications_summary_hide_profile); + ((RadioButton) view.findViewById(R.id.hide_all)) + .setText(R.string.lock_screen_notifications_summary_disable_profile); + } } @Override @@ -111,15 +130,15 @@ public class RedactionInterstitial extends SettingsActivity { private void checkNotificationFeaturesAndSetDisabled(RestrictedRadioButton button, int keyguardNotifications) { EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled( - getActivity(), keyguardNotifications); + getActivity(), keyguardNotifications, mUserId); button.setDisabledByAdmin(admin); } private void loadFromSettings() { - final boolean enabled = Settings.Secure.getInt(getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0) != 0; - final boolean show = Settings.Secure.getInt(getContentResolver(), - Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1) != 0; + final boolean enabled = Settings.Secure.getIntForUser(getContentResolver(), + Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0, mUserId) != 0; + final boolean show = Settings.Secure.getIntForUser(getContentResolver(), + Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1, mUserId) != 0; int checkedButtonId = R.id.hide_all; if (enabled) { @@ -138,10 +157,10 @@ public class RedactionInterstitial extends SettingsActivity { final boolean show = (checkedId == R.id.show_all); final boolean enabled = (checkedId != R.id.hide_all); - Settings.Secure.putInt(getContentResolver(), - Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, show ? 1 : 0); - Settings.Secure.putInt(getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0); + Settings.Secure.putIntForUser(getContentResolver(), + Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, show ? 1 : 0, mUserId); + Settings.Secure.putIntForUser(getContentResolver(), + Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0, mUserId); } } }