Java Code Examples for android.content.res.Configuration#UI_MODE_TYPE_MASK
The following examples show how to use
android.content.res.Configuration#UI_MODE_TYPE_MASK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UiModeManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public int getCurrentModeType() { final long ident = Binder.clearCallingIdentity(); try { synchronized (mLock) { return mCurUiMode & Configuration.UI_MODE_TYPE_MASK; } } finally { Binder.restoreCallingIdentity(ident); } }
Example 2
Source File: UserManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Returns the maximum number of users that can be created on this device. A return value * of 1 means that it is a single user device. * @hide * @return a value greater than or equal to 1 */ public static int getMaxSupportedUsers() { // Don't allow multiple users on certain builds if (android.os.Build.ID.startsWith("JVP")) return 1; if (ActivityManager.isLowRamDeviceStatic()) { // Low-ram devices are Svelte. Most of the time they don't get multi-user. if ((Resources.getSystem().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) != Configuration.UI_MODE_TYPE_TELEVISION) { return 1; } } return SystemProperties.getInt("fw.max_users", Resources.getSystem().getInteger(R.integer.config_multiuserMaximumUsers)); }
Example 3
Source File: ThemeUtils.java From timecat with Apache License 2.0 | 5 votes |
public static Resources updateNightMode(Resources resource, boolean on) { DisplayMetrics dm = resource.getDisplayMetrics(); Configuration config = resource.getConfiguration(); final int uiModeNightMaskOrigin = config.uiMode &= ~Configuration.UI_MODE_TYPE_MASK; final int uiModeNightMaskNew = on ? Configuration.UI_MODE_NIGHT_YES : Configuration.UI_MODE_NIGHT_NO; if (uiModeNightMaskOrigin != uiModeNightMaskNew) { config.uiMode &= ~Configuration.UI_MODE_NIGHT_MASK; config.uiMode |= uiModeNightMaskNew; resource.updateConfiguration(config, dm); } return resource; }
Example 4
Source File: YalpStoreApplication.java From YalpStore with GNU General Public License v2.0 | 5 votes |
public boolean isTv() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) { return false; } int uiMode = getResources().getConfiguration().uiMode; return (uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_TELEVISION || getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION) || getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK) ; }
Example 5
Source File: ThemeUtils.java From MagicaSakura with Apache License 2.0 | 5 votes |
public static Resources updateNightMode(Resources resource, boolean on) { DisplayMetrics dm = resource.getDisplayMetrics(); Configuration config = resource.getConfiguration(); final int uiModeNightMaskOrigin = config.uiMode &= ~Configuration.UI_MODE_TYPE_MASK; final int uiModeNightMaskNew = on ? Configuration.UI_MODE_NIGHT_YES : Configuration.UI_MODE_NIGHT_NO; if (uiModeNightMaskOrigin != uiModeNightMaskNew) { config.uiMode &= ~Configuration.UI_MODE_NIGHT_MASK; config.uiMode |= uiModeNightMaskNew; resource.updateConfiguration(config, dm); } return resource; }
Example 6
Source File: JoH.java From xDrip with GNU General Public License v3.0 | 4 votes |
public static boolean areWeRunningOnAndroidWear() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && (xdrip.getAppContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_WATCH; }
Example 7
Source File: JoH.java From xDrip with GNU General Public License v3.0 | 4 votes |
public static boolean areWeRunningOnAndroidWear() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && (xdrip.getAppContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_WATCH; }
Example 8
Source File: JoH.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
public static boolean areWeRunningOnAndroidWear() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && (xdrip.getAppContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_WATCH; }
Example 9
Source File: JoH.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
public static boolean areWeRunningOnAndroidWear() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && (xdrip.getAppContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_WATCH; }
Example 10
Source File: ChromeActivity.java From 365browser with Apache License 2.0 | 4 votes |
private static boolean isInVrUiMode(int uiMode) { // TODO(mthiesse): Use Configuration.UI_MODE_TYPE_VR_HEADSET when building against the O // sdk. final int uiModeTypeVrHeadset = 0x07; return (uiMode & Configuration.UI_MODE_TYPE_MASK) == uiModeTypeVrHeadset; }