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
diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java
index f8ac7dd..4d50461 100644
--- a/src/com/android/settings/notification/ConfigureNotificationSettings.java
+++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java
@@ -75,9 +75,14 @@
         mContext = getActivity();
         mProfileChallengeUserId = Utils.getManagedProfileId(
                 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)
-                && new LockPatternUtils(getActivity()).isSecure(mProfileChallengeUserId);
+                && (utils.isSecure(mProfileChallengeUserId) || (isUnified && mSecure));
 
         addPreferencesFromResource(R.xml.configure_notification_settings);