@Override public void onChange(boolean selfChange) { final ContentResolver resolver = mContext.getContentResolver(); mDevForceNavbar = Settings.Secure.getIntForUser( resolver, Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0, UserHandle.USER_CURRENT) == 1; }
/** Returns int corresponding to current location mode in settings. */ public int getLocationCurrentState() { int currentUserId = ActivityManager.getCurrentUser(); if (isUserLocationRestricted(currentUserId)) { return Settings.Secure.LOCATION_MODE_OFF; } final ContentResolver cr = mContext.getContentResolver(); return Settings.Secure.getIntForUser( cr, Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF, currentUserId); }
String getOwnerInfo() { ContentResolver res = getContext().getContentResolver(); final boolean ownerInfoEnabled = Settings.Secure.getIntForUser( res, Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED, 1, UserHandle.USER_CURRENT) != 0; return ownerInfoEnabled && !mShowingMessage ? Settings.Secure.getStringForUser( res, Settings.Secure.LOCK_SCREEN_OWNER_INFO, UserHandle.USER_CURRENT) : null; }
/** Returns true if location isn't disabled in settings. */ public boolean isLocationEnabled() { ContentResolver resolver = mContext.getContentResolver(); // QuickSettings always runs as the owner, so specifically retrieve the settings // for the current foreground user. int mode = Settings.Secure.getIntForUser( resolver, Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF, ActivityManager.getCurrentUser()); return mode != Settings.Secure.LOCATION_MODE_OFF; }
private void startAssistActivity(Bundle args) { if (!mBar.isDeviceProvisioned()) { return; } // Close Recent Apps if needed mBar.animateCollapsePanels( CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL | CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL); boolean structureEnabled = Settings.Secure.getIntForUser( mContext.getContentResolver(), Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, UserHandle.USER_CURRENT) != 0; final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) .getAssistIntent(structureEnabled); if (intent == null) { return; } if (mAssistComponent != null) { intent.setComponent(mAssistComponent); } intent.putExtras(args); if (structureEnabled) { showDisclosure(); } try { final ActivityOptions opts = ActivityOptions.makeCustomAnimation( mContext, R.anim.search_launch_enter, R.anim.search_launch_exit); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); AsyncTask.execute( new Runnable() { @Override public void run() { mContext.startActivityAsUser( intent, opts.toBundle(), new UserHandle(UserHandle.USER_CURRENT)); } }); } catch (ActivityNotFoundException e) { Log.w(TAG, "Activity not found for " + intent.getAction()); } }
public void update() { ContentResolver resolver = mContext.getContentResolver(); mBrightnessSliderEnabled = Settings.Secure.getIntForUser( mContext.getContentResolver(), Settings.Secure.QS_SHOW_BRIGHTNESS_SLIDER, 1, UserHandle.USER_CURRENT) == 1; mVibrationEnabled = Settings.System.getIntForUser( mContext.getContentResolver(), Settings.System.QUICK_SETTINGS_TILES_VIBRATE, 0, UserHandle.USER_CURRENT) == 1; mUseFourColumns = Settings.Secure.getIntForUser( mContext.getContentResolver(), Settings.Secure.QS_USE_FOUR_COLUMNS, 0, UserHandle.USER_CURRENT) == 1; }
public void refreshAllTiles() { mUseMainTiles = Settings.Secure.getIntForUser( getContext().getContentResolver(), Settings.Secure.QS_USE_MAIN_TILES, 1, UserHandle.USER_CURRENT) == 1; for (int i = 0; i < mRecords.size(); i++) { TileRecord r = mRecords.get(i); r.tileView.setDual(mUseMainTiles && i < 2); r.tile.refreshState(); } mFooter.refreshState(); }
private void updateTargets() { int currentUserHandle = mLockPatternUtils.getCurrentUser(); DevicePolicyManager dpm = mLockPatternUtils.getDevicePolicyManager(); int disabledFeatures = dpm.getKeyguardDisabledFeatures(null, currentUserHandle); boolean secureCameraDisabled = mLockPatternUtils.isSecure() && (disabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0; boolean cameraDisabledByAdmin = dpm.getCameraDisabled(null, currentUserHandle) || secureCameraDisabled; final KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(getContext()); boolean disabledBySimState = monitor.isSimLocked(); boolean cameraTargetPresent = isTargetPresent(com.android.internal.R.drawable.ic_lockscreen_camera); boolean searchTargetPresent = isTargetPresent(com.android.internal.R.drawable.ic_action_assist_generic); if (cameraDisabledByAdmin) { Log.v(TAG, "Camera disabled by Device Policy"); } else if (disabledBySimState) { Log.v(TAG, "Camera disabled by Sim State"); } boolean currentUserSetup = 0 != Settings.Secure.getIntForUser( mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0 /*default */, currentUserHandle); boolean searchActionAvailable = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) .getAssistIntent(mContext, UserHandle.USER_CURRENT) != null; mCameraDisabled = cameraDisabledByAdmin || disabledBySimState || !cameraTargetPresent || !currentUserSetup; mSearchDisabled = disabledBySimState || !searchActionAvailable || !searchTargetPresent || !currentUserSetup; updateResources(); }
private boolean isEnabled() { return Settings.Secure.getIntForUser( mContext.getContentResolver(), Settings.Secure.ADB_PORT, 0, UserHandle.USER_CURRENT) > 0; }