当前位置: 首页>>代码示例>>Java>>正文


Java UserManager.getUserRestrictions方法代码示例

本文整理汇总了Java中android.os.UserManager.getUserRestrictions方法的典型用法代码示例。如果您正苦于以下问题:Java UserManager.getUserRestrictions方法的具体用法?Java UserManager.getUserRestrictions怎么用?Java UserManager.getUserRestrictions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.UserManager的用法示例。


在下文中一共展示了UserManager.getUserRestrictions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: supportsDrop

import android.os.UserManager; //导入方法依赖的package包/类
public static boolean supportsDrop(Context context, Object info) {
    UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
    Bundle restrictions = userManager.getUserRestrictions();
    if (restrictions.getBoolean(UserManager.DISALLOW_APPS_CONTROL, false)
            || restrictions.getBoolean(UserManager.DISALLOW_UNINSTALL_APPS, false)) {
        return false;
    }

    return getUninstallTarget(context, info) != null;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:11,代码来源:UninstallDropTarget.java

示例2: supportsDrop

import android.os.UserManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static boolean supportsDrop(Context context, Object info) {
    if (Utilities.ATLEAST_JB_MR2) {
        UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
        Bundle restrictions = userManager.getUserRestrictions();
        if (restrictions.getBoolean(UserManager.DISALLOW_APPS_CONTROL, false)
                || restrictions.getBoolean(UserManager.DISALLOW_UNINSTALL_APPS, false)) {
            return false;
        }
    }

    Pair<ComponentName, Integer> componentInfo = getAppInfoFlags(info);
    return componentInfo != null && (componentInfo.second & AppInfo.DOWNLOADED_FLAG) != 0;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:15,代码来源:UninstallDropTarget.java

示例3: areClingsEnabled

import android.os.UserManager; //导入方法依赖的package包/类
/** Returns whether the clings are enabled or should be shown */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private boolean areClingsEnabled() {
    // disable clings when running in a test harness
    if(ActivityManager.isRunningInTestHarness()) return false;

    // Disable clings for accessibility when explore by touch is enabled
    final AccessibilityManager a11yManager = (AccessibilityManager) mLauncher.getSystemService(
            Launcher.ACCESSIBILITY_SERVICE);
    if (a11yManager.isTouchExplorationEnabled()) {
        return false;
    }

    // Restricted secondary users (child mode) will potentially have very few apps
    // seeded when they start up for the first time. Clings won't work well with that
    if (Utilities.ATLEAST_JB_MR2) {
        UserManager um = (UserManager) mLauncher.getSystemService(Context.USER_SERVICE);
        Bundle restrictions = um.getUserRestrictions();
        if (restrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false)) {
            return false;
        }
    }
    if (Settings.Secure.getInt(mLauncher.getContentResolver(), SKIP_FIRST_USE_HINTS, 0)
            == 1) {
        return false;
    }
    return true;
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:29,代码来源:LauncherClings.java

示例4: hasSyncPermissions

import android.os.UserManager; //导入方法依赖的package包/类
@SuppressLint("InlinedApi")
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private static boolean hasSyncPermissions(Context context) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) return true;

    UserManager manager = (UserManager) context.getSystemService(Context.USER_SERVICE);
    Bundle userRestrictions = manager.getUserRestrictions();
    return !userRestrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false);
}
 
开发者ID:JackyAndroid,项目名称:AndroidChromium,代码行数:10,代码来源:FeatureUtilities.java

示例5: areClingsEnabled

import android.os.UserManager; //导入方法依赖的package包/类
/** Returns whether the clings are enabled or should be shown */
private boolean areClingsEnabled() {
    if (DISABLE_CLINGS) {
        return false;
    }

    // disable clings when running in a test harness
    if(ActivityManager.isRunningInTestHarness()) return false;

    // Disable clings for accessibility when explore by touch is enabled
    final AccessibilityManager a11yManager = (AccessibilityManager) mLauncher.getSystemService(
            Launcher.ACCESSIBILITY_SERVICE);
    if (a11yManager.isTouchExplorationEnabled()) {
        return false;
    }

    // Restricted secondary users (child mode) will potentially have very few apps
    // seeded when they start up for the first time. Clings won't work well with that
    boolean supportsLimitedUsers =
            android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
    Account[] accounts = AccountManager.get(mLauncher).getAccounts();
    if (supportsLimitedUsers && accounts.length == 0) {
        UserManager um = (UserManager) mLauncher.getSystemService(Context.USER_SERVICE);
        Bundle restrictions = um.getUserRestrictions();
        if (restrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false)) {
            return false;
        }
    }
    if (Settings.Secure.getInt(mLauncher.getContentResolver(), SKIP_FIRST_USE_HINTS, 0)
            == 1) {
        return false;
    }
    return true;
}
 
