本文整理汇总了Java中android.content.RestrictionsManager类的典型用法代码示例。如果您正苦于以下问题:Java RestrictionsManager类的具体用法?Java RestrictionsManager怎么用?Java RestrictionsManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RestrictionsManager类属于android.content包,在下文中一共展示了RestrictionsManager类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkManagedConfiguration
import android.content.RestrictionsManager; //导入依赖的package包/类
public void checkManagedConfiguration() {
Log.d(TAG, "Checking managed configuration");
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
// Check for managed configuration
RestrictionsManager restrictionsManager =
(RestrictionsManager) getSystemService(Context.RESTRICTIONS_SERVICE);
Bundle appRestrictions = restrictionsManager.getApplicationRestrictions();
if (appRestrictions != null && appRestrictions.containsKey("profileUrl")) {
Log.d(TAG, "Found managed configuration install URL "
+ appRestrictions.getString("profileUrl"));
incomingRef = appRestrictions.getString("profileUrl");
lastInstallMode = INSTALL_MODE_MANAGED_CONFIGURATION;
uiState = UiState.READY_TO_INSTALL;
uiStateScreenTransition();
startResourceInstall();
}
}
}
示例2: checkManagedConfiguration
import android.content.RestrictionsManager; //导入依赖的package包/类
private void checkManagedConfiguration() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
// Check for managed configuration
RestrictionsManager restrictionsManager =
(RestrictionsManager) getSystemService(Context.RESTRICTIONS_SERVICE);
if (restrictionsManager == null) {
return;
}
Bundle appRestrictions = restrictionsManager.getApplicationRestrictions();
if (appRestrictions.containsKey("username") &&
appRestrictions.containsKey("password")) {
uiController.setUsername(appRestrictions.getString("username"));
uiController.setPasswordOrPin(appRestrictions.getString("password"));
initiateLoginAttempt(false);
}
}
}
示例3: getAppRestrictions
import android.content.RestrictionsManager; //导入依赖的package包/类
private void getAppRestrictions(){
RestrictionsManager restrictionsManager =
(RestrictionsManager) this
.getSystemService(Context.RESTRICTIONS_SERVICE);
Bundle appRestrictions = restrictionsManager.getApplicationRestrictions();
// Block user if KEY_RESTRICTIONS_PENDING is true, and save login hint if available
if(!appRestrictions.isEmpty()){
if(appRestrictions.getBoolean(UserManager.
KEY_RESTRICTIONS_PENDING)!=true){
mLoginHint = appRestrictions.getString(LOGIN_HINT);
}
else {
Toast.makeText(this,R.string.restrictions_pending_block_user,
Toast.LENGTH_LONG).show();
finish();
}
}
}
示例4: getIntentForChallengeUIIfRequired
import android.content.RestrictionsManager; //导入依赖的package包/类
@TargetApi(21)
public static Intent getIntentForChallengeUIIfRequired(Activity paramActivity)
{
if (sUserPinValid) {
return null;
}
Intent localIntent = ((RestrictionsManager)paramActivity.getSystemService("restrictions")).createLocalApprovalIntent();
PersistableBundle localPersistableBundle = new PersistableBundle();
localPersistableBundle.putString("android.request.mesg", paramActivity.getString(2131362662));
localIntent.putExtra("android.content.extra.REQUEST_BUNDLE", localPersistableBundle);
return localIntent;
}
示例5: onCreate
import android.content.RestrictionsManager; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
mDevicePolicyManager = (DevicePolicyManager) getActivity().getSystemService(
Context.DEVICE_POLICY_SERVICE);
mRestrictionsManager = (RestrictionsManager) getActivity().getSystemService(
Context.RESTRICTIONS_SERVICE);
}
示例6: getRestrictionsManager
import android.content.RestrictionsManager; //导入依赖的package包/类
/**
* 返回 {@link RestrictionsManager}
*/
public static RestrictionsManager getRestrictionsManager()
{
return (RestrictionsManager) get(RESTRICTIONS_SERVICE);
}
示例7: getRestrictionsManager
import android.content.RestrictionsManager; //导入依赖的package包/类
@TargetApi(21)
public static RestrictionsManager getRestrictionsManager() {
return (RestrictionsManager) getSystemService(Context.RESTRICTIONS_SERVICE);
}
示例8: restrictions
import android.content.RestrictionsManager; //导入依赖的package包/类
/**
* @since 4.0.0
*/
public static RestrictionsManager restrictions(Context context) {
return (RestrictionsManager) context.getSystemService(RESTRICTIONS_SERVICE);
}
示例9: restrictionsManager
import android.content.RestrictionsManager; //导入依赖的package包/类
@TargetApi(AndroidHelper.API_21)
public static RestrictionsManager restrictionsManager() {
return (RestrictionsManager) get(Context.RESTRICTIONS_SERVICE);
}
示例10: getRestrictionsManager
import android.content.RestrictionsManager; //导入依赖的package包/类
/**
* Obtain a {@link RestrictionsManager} instance associated with specified {@link Context}
*
* @param context Context
* @return {@link RestrictionsManager} associated with specified {@link Context}
* @throws InvalidContextException if {@link RestrictionsManager} can't be obtained
* from specified {@link Context}
*/
@NonNull
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public static RestrictionsManager getRestrictionsManager(@NonNull Context context) {
return validate(context.getSystemService(Context.RESTRICTIONS_SERVICE));
}