Lines Matching defs:admin

20 import android.app.admin.DevicePolicyManager;
43 * Utility class to host methods usable in adding a restricted padlock icon and showing admin
48 * @return drawables for displaying with settings that are locked by a device admin.
59 * Checks if a restriction is enforced on a user and returns the enforced admin and
60 * admin userId.
64 * @return EnforcedAdmin Object containing the enforced admin component and admin user details,
66 * and profile owner, then the admin component will be set to {@code null} and userId to
93 // When the restriction is enforced by device owner, return the device owner admin only
94 // if the admin is for the {@param userId} otherwise return a default EnforcedAdmin.
113 * disabled by {@link android.app.admin.DevicePolicyManager#setKeyguardDisabledFeatures}.
114 * @return EnforcedAdmin Object containing the enforced admin component and admin user details,
116 * multiple admins, then the admin component will be set to {@code null} and userId to
134 for (ComponentName admin : admins) {
135 if ((dpm.getKeyguardDisabledFeatures(admin, userId) & keyguardFeatures) != 0) {
137 enforcedAdmin = new EnforcedAdmin(admin, userId);
153 for (ComponentName admin : admins) {
155 if ((dpm.getKeyguardDisabledFeatures(admin, userInfo.id)
158 enforcedAdmin = new EnforcedAdmin(admin, userInfo.id);
163 // and on the parent. So, if the admin has set the policy on the
164 // managed profile here, we don't need to further check if that admin
165 // has set policy on the parent admin.
173 if ((parentDpm.getKeyguardDisabledFeatures(admin, userInfo.id)
176 enforcedAdmin = new EnforcedAdmin(admin, userInfo.id);
214 * @return EnforcedAdmin Object containing the enforced admin component and admin user details,
237 EnforcedAdmin admin = getProfileOrDeviceOwner(context, userId);
239 if (admin != null) {
240 permitted = dpm.isInputMethodPermittedByAdmin(admin.component,
253 return admin;
271 EnforcedAdmin admin = getProfileOwner(context, userId);
272 if (admin == null) {
278 return admin;
290 EnforcedAdmin admin = getProfileOrDeviceOwner(context, userId);
292 if (admin != null) {
293 permitted = dpm.isAccessibilityServicePermittedByAdmin(admin.component,
306 return admin;
328 * Check if account management for a specific type of account is disabled by admin.
332 * @return EnforcedAdmin Object containing the enforced admin component and admin user details,
360 * Checks if {@link android.app.admin.DevicePolicyManager#setAutoTimeRequired} is enforced
377 * Checks if an admin has enforced minimum password quality requirements on the given user.
379 * @return EnforcedAdmin Object containing the enforced admin component and admin user details,
381 * multiple device admins, then the admin component will be set to {@code null} and userId to
401 for (ComponentName admin : admins) {
402 if (dpm.getPasswordQuality(admin, userId)
405 enforcedAdmin = new EnforcedAdmin(admin, userId);
422 for (ComponentName admin : admins) {
424 if (dpm.getPasswordQuality(admin, userInfo.id)
427 enforcedAdmin = new EnforcedAdmin(admin, userInfo.id);
432 // and on the parent. So, if the admin has set the policy on the
433 // managed profile here, we don't need to further check if that admin
434 // has set policy on the parent admin.
442 if (parentDpm.getPasswordQuality(admin, userInfo.id)
445 enforcedAdmin = new EnforcedAdmin(admin, userInfo.id);
458 * Checks if any admin has set maximum time to lock.
460 * @return EnforcedAdmin Object containing the enforced admin component and admin user details,
461 * or {@code null} if no admin has set this restriction. If multiple admins has set this, then
462 * the admin component will be set to {@code null} and userId to {@link UserHandle#USER_NULL}
485 for (ComponentName admin : admins) {
486 if (dpm.getMaximumTimeToLock(admin, userInfo.id) > 0) {
488 enforcedAdmin = new EnforcedAdmin(admin, userInfo.id);
493 // and on the parent. So, if the admin has set the policy on the
494 // managed profile here, we don't need to further check if that admin
495 // has set policy on the parent admin.
502 if (parentDpm.getMaximumTimeToLock(admin, userInfo.id) > 0) {
504 enforcedAdmin = new EnforcedAdmin(admin, userInfo.id);
567 * Set the menu item as disabled by admin by adding a restricted padlock at the end of the
568 * text and set the click listener which will send an intent to show the admin support details
569 * dialog. If the admin is null, remove the padlock and disabled color span. When the admin is
574 final MenuItem item, final EnforcedAdmin admin) {
578 if (admin != null) {
588 sendShowAdminSupportDetailsIntent(context, admin);
617 public static void sendShowAdminSupportDetailsIntent(Context context, EnforcedAdmin admin) {
618 final Intent intent = getShowAdminSupportDetailsIntent(context, admin);
620 if (admin != null && admin.userId != UserHandle.USER_NULL
621 && isCurrentUserOrProfile(context, admin.userId)) {
622 targetUserId = admin.userId;
627 public static Intent getShowAdminSupportDetailsIntent(Context context, EnforcedAdmin admin) {
629 if (admin != null) {
630 if (admin.component != null) {
631 intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, admin.component);
634 if (admin.userId != UserHandle.USER_NULL) {
635 adminUserId = admin.userId;
652 public static boolean isAdminInCurrentUserOrProfile(Context context, ComponentName admin) {
657 if (dpm.isAdminActiveAsUser(admin, userInfo.id)) {