开发者ID:AndroidDeveloperLB,项目名称:LB-Launcher,代码行数:35,代码来源:LauncherClings.java

示例6: onDragStart

import android.os.UserManager; //导入方法依赖的package包/类
@Override
public void onDragStart(DragSource source, Object info, int dragAction) {
    boolean isVisible = true;
    boolean useUninstallLabel = isAllAppsApplication(source, info);
    boolean useDeleteLabel = !useUninstallLabel && source.supportsDeleteDropTarget();

    // If we are dragging an application from AppsCustomize, only show the control if we can
    // delete the app (it was downloaded), and rename the string to "uninstall" in such a case.
    // Hide the delete target if it is a widget from AppsCustomize.
    if (!willAcceptDrop(info) || isAllAppsWidget(source, info)) {
        isVisible = false;
    }
    if (useUninstallLabel) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            UserManager userManager = (UserManager)
                    getContext().getSystemService(Context.USER_SERVICE);
            Bundle restrictions = userManager.getUserRestrictions();
            if (restrictions.getBoolean(UserManager.DISALLOW_APPS_CONTROL, false)
                    || restrictions.getBoolean(UserManager.DISALLOW_UNINSTALL_APPS, false)) {
                isVisible = false;
            }
        }
    }

    if (useUninstallLabel) {
        setCompoundDrawablesRelativeWithIntrinsicBounds(mUninstallDrawable, null, null, null);
        setText(R.string.delete_target_uninstall_label);
    } else if (useDeleteLabel) {
        setCompoundDrawablesRelativeWithIntrinsicBounds(mRemoveDrawable, null, null, null);
        setText(R.string.delete_target_label);
    } else {
        isVisible = false;
    }
    mCurrentDrawable = (TransitionDrawable) getCurrentDrawable();

    mActive = isVisible;
    resetHoverColor();
    mDeleteDropTargetBar.setVisibility(isVisible ? View.VISIBLE : View.GONE);
}
 
开发者ID:krajeswaran,项目名称:LeanLauncher,代码行数:40,代码来源:DeleteDropTarget.java

示例7: getUserRestrictions

import android.os.UserManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private Bundle getUserRestrictions(final Context context) {
    final UserManager mgr = (UserManager) context.getSystemService(Context.USER_SERVICE);
    return mgr.getUserRestrictions();
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:6,代码来源:RestrictedProfileConfiguration.java

示例8: onDragStart

import android.os.UserManager; //导入方法依赖的package包/类
@Override
public void onDragStart(DragSource source, Object info, int dragAction) {
    boolean isVisible = true;
    boolean useUninstallLabel = !LauncherAppState.isDisableAllApps() &&
            isAllAppsApplication(source, info);
    boolean useDeleteLabel = !useUninstallLabel && source.supportsDeleteDropTarget();

    // If we are dragging an application from AppsCustomize, only show the control if we can
    // delete the app (it was downloaded), and rename the string to "uninstall" in such a case.
    // Hide the delete target if it is a widget from AppsCustomize.
    if (!willAcceptDrop(info) || isAllAppsWidget(source, info)) {
        isVisible = false;
    }
    if (useUninstallLabel) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            UserManager userManager = (UserManager)
                    getContext().getSystemService(Context.USER_SERVICE);
            Bundle restrictions = userManager.getUserRestrictions();
            if (restrictions.getBoolean(UserManager.DISALLOW_APPS_CONTROL, false)
                    || restrictions.getBoolean(UserManager.DISALLOW_UNINSTALL_APPS, false)) {
                isVisible = false;
            }
        }
    }

    if (useUninstallLabel) {
        setCompoundDrawablesRelativeWithIntrinsicBounds(mUninstallDrawable, null, null, null);
    } else if (useDeleteLabel) {
        setCompoundDrawablesRelativeWithIntrinsicBounds(mRemoveDrawable, null, null, null);
    } else {
        isVisible = false;
    }
    mCurrentDrawable = (TransitionDrawable) getCurrentDrawable();

    mActive = isVisible;
    resetHoverColor();
    ((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE);
    if (isVisible && getText().length() > 0) {
        setText(useUninstallLabel ? R.string.delete_target_uninstall_label
            : R.string.delete_target_label);
    }
}
 
开发者ID:AndroidDeveloperLB,项目名称:LB-Launcher,代码行数:43,代码来源:DeleteDropTarget.java


注:本文中的android.os.UserManager.getUserRestrictions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。