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);
}
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);
}
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;
}
}
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;
}
}
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;
}
Aggregations