當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。