Loading res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5903,6 +5903,9 @@ <!-- Configure Notifications: Advanced section header [CHAR LIMIT=30] --> <string name="advanced_section_header">Advanced</string> <!-- Configure Notifications: Work profile section header [CHAR LIMIT=30] --> <string name="profile_section_header">Work notifications</string> <!-- Configure Notifications: Title for the pulse notification light option. [CHAR LIMIT=30] --> <string name="notification_pulse_title">Pulse notification light</string> Loading res/xml/configure_notification_settings_profile.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" android:title="@string/configure_notification_settings" > <PreferenceCategory android:title="@string/profile_section_header" > <com.android.settingslib.RestrictedDropDownPreference android:key="lock_screen_notifications_profile" android:title="@string/lock_screen_notifications_title" android:summary="%s" /> </PreferenceCategory> </PreferenceScreen> src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java +1 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -224,7 +223,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr } protected boolean isProfileChallenge() { return UserHandle.myUserId() != mEffectiveUserId; return Utils.isManagedProfile(UserManager.get(getContext())); } protected void reportSuccessfullAttempt() { Loading src/com/android/settings/SecuritySettings.java +3 −18 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ public class SecuritySettings extends SettingsPreferenceFragment final int resid = getResIdForLockUnlockScreen(getActivity(), mLockPatternUtils, MY_USER_ID); addPreferencesFromResource(resid); mProfileChallengeUserId = getManagedProfileId(mUm); mProfileChallengeUserId = Utils.getManagedProfileId(mUm, MY_USER_ID); if (mProfileChallengeUserId != UserHandle.USER_NULL && mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId)) { addPreferencesFromResource(R.xml.security_settings_profile); Loading Loading @@ -726,21 +726,6 @@ public class SecuritySettings extends SettingsPreferenceFragment return R.string.help_url_security; } private static int getManagedProfileId(UserManager um) { List<UserInfo> profiles = um.getProfiles(MY_USER_ID); int numProfiles = profiles.size(); if (numProfiles == 1) { return UserHandle.USER_NULL; } for (int i = 0; i < numProfiles; ++i) { UserInfo profile = profiles.get(i); if (profile.id != MY_USER_ID) { return profile.id; } } return UserHandle.USER_NULL; } /** * For Search. Please keep it in sync when updating "createPreferenceHierarchy()" */ Loading @@ -764,7 +749,7 @@ public class SecuritySettings extends SettingsPreferenceFragment result.add(sir); final UserManager um = UserManager.get(context); final int profileUserId = getManagedProfileId(um); final int profileUserId = Utils.getManagedProfileId(um, MY_USER_ID); if (profileUserId != UserHandle.USER_NULL && lockPatternUtils.isSeparateProfileChallengeAllowed(profileUserId)) { sir = new SearchIndexableResource(context); Loading Loading @@ -847,7 +832,7 @@ public class SecuritySettings extends SettingsPreferenceFragment } final LockPatternUtils lockPatternUtils = new LockPatternUtils(context); final int profileUserId = getManagedProfileId(um); final int profileUserId = Utils.getManagedProfileId(um, MY_USER_ID); if (profileUserId != UserHandle.USER_NULL && lockPatternUtils.isSeparateProfileChallengeAllowed(profileUserId)) { if (lockPatternUtils.getKeyguardStoredPasswordQuality(profileUserId) Loading src/com/android/settings/Utils.java +17 −0 Original line number Diff line number Diff line Loading @@ -595,6 +595,23 @@ public final class Utils extends com.android.settingslib.Utils { return isManagedProfile(userManager, UserHandle.myUserId()); } /** * Retrieves the id for the given user's managed profile. * * @return the managed profile id or UserHandle.USER_NULL if there is none. */ public static int getManagedProfileId(UserManager um, int parentUserId) { List<UserInfo> profiles = um.getProfiles(parentUserId); int numProfiles = profiles.size(); for (int i = 0; i < numProfiles; ++i) { UserInfo profile = profiles.get(i); if (profile.id != parentUserId) { return profile.id; } } return UserHandle.USER_NULL; } /** * Returns true if the userId passed in is a managed profile. * Loading Loading
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5903,6 +5903,9 @@ <!-- Configure Notifications: Advanced section header [CHAR LIMIT=30] --> <string name="advanced_section_header">Advanced</string> <!-- Configure Notifications: Work profile section header [CHAR LIMIT=30] --> <string name="profile_section_header">Work notifications</string> <!-- Configure Notifications: Title for the pulse notification light option. [CHAR LIMIT=30] --> <string name="notification_pulse_title">Pulse notification light</string> Loading
res/xml/configure_notification_settings_profile.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" android:title="@string/configure_notification_settings" > <PreferenceCategory android:title="@string/profile_section_header" > <com.android.settingslib.RestrictedDropDownPreference android:key="lock_screen_notifications_profile" android:title="@string/lock_screen_notifications_title" android:summary="%s" /> </PreferenceCategory> </PreferenceScreen>
src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java +1 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -224,7 +223,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr } protected boolean isProfileChallenge() { return UserHandle.myUserId() != mEffectiveUserId; return Utils.isManagedProfile(UserManager.get(getContext())); } protected void reportSuccessfullAttempt() { Loading
src/com/android/settings/SecuritySettings.java +3 −18 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ public class SecuritySettings extends SettingsPreferenceFragment final int resid = getResIdForLockUnlockScreen(getActivity(), mLockPatternUtils, MY_USER_ID); addPreferencesFromResource(resid); mProfileChallengeUserId = getManagedProfileId(mUm); mProfileChallengeUserId = Utils.getManagedProfileId(mUm, MY_USER_ID); if (mProfileChallengeUserId != UserHandle.USER_NULL && mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId)) { addPreferencesFromResource(R.xml.security_settings_profile); Loading Loading @@ -726,21 +726,6 @@ public class SecuritySettings extends SettingsPreferenceFragment return R.string.help_url_security; } private static int getManagedProfileId(UserManager um) { List<UserInfo> profiles = um.getProfiles(MY_USER_ID); int numProfiles = profiles.size(); if (numProfiles == 1) { return UserHandle.USER_NULL; } for (int i = 0; i < numProfiles; ++i) { UserInfo profile = profiles.get(i); if (profile.id != MY_USER_ID) { return profile.id; } } return UserHandle.USER_NULL; } /** * For Search. Please keep it in sync when updating "createPreferenceHierarchy()" */ Loading @@ -764,7 +749,7 @@ public class SecuritySettings extends SettingsPreferenceFragment result.add(sir); final UserManager um = UserManager.get(context); final int profileUserId = getManagedProfileId(um); final int profileUserId = Utils.getManagedProfileId(um, MY_USER_ID); if (profileUserId != UserHandle.USER_NULL && lockPatternUtils.isSeparateProfileChallengeAllowed(profileUserId)) { sir = new SearchIndexableResource(context); Loading Loading @@ -847,7 +832,7 @@ public class SecuritySettings extends SettingsPreferenceFragment } final LockPatternUtils lockPatternUtils = new LockPatternUtils(context); final int profileUserId = getManagedProfileId(um); final int profileUserId = Utils.getManagedProfileId(um, MY_USER_ID); if (profileUserId != UserHandle.USER_NULL && lockPatternUtils.isSeparateProfileChallengeAllowed(profileUserId)) { if (lockPatternUtils.getKeyguardStoredPasswordQuality(profileUserId) Loading
src/com/android/settings/Utils.java +17 −0 Original line number Diff line number Diff line Loading @@ -595,6 +595,23 @@ public final class Utils extends com.android.settingslib.Utils { return isManagedProfile(userManager, UserHandle.myUserId()); } /** * Retrieves the id for the given user's managed profile. * * @return the managed profile id or UserHandle.USER_NULL if there is none. */ public static int getManagedProfileId(UserManager um, int parentUserId) { List<UserInfo> profiles = um.getProfiles(parentUserId); int numProfiles = profiles.size(); for (int i = 0; i < numProfiles; ++i) { UserInfo profile = profiles.get(i); if (profile.id != parentUserId) { return profile.id; } } return UserHandle.USER_NULL; } /** * Returns true if the userId passed in is a managed profile. * Loading