Search in sources :

Example 26 with EnforcedAdmin

use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project android_frameworks_base by AOSPA.

the class RestrictedPreferenceHelper method checkRestrictionAndSetDisabled.

/**
     * Set the user restriction that is used to disable this preference.
     *
     * @param userRestriction constant from {@link android.os.UserManager}
     * @param userId user to check the restriction for.
     */
public void checkRestrictionAndSetDisabled(String userRestriction, int userId) {
    EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(mContext, userRestriction, userId);
    setDisabledByAdmin(admin);
}
Also used : EnforcedAdmin(com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)

Example 27 with EnforcedAdmin

use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project android_frameworks_base by AOSPA.

the class UserSwitcherController method checkIfAddUserDisallowedByAdminOnly.

private void checkIfAddUserDisallowedByAdminOnly(UserRecord record) {
    EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_ADD_USER, ActivityManager.getCurrentUser());
    if (admin != null && !RestrictedLockUtils.hasBaseUserRestriction(mContext, UserManager.DISALLOW_ADD_USER, ActivityManager.getCurrentUser())) {
        record.isDisabledByAdmin = true;
        record.enforcedAdmin = admin;
    } else {
        record.isDisabledByAdmin = false;
        record.enforcedAdmin = null;
    }
}
Also used : EnforcedAdmin(com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)

Example 28 with EnforcedAdmin

use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project android_frameworks_base by DirtyUnicorns.

the class UserSwitcherController method checkIfAddUserDisallowedByAdminOnly.

private void checkIfAddUserDisallowedByAdminOnly(UserRecord record) {
    EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_ADD_USER, ActivityManager.getCurrentUser());
    if (admin != null && !RestrictedLockUtils.hasBaseUserRestriction(mContext, UserManager.DISALLOW_ADD_USER, ActivityManager.getCurrentUser())) {
        record.isDisabledByAdmin = true;
        record.enforcedAdmin = admin;
    } else {
        record.isDisabledByAdmin = false;
        record.enforcedAdmin = null;
    }
}
Also used : EnforcedAdmin(com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)

Example 29 with EnforcedAdmin

use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project android_frameworks_base by DirtyUnicorns.

the class QSTile method checkIfRestrictionEnforcedByAdminOnly.

protected void checkIfRestrictionEnforcedByAdminOnly(State state, String userRestriction) {
    EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(mContext, userRestriction, ActivityManager.getCurrentUser());
    if (admin != null && !RestrictedLockUtils.hasBaseUserRestriction(mContext, userRestriction, ActivityManager.getCurrentUser())) {
        state.disabledByPolicy = true;
        state.enforcedAdmin = admin;
    } else {
        state.disabledByPolicy = false;
        state.enforcedAdmin = null;
    }
}
Also used : EnforcedAdmin(com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)

Example 30 with EnforcedAdmin

use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project android_frameworks_base by ResurrectionRemix.

the class UserSwitcherController method checkIfAddUserDisallowedByAdminOnly.

private void checkIfAddUserDisallowedByAdminOnly(UserRecord record) {
    EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_ADD_USER, ActivityManager.getCurrentUser());
    if (admin != null && !RestrictedLockUtils.hasBaseUserRestriction(mContext, UserManager.DISALLOW_ADD_USER, ActivityManager.getCurrentUser())) {
        record.isDisabledByAdmin = true;
        record.enforcedAdmin = admin;
    } else {
        record.isDisabledByAdmin = false;
        record.enforcedAdmin = null;
    }
}
Also used : EnforcedAdmin(com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)

Aggregations

EnforcedAdmin (com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)42 View (android.view.View)5 Context (android.content.Context)4 UserManager (android.os.UserManager)3 RestrictedPreference (com.android.settingslib.RestrictedPreference)3 ComponentName (android.content.ComponentName)2 Intent (android.content.Intent)2 Drawable (android.graphics.drawable.Drawable)2 Preference (android.support.v7.preference.Preference)2 TextView (android.widget.TextView)2 AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)1 Activity (android.app.Activity)1 DevicePolicyManager (android.app.admin.DevicePolicyManager)1 ContentResolver (android.content.ContentResolver)1 ActivityInfo (android.content.pm.ActivityInfo)1 PackageManager (android.content.pm.PackageManager)1 ResolveInfo (android.content.pm.ResolveInfo)1 ServiceInfo (android.content.pm.ServiceInfo)1 ConnectivityManager (android.net.ConnectivityManager)1 Bundle (android.os.Bundle)1