Source:
public static boolean isRestrictionValid(Context context, String restriction) { final PackageManager pm = context.getPackageManager(); switch (restriction) { case UserManager.DISALLOW_ADD_USER: return UserManager.supportsMultipleUsers(); case UserManager.DISALLOW_ADJUST_VOLUME: return pm.hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT); case UserManager.DISALLOW_CONFIG_CELL_BROADCASTS: final int resId = context.getResources().getIdentifier( "config_cellBroadcastAppLinks", "bool", "android"); boolean isCellBroadcastAppLinkEnabled = context.getResources().getBoolean(resId); try { if (isCellBroadcastAppLinkEnabled) { if (pm.getApplicationEnabledSetting("com.android.cellbroadcastreceiver") == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) { isCellBroadcastAppLinkEnabled = false; } } } catch (IllegalArgumentException ignored) { isCellBroadcastAppLinkEnabled = false; } return isCellBroadcastAppLinkEnabled; case UserManager.DISALLOW_FUN: return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH); case UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS: return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); case UserManager.DISALLOW_CONFIG_WIFI: return pm.hasSystemFeature(PackageManager.FEATURE_WIFI); case UserManager.DISALLOW_NETWORK_RESET: return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH); case UserManager.DISALLOW_OUTGOING_BEAM: return pm.hasSystemFeature(PackageManager.FEATURE_NFC); case UserManager.DISALLOW_SHARE_LOCATION: return pm.hasSystemFeature(PackageManager.FEATURE_LOCATION); case UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES: return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH); case UserManager.DISALLOW_CONFIG_CREDENTIALS: return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH); default: return true; } }

Target:
public static boolean isRestrictionValid(Context context, String restriction) { final PackageManager pm = context.getPackageManager(); switch (restriction) { case UserManager.DISALLOW_ADJUST_VOLUME: return pm.hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT); case UserManager.DISALLOW_CONFIG_CELL_BROADCASTS: final int resId = context.getResources().getIdentifier( "config_cellBroadcastAppLinks", "bool", "android"); boolean isCellBroadcastAppLinkEnabled = context.getResources().getBoolean(resId); try { if (isCellBroadcastAppLinkEnabled) { if (pm.getApplicationEnabledSetting("com.android.cellbroadcastreceiver") == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) { isCellBroadcastAppLinkEnabled = false; } } } catch (IllegalArgumentException ignored) { isCellBroadcastAppLinkEnabled = false; } return isCellBroadcastAppLinkEnabled; case UserManager.DISALLOW_FUN: return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH); case UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS: return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); case UserManager.DISALLOW_CONFIG_WIFI: return pm.hasSystemFeature(PackageManager.FEATURE_WIFI); case UserManager.DISALLOW_NETWORK_RESET: return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH); case UserManager.DISALLOW_OUTGOING_BEAM: return pm.hasSystemFeature(PackageManager.FEATURE_NFC); case UserManager.DISALLOW_SHARE_LOCATION: return pm.hasSystemFeature(PackageManager.FEATURE_LOCATION); case UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES: return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH); case UserManager.DISALLOW_CONFIG_CREDENTIALS: return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH); default: return true; } }