本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
}