use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationSettingsBase method setRestrictedIfNotificationFeaturesDisabled.
private void setRestrictedIfNotificationFeaturesDisabled(CharSequence entry, CharSequence entryValue, int keyguardNotificationFeatures) {
EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(mContext, keyguardNotificationFeatures, mUserId);
if (admin != null) {
RestrictedItem item = new RestrictedItem(entry, entryValue, admin);
mVisibilityOverride.addRestrictedItem(item);
}
}
use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiEnabler method handleWifiStateChanged.
private void handleWifiStateChanged(int state) {
// Clear any previous state
mSwitchBar.setDisabledByAdmin(null);
switch(state) {
case WifiManager.WIFI_STATE_ENABLING:
mSwitchBar.setEnabled(false);
break;
case WifiManager.WIFI_STATE_ENABLED:
setSwitchBarChecked(true);
mSwitchBar.setEnabled(true);
updateSearchIndex(true);
break;
case WifiManager.WIFI_STATE_DISABLING:
mSwitchBar.setEnabled(false);
break;
case WifiManager.WIFI_STATE_DISABLED:
setSwitchBarChecked(false);
mSwitchBar.setEnabled(true);
updateSearchIndex(false);
break;
default:
setSwitchBarChecked(false);
mSwitchBar.setEnabled(true);
updateSearchIndex(false);
}
if (mayDisableTethering(!mSwitchBar.isChecked())) {
if (RestrictedLockUtils.hasBaseUserRestriction(mContext, UserManager.DISALLOW_CONFIG_TETHERING, UserHandle.myUserId())) {
mSwitchBar.setEnabled(false);
} else {
final EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_CONFIG_TETHERING, UserHandle.myUserId());
mSwitchBar.setDisabledByAdmin(admin);
}
}
}
use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MasterClearConfirm method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(getActivity(), UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId());
if (RestrictedLockUtils.hasBaseUserRestriction(getActivity(), UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
return inflater.inflate(R.layout.master_clear_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.master_clear_confirm, null);
establishFinalConfirmationState();
setAccessibilityTitle();
return mContentView;
}
use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MasterClear method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final Context context = getContext();
final EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(context, UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId());
final UserManager um = UserManager.get(context);
final boolean disallow = !um.isAdminUser() || RestrictedLockUtils.hasBaseUserRestriction(context, UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId());
if (disallow && !Utils.isCarrierDemoUser(context)) {
return inflater.inflate(R.layout.master_clear_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.master_clear, null);
establishInitialState();
return mContentView;
}
use of com.android.settingslib.RestrictedLockUtils.EnforcedAdmin in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ChooseAccountActivity method onAuthDescriptionsUpdated.
private void onAuthDescriptionsUpdated() {
// Create list of providers to show on preference screen
for (int i = 0; i < mAuthDescs.length; i++) {
String accountType = mAuthDescs[i].type;
if (!Utils.showAccount(getPreferenceScreen().getContext(), accountType)) {
// If needn't to show the account, skip this account.
continue;
}
CharSequence providerName = getLabelForType(accountType);
// Skip preferences for authorities not specified. If no authorities specified,
// then include them all.
ArrayList<String> accountAuths = getAuthoritiesForAccountType(accountType);
boolean addAccountPref = true;
if (mAuthorities != null && mAuthorities.length > 0 && accountAuths != null) {
addAccountPref = false;
for (int k = 0; k < mAuthorities.length; k++) {
if (accountAuths.contains(mAuthorities[k])) {
addAccountPref = true;
break;
}
}
}
if (addAccountPref && mAccountTypesFilter != null && !mAccountTypesFilter.contains(accountType)) {
addAccountPref = false;
}
if (addAccountPref) {
mProviderList.add(new ProviderEntry(providerName, accountType));
} else {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "Skipped pref " + providerName + ": has no authority we need");
}
}
}
final Context context = getPreferenceScreen().getContext();
if (mProviderList.size() == 1 && getResources().getBoolean(R.bool.config_show_email)) {
// There's only one provider that matches. If it is disabled by admin show the
// support dialog otherwise run it.
EnforcedAdmin admin = RestrictedLockUtils.checkIfAccountManagementDisabled(context, mProviderList.get(0).type, mUserHandle.getIdentifier());
if (admin != null) {
setResult(RESULT_CANCELED, RestrictedLockUtils.getShowAdminSupportDetailsIntent(context, admin));
finishAccountActivity();
} else {
finishWithAccountType(mProviderList.get(0).type);
}
} else if (mProviderList.size() > 0) {
Collections.sort(mProviderList);
mAddAccountGroup.removeAll();
for (ProviderEntry pref : mProviderList) {
Drawable drawable = getDrawableForType(pref.type);
ProviderPreference p = new ProviderPreference(getPreferenceScreen().getContext(), pref.type, drawable, pref.name);
p.checkAccountManagementAndSetDisabled(mUserHandle.getIdentifier());
mAddAccountGroup.addPreference(p);
}
} else {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
final StringBuilder auths = new StringBuilder();
for (String a : mAuthorities) {
auths.append(a);
auths.append(' ');
}
Log.v(TAG, "No providers found for authorities: " + auths);
}
setResult(RESULT_CANCELED);
finishAccountActivity();
}
}
Aggregations