Allow user to hide sensitive notifications with no work challenge

When a user upgrades to N, her work profile is automatically
unified even though no work challenge setting is shown to the user
if the user has not upgraded her DPC. Allow the user to hide
sensitive notifications based on whethere there's a profile, but not
on whether there is a work challenge.

Bug:27673591
Change-Id: Iec41dda2d9e479597b3e593e7f9b7f1c0fcd2a49
This commit is contained in:
Daniel U
2016-04-01 18:44:13 +01:00
parent 9069181c84
commit 6e556092f5

View File

@@ -75,9 +75,14 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment {
mContext = getActivity(); mContext = getActivity();
mProfileChallengeUserId = Utils.getManagedProfileId( mProfileChallengeUserId = Utils.getManagedProfileId(
UserManager.get(mContext), UserHandle.myUserId()); UserManager.get(mContext), UserHandle.myUserId());
mSecure = new LockPatternUtils(getActivity()).isSecure(UserHandle.myUserId());
final LockPatternUtils utils = new LockPatternUtils(getActivity());
final boolean isUnified =
!utils.isSeparateProfileChallengeEnabled(mProfileChallengeUserId);
mSecure = utils.isSecure(UserHandle.myUserId());
mSecureProfile = (mProfileChallengeUserId != UserHandle.USER_NULL) mSecureProfile = (mProfileChallengeUserId != UserHandle.USER_NULL)
&& new LockPatternUtils(getActivity()).isSecure(mProfileChallengeUserId); && (utils.isSecure(mProfileChallengeUserId) || (isUnified && mSecure));
addPreferencesFromResource(R.xml.configure_notification_settings); addPreferencesFromResource(R.xml.configure_notification_settings);