Search in sources :

Example 1 with EnforcedAdmin

use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project platform_frameworks_base by android.

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 2 with EnforcedAdmin

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

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 3 with EnforcedAdmin

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

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 4 with EnforcedAdmin

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

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 5 with EnforcedAdmin

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

the class ResetNetwork method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final UserManager um = UserManager.get(getActivity());
    final EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(getActivity(), UserManager.DISALLOW_NETWORK_RESET, UserHandle.myUserId());
    if (!um.isAdminUser() || RestrictedLockUtils.hasBaseUserRestriction(getActivity(), UserManager.DISALLOW_NETWORK_RESET, UserHandle.myUserId())) {
        return inflater.inflate(R.layout.network_reset_disallowed_screen, null);
    } else if (admin != null) {
        View view = inflater.inflate(R.layout.admin_support_details_empty_view, null);
        ShowAdminSupportDetailsDialog.setAdminSupportDetails(getActivity(), view, admin, false);
        view.setVisibility(View.VISIBLE);
        return view;
    }
    mContentView = inflater.inflate(R.layout.reset_network, null);
    establishInitialState();
    return mContentView;
}
Also used : UserManager(android.os.UserManager) EnforcedAdmin(com.android.settingslib.RestrictedLockUtils.EnforcedAdmin) View(android.view.View)

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