Java Code Examples for android.os.UserManager#isDeviceInDemoMode()
The following examples show how to use
android.os.UserManager#isDeviceInDemoMode() .
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: ImmersiveModeConfirmation.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public void immersiveModeChangedLw(String pkg, boolean isImmersiveMode, boolean userSetupComplete, boolean navBarEmpty) { mHandler.removeMessages(H.SHOW); if (isImmersiveMode) { final boolean disabled = PolicyControl.disableImmersiveConfirmation(pkg); if (DEBUG) Slog.d(TAG, String.format("immersiveModeChanged() disabled=%s mConfirmed=%s", disabled, mConfirmed)); if (!disabled && (DEBUG_SHOW_EVERY_TIME || !mConfirmed) && userSetupComplete && !mVrModeEnabled && !navBarEmpty && !UserManager.isDeviceInDemoMode(mContext) && (mLockTaskState != LOCK_TASK_MODE_LOCKED)) { mHandler.sendEmptyMessageDelayed(H.SHOW, mShowDelayMs); } } else { mHandler.sendEmptyMessage(H.HIDE); } }
Example 2
Source File: UserSwitchingDialog.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
void inflateContent() { // Set up the dialog contents setCancelable(false); Resources res = getContext().getResources(); // Custom view due to alignment and font size requirements View view = LayoutInflater.from(getContext()).inflate(R.layout.user_switching_dialog, null); String viewMessage = null; if (UserManager.isSplitSystemUser() && mNewUser.id == UserHandle.USER_SYSTEM) { viewMessage = res.getString(R.string.user_logging_out_message, mOldUser.name); } else if (UserManager.isDeviceInDemoMode(mContext)) { if (mOldUser.isDemo()) { viewMessage = res.getString(R.string.demo_restarting_message); } else { viewMessage = res.getString(R.string.demo_starting_message); } } else { if (mOldUser.id == UserHandle.USER_SYSTEM) { viewMessage = mSwitchingFromSystemUserMessage; } else if (mNewUser.id == UserHandle.USER_SYSTEM) { viewMessage = mSwitchingToSystemUserMessage; } // If switchingFromSystemUserMessage or switchingToSystemUserMessage is null, fallback // to system message. if (viewMessage == null) { viewMessage = res.getString(R.string.user_switching_message, mNewUser.name); } } ((TextView) view.findViewById(R.id.message)).setText(viewMessage); setView(view); }
Example 3
Source File: PowerManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
private void updateSettingsLocked() { final ContentResolver resolver = mContext.getContentResolver(); mDreamsEnabledSetting = (Settings.Secure.getIntForUser(resolver, Settings.Secure.SCREENSAVER_ENABLED, mDreamsEnabledByDefaultConfig ? 1 : 0, UserHandle.USER_CURRENT) != 0); mDreamsActivateOnSleepSetting = (Settings.Secure.getIntForUser(resolver, Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, mDreamsActivatedOnSleepByDefaultConfig ? 1 : 0, UserHandle.USER_CURRENT) != 0); mDreamsActivateOnDockSetting = (Settings.Secure.getIntForUser(resolver, Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, mDreamsActivatedOnDockByDefaultConfig ? 1 : 0, UserHandle.USER_CURRENT) != 0); mScreenOffTimeoutSetting = Settings.System.getIntForUser(resolver, Settings.System.SCREEN_OFF_TIMEOUT, DEFAULT_SCREEN_OFF_TIMEOUT, UserHandle.USER_CURRENT); mSleepTimeoutSetting = Settings.Secure.getIntForUser(resolver, Settings.Secure.SLEEP_TIMEOUT, DEFAULT_SLEEP_TIMEOUT, UserHandle.USER_CURRENT); mStayOnWhilePluggedInSetting = Settings.Global.getInt(resolver, Settings.Global.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC); mTheaterModeEnabled = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0) == 1; mAlwaysOnEnabled = mAmbientDisplayConfiguration.alwaysOnEnabled(UserHandle.USER_CURRENT); if (mSupportsDoubleTapWakeConfig) { boolean doubleTapWakeEnabled = Settings.Secure.getIntForUser(resolver, Settings.Secure.DOUBLE_TAP_TO_WAKE, DEFAULT_DOUBLE_TAP_TO_WAKE, UserHandle.USER_CURRENT) != 0; if (doubleTapWakeEnabled != mDoubleTapWakeEnabled) { mDoubleTapWakeEnabled = doubleTapWakeEnabled; nativeSetFeature(POWER_FEATURE_DOUBLE_TAP_TO_WAKE, mDoubleTapWakeEnabled ? 1 : 0); } } final String retailDemoValue = UserManager.isDeviceInDemoMode(mContext) ? "1" : "0"; if (!retailDemoValue.equals(SystemProperties.get(SYSTEM_PROPERTY_RETAIL_DEMO_ENABLED))) { SystemProperties.set(SYSTEM_PROPERTY_RETAIL_DEMO_ENABLED, retailDemoValue); } mScreenBrightnessModeSetting = Settings.System.getIntForUser(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL, UserHandle.USER_CURRENT); mDirty |= DIRTY_SETTINGS; }