public String addEnableAccessibilityService(String nameService) { try { String enableSer = Settings.Secure.getString( cntx.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES); if (!enableSer.contains(nameService)) { // If not is enabled we activate the AccessibilityService // Service Settings.Secure.putInt( cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1); // Enable // accessibility Settings.Secure.putString( cntx.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, nameService); // Put // the // package // name // and // the // accesibility // service Settings.Secure.putInt( cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1); // Enable // accessibility } return MESSAGE_OK; } catch (Exception e) { e.printStackTrace(); return MESSAGE_ERROR; } }
// ensure that this accessibility service is enabled. // the service watches for google voice notifications to know when to check for new // messages. private void ensureEnabled() { Set<ComponentName> enabledServices = getEnabledServicesFromSettings(); ComponentName me = new ComponentName(this, getClass()); if (enabledServices.contains(me) && connected) return; enabledServices.add(me); // Update the enabled services setting. StringBuilder enabledServicesBuilder = new StringBuilder(); // Keep the enabled services even if they are not installed since we // have no way to know whether the application restore process has // completed. In general the system should be responsible for the // clean up not settings. for (ComponentName enabledService : enabledServices) { enabledServicesBuilder.append(enabledService.flattenToString()); enabledServicesBuilder.append(ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR); } final int enabledServicesBuilderLength = enabledServicesBuilder.length(); if (enabledServicesBuilderLength > 0) { enabledServicesBuilder.deleteCharAt(enabledServicesBuilderLength - 1); } Settings.Secure.putString( getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, enabledServicesBuilder.toString()); // Update accessibility enabled. Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 0); Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1); }
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { if (Utils.isMonkeyRunning()) { return false; } if (preference == mEnableAdb) { if (mEnableAdb.isChecked()) { mOkClicked = false; if (mOkDialog != null) dismissDialog(); mOkDialog = new AlertDialog.Builder(getActivity()) .setMessage(getActivity().getResources().getString(R.string.adb_warning_message)) .setTitle(R.string.adb_warning_title) .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.yes, this) .setNegativeButton(android.R.string.no, this) .show(); mOkDialog.setOnDismissListener(this); } else { Settings.Secure.putInt(getActivity().getContentResolver(), Settings.Secure.ADB_ENABLED, 0); } } else if (preference == mKeepScreenOn) { Settings.System.putInt( getActivity().getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN, mKeepScreenOn.isChecked() ? (BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0); } else if (preference == mAllowMockLocation) { Settings.Secure.putInt( getActivity().getContentResolver(), Settings.Secure.ALLOW_MOCK_LOCATION, mAllowMockLocation.isChecked() ? 1 : 0); } else if (preference == mStrictMode) { writeStrictModeVisualOptions(); } else if (preference == mPointerLocation) { writePointerLocationOptions(); } else if (preference == mShowTouches) { writeShowTouchesOptions(); } else if (preference == mShowScreenUpdates) { writeFlingerOptions(); } else if (preference == mShowCpuUsage) { writeCpuUsageOptions(); } else if (preference == mImmediatelyDestroyActivities) { writeImmediatelyDestroyActivitiesOptions(); } else if (preference == mShowAllANRs) { writeShowAllANRsOptions(); } else if (preference == mForceHardwareUi) { writeHardwareUiOptions(); } return false; }
public boolean onPreferenceChange(Preference arg0, Object arg1) { final String key = arg0.getKey(); if (KEY_NETWORK_MODE_SETTING.equals(key)) { int oldNetworkMode = android.provider.Settings.Secure.getInt( getContentResolver(), Settings.Secure.PREFERRED_NETWORK_MODE, preferredNetworkMode); int newNetworkMode = Integer.valueOf((String) arg1).intValue(); newNetworkMode = GeminiUtils.getNetworkMode(newNetworkMode); Settings.Secure.putInt( getContentResolver(), Settings.Secure.PREFERRED_NETWORK_MODE, newNetworkMode); if (newNetworkMode != oldNetworkMode) { Intent intent = new Intent(GeminiUtils.NETWORK_MODE_CHANGE_BROADCAST, null); intent.putExtra(GeminiUtils.OLD_NETWORK_MODE, oldNetworkMode); intent.putExtra(GeminiUtils.NETWORK_MODE_CHANGE_BROADCAST, newNetworkMode); intent.putExtra(Phone.GEMINI_SIM_ID_KEY, Phone.GEMINI_SIM_1); showDialog(DIALOG_NETWORK_MODE_CHANGE); setCancelable(false); getActivity().sendBroadcast(intent); Xlog.i(TAG, "Send broadcast of " + GeminiUtils.NETWORK_MODE_CHANGE_BROADCAST); } } return true; }
@Override public void setNightMode(int mode) { switch (mode) { case UiModeManager.MODE_NIGHT_NO: case UiModeManager.MODE_NIGHT_YES: case UiModeManager.MODE_NIGHT_AUTO: break; default: throw new IllegalArgumentException("Unknown mode: " + mode); } final long ident = Binder.clearCallingIdentity(); try { synchronized (mLock) { if (isDoingNightModeLocked() && mNightMode != mode) { Settings.Secure.putInt(getContext().getContentResolver(), Settings.Secure.UI_NIGHT_MODE, mode); mNightMode = mode; updateLocked(0, 0); } } } finally { Binder.restoreCallingIdentity(ident); } }
public void stopUpdates() { // revert previous location settings final ContentResolver contentResolver = getContentResolver(); Settings.Secure.putInt(contentResolver, Settings.Secure.LOCATION_MODE, mCurrentLocationmode); LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this); stopSelf(); }
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (!mIsRunning) { final Context context = getApplicationContext(); mIsRunning = true; final ContentResolver contentResolver = getContentResolver(); try { mCurrentLocationmode = Settings.Secure.getInt(contentResolver, Settings.Secure.LOCATION_MODE); if (mCurrentLocationmode != Settings.Secure.LOCATION_MODE_HIGH_ACCURACY) { Settings.Secure.putInt( contentResolver, Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_HIGH_ACCURACY); } } catch (SettingNotFoundException e) { Log.e(TAG, "Unable find location settings.", e); } int state = intent.getIntExtra(SERVICE_PARAM, Config.ANTITHEFT_STATE.NORMAL.getState()); if (state == Config.ANTITHEFT_STATE.THEFT.getState()) { mConstantReporting = true; } buildGoogleApiClient(); } if (mGoogleApiClient.isConnected()) { restartLocationUpdates(); } return START_REDELIVER_INTENT; }
public String removeEnableAccessibilityService(String nameService) { try { String enableSer = Settings.Secure.getString( cntx.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES); if (enableSer.contains(nameService)) { // check if the // AccessibilityService is // enabled // If is enabled we disable the AccessibilityService Settings.Secure.putInt( cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 0); // Disable // Accessibility Settings.Secure.putString( cntx.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, ""); // Clear // the // enabled // accessibility // service } else { // If not is enabled we activate the AccessibilityService // Service Settings.Secure.putInt( cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1); // Enable // accessibility Settings.Secure.putString( cntx.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "<AccessibilityService Package>/<AccessivilityService Name>"); // Put // the // package // name // and // the // accesibility // service Settings.Secure.putInt( cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1); // Enable // accessibility } return MESSAGE_OK; } catch (Exception e) { e.printStackTrace(); return MESSAGE_ERROR; } }
private void handleTogglePowerButtonEndsCallPreferenceClick() { Settings.Secure.putInt( getContentResolver(), Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR, (mTogglePowerButtonEndsCallPreference.isChecked() ? Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_HANGUP : Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF)); }
private void saveInputMethodSelectorVisibility(String value) { try { int intValue = Integer.valueOf(value); Settings.Secure.putInt( getContentResolver(), Settings.Secure.INPUT_METHOD_SELECTOR_VISIBILITY, intValue); updateInputMethodSelectorSummary(intValue); } catch (NumberFormatException e) { } }
public void onClick(DialogInterface dialog, int which) { if (which == DialogInterface.BUTTON_POSITIVE) { mOkClicked = true; Settings.Secure.putInt(getActivity().getContentResolver(), Settings.Secure.ADB_ENABLED, 1); } else { // Reset the toggle mEnableAdb.setChecked(false); } }
private void toggleTouchpad() { mTouchpadEnabled = !mTouchpadEnabled; nativeToggleTouchpad(mTouchpadEnabled); int enabled = mTouchpadEnabled ? 1 : 0; Settings.Secure.putInt(mContext.getContentResolver(), SETTING_TOUCHPAD_STATUS, enabled); notifyKey(ASUSDEC_TOUCHPAD, mTouchpadEnabled ? ASUSDEC_STATUS_ON : ASUSDEC_STATUS_OFF); }
public String enableTouchMode(String enable) { try { if (Settings.Secure.getString( cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED) .contains("1")) { // The // accessibility // should // be // enable if (enable.equalsIgnoreCase("0")) { // Check if touch // exploration is // enabled Settings.Secure.putInt( cntx.getContentResolver(), Settings.Secure.TOUCH_EXPLORATION_ENABLED, 0); // disable // the // touch // exploration Log.d( tag, "touch exploration: " + Settings.Secure.getString( cntx.getContentResolver(), Settings.Secure.TOUCH_EXPLORATION_ENABLED)); } else if (enable.equalsIgnoreCase("1")) { Settings.Secure.putInt( cntx.getContentResolver(), Settings.Secure.TOUCH_EXPLORATION_ENABLED, 1); // enable // the // touch // exploration Log.d( tag, "touch exploration: " + Settings.Secure.getString( cntx.getContentResolver(), Settings.Secure.TOUCH_EXPLORATION_ENABLED)); } } return MESSAGE_OK; } catch (Exception e) { e.printStackTrace(); return MESSAGE_ERROR; } }
@Override public void onSharedPreferenceChanged(SharedPreferences arg0, String arg1) { // TODO Auto-generated method stub final int val = arg0.getInt(Prefs.TICKER_TIME_PREF, Prefs.TICKER_TIME_DEFAULT); if (val != mTickerTime) { mTickerTime = val; } WGUtil.LogD(TAG, "---------ret=" + val); Settings.Secure.putInt(mContext.getContentResolver(), Prefs.TICKER_TIME_PREF, val); }
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference == mPrivacyGuardDefault) { boolean value = (Boolean) newValue; Settings.Secure.putInt( getContentResolver(), Settings.Secure.PRIVACY_GUARD_DEFAULT, value ? 1 : 0); return true; } return false; }
public String setPitchTTS(String pitch) { try { int p = Integer.parseInt(pitch); if (p >= 0 && p <= 500) { Settings.Secure.putInt(cntx.getContentResolver(), Settings.Secure.TTS_DEFAULT_PITCH, p); Settings.Secure.putInt(cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 0); Settings.Secure.putInt(cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1); } else { Log.d(tag, "Pitch param: value not valid "); return MESSAGE_ERROR; } return MESSAGE_OK; } catch (Exception e) { e.printStackTrace(); return MESSAGE_ERROR; } }
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { if (Utils.isMonkeyRunning()) { return false; } if (preference == mEnableAdb) { if (mEnableAdb.isChecked()) { mOkClicked = false; if (mOkDialog != null) dismissDialog(); mOkDialog = new AlertDialog.Builder(this) .setMessage(getResources().getString(R.string.adb_warning_message)) .setTitle(R.string.adb_warning_title) .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.yes, this) .setNegativeButton(android.R.string.no, this) .show(); mOkDialog.setOnDismissListener(this); } else { Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 0); SystemProperties.set("persist.service.adb.enable", "0"); } } else if (preference == mAdbNotify) { Settings.Secure.putInt( getContentResolver(), Settings.Secure.ADB_NOTIFY, mAdbNotify.isChecked() ? 1 : 0); } else if (preference == mKeepScreenOn) { Settings.System.putInt( getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN, mKeepScreenOn.isChecked() ? (BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0); } else if (preference == mAllowMockLocation) { Settings.Secure.putInt( getContentResolver(), Settings.Secure.ALLOW_MOCK_LOCATION, mAllowMockLocation.isChecked() ? 1 : 0); } return false; }
public void onClick(DialogInterface dialog, int which) { if (which == DialogInterface.BUTTON_POSITIVE) { mOkClicked = true; Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 1); SystemProperties.set("persist.service.adb.enable", "1"); } else { // Reset the toggle mEnableAdb.setChecked(false); } }
@Override public boolean onPreferenceChange(Preference preference, Object objValue) { // kill-app long press back if (preference == mKillAppLongPressBack) { boolean value = (Boolean) objValue; Settings.Secure.putInt(resolver, KILL_APP_LONGPRESS_BACK, value ? 1 : 0); return true; } return false; }
public String setRateTTS(String rate) { try { int r = Integer.parseInt(rate); if (r >= 0 && r <= 500) { Settings.Secure.putInt(cntx.getContentResolver(), Settings.Secure.TTS_DEFAULT_RATE, r); Settings.Secure.putInt(cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 0); Settings.Secure.putInt(cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1); } else { Log.d(tag, "Rate param: value not valid "); return MESSAGE_ERROR; } return MESSAGE_OK; } catch (Exception e) { e.printStackTrace(); return MESSAGE_ERROR; } }
private void resetNetworkModeToDefault() { android.provider.Settings.Secure.putInt( getPhone().getContext().getContentResolver(), android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, Settings.preferredNetworkMode); // Set the Modem getPhone() .setPreferredNetworkType( Settings.preferredNetworkMode, this.obtainMessage(MyHandler.MESSAGE_SET_PREFERRED_NETWORK_TYPE)); }
public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference == mSelectLongPressTimeoutPreference) { String stringValue = (String) newValue; Settings.Secure.putInt( getContentResolver(), Settings.Secure.LONG_PRESS_TIMEOUT, Integer.parseInt(stringValue)); mSelectLongPressTimeoutPreference.setSummary( mLongPressTimeoutValuetoTitleMap.get(stringValue)); return true; } return false; }
public String enableAccessibility(String accesibility) { try { int e = Integer.parseInt(accesibility); if (e == 0 || e == 1) { Settings.Secure.putInt(cntx.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, e); } return MESSAGE_OK; } catch (Exception e) { e.printStackTrace(); return MESSAGE_ERROR; } }
@Override public void onPreferenceToggled(String preferenceKey, boolean enabled) { // Parse the enabled services. Set<ComponentName> enabledServices = getEnabledServicesFromSettings(getActivity()); // Determine enabled services and accessibility state. ComponentName toggledService = ComponentName.unflattenFromString(preferenceKey); final boolean accessibilityEnabled; if (enabled) { // Enabling at least one service enables accessibility. accessibilityEnabled = true; enabledServices.add(toggledService); } else { // Check how many enabled and installed services are present. int enabledAndInstalledServiceCount = 0; Set<ComponentName> installedServices = sInstalledServices; for (ComponentName enabledService : enabledServices) { if (installedServices.contains(enabledService)) { enabledAndInstalledServiceCount++; } } // Disabling the last service disables accessibility. accessibilityEnabled = enabledAndInstalledServiceCount > 1 || (enabledAndInstalledServiceCount == 1 && !installedServices.contains(toggledService)); enabledServices.remove(toggledService); } // Update the enabled services setting. StringBuilder enabledServicesBuilder = new StringBuilder(); // Keep the enabled services even if they are not installed since we have // no way to know whether the application restore process has completed. // In general the system should be responsible for the clean up not settings. for (ComponentName enabledService : enabledServices) { enabledServicesBuilder.append(enabledService.flattenToString()); enabledServicesBuilder.append(ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR); } final int enabledServicesBuilderLength = enabledServicesBuilder.length(); if (enabledServicesBuilderLength > 0) { enabledServicesBuilder.deleteCharAt(enabledServicesBuilderLength - 1); } Settings.Secure.putString( getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, enabledServicesBuilder.toString()); // Update accessibility enabled. Settings.Secure.putInt( getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, accessibilityEnabled ? 1 : 0); }
@Override protected boolean persistBoolean(boolean value) { if (shouldPersist()) { if (value == getPersistedBoolean(!value)) { // It's already there, so the same as persisting return true; } Settings.Secure.putInt(getContext().getContentResolver(), getKey(), value ? 1 : 0); return true; } return false; }
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(TelephonyIntents.ACTION_SIM_INDICATOR_STATE_CHANGED)) { int slotId = intent.getIntExtra(TelephonyIntents.INTENT_KEY_ICC_SLOT, -1); int simStatus = intent.getIntExtra(TelephonyIntents.INTENT_KEY_ICC_STATE, -1); Xlog.i(TAG, "receive notification of sim slot = " + slotId + " status = " + simStatus); if ((slotId == Phone.GEMINI_SIM_1) && (simStatus >= 0)) { mNetworkMode.setStatus(simStatus); } } else if (action.equals(GeminiUtils.NETWORK_MODE_CHANGE_RESPONSE)) { if (!intent.getBooleanExtra(GeminiUtils.NETWORK_MODE_CHANGE_RESPONSE, true)) { Xlog.i(TAG, "BroadcastReceiver: network mode change failed! restore the old value."); android.provider.Settings.Secure.putInt( getContentResolver(), android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, intent.getIntExtra(OLD_NETWORK_MODE, 0)); } else { Xlog.i(TAG, "BroadcastReceiver: network mode change succeed! set the new value."); android.provider.Settings.Secure.putInt( getContentResolver(), android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, intent.getIntExtra(GeminiUtils.NEW_NETWORK_MODE, 0)); } if (isDialogShowing(DIALOG_NETWORK_MODE_CHANGE)) { removeDialog(DIALOG_NETWORK_MODE_CHANGE); } } }
@Override public void onPreferenceToggled(String preferenceKey, boolean enabled) { Settings.Secure.putInt( getContentResolver(), Settings.Secure.TOUCH_EXPLORATION_ENABLED, enabled ? 1 : 0); if (enabled) { SharedPreferences preferences = getActivity().getPreferences(Context.MODE_PRIVATE); final boolean launchAccessibilityTutorial = !preferences.getBoolean(KEY_ACCESSIBILITY_TUTORIAL_LAUNCHED_ONCE, false); if (launchAccessibilityTutorial) { preferences.edit().putBoolean(KEY_ACCESSIBILITY_TUTORIAL_LAUNCHED_ONCE, true).commit(); Intent intent = new Intent(AccessibilityTutorialActivity.ACTION); getActivity().startActivity(intent); } } }
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { if (preference == menuButtonLocation) { Settings.System.putInt( getActivity().getContentResolver(), Settings.System.LOCKSCREEN_ENABLE_MENU_KEY, ((CheckBoxPreference) preference).isChecked() ? 1 : 0); return true; } else if (preference == mLockScreenTimeoutUserOverride) { Settings.Secure.putInt( getActivity().getContentResolver(), Settings.Secure.LOCK_SCREEN_LOCK_USER_OVERRIDE, ((CheckBoxPreference) preference).isChecked() ? 1 : 0); return true; } else if (preference == mLockscreenBattery) { Settings.System.putInt( getActivity().getContentResolver(), Settings.System.LOCKSCREEN_BATTERY, ((CheckBoxPreference) preference).isChecked() ? 1 : 0); return true; } else if (preference == mVolumeWake) { Settings.System.putInt( getActivity().getContentResolver(), Settings.System.VOLUME_WAKE_SCREEN, ((CheckBoxPreference) preference).isChecked() ? 1 : 0); return true; } else if (preference == mVolumeMusic) { Settings.System.putInt( getActivity().getContentResolver(), Settings.System.VOLUME_MUSIC_CONTROLS, ((CheckBoxPreference) preference).isChecked() ? 1 : 0); return true; } else if (keys.contains(preference.getKey())) { Log.e("RC_Lockscreens", "key: " + preference.getKey()); return Settings.System.putInt( getActivity().getContentResolver(), preference.getKey(), ((CheckBoxPreference) preference).isChecked() ? 1 : 0); } return super.onPreferenceTreeClick(preferenceScreen, preference); }
/** returns true on success, false if the user must correct something */ boolean saveToDb() { String hostname = mHostnameField.getText().toString().trim(); String portStr = mPortField.getText().toString().trim(); int port = -1; int result = validate(hostname, portStr); if (result > 0) { showError(result); return false; } if (portStr.length() > 0) { try { port = Integer.parseInt(portStr); } catch (NumberFormatException ex) { return false; } } // FIXME: The best solution would be to make a better UI that would // disable editing of the text boxes if the user chooses to use the // default settings. i.e. checking a box to always use the default // carrier. http:/b/issue?id=756480 // FIXME: This currently will not work if the default host is blank and // the user has cleared the input boxes in order to not use a proxy. // This is a UI problem and can be solved with some better form // controls. // FIXME: If the user types in a proxy that matches the default, should // we keep that setting? Can be fixed with a new UI. ContentResolver res = getContentResolver(); if (hostname.equals(Proxy.getDefaultHost()) && port == Proxy.getDefaultPort()) { // If the user hit the default button and didn't change any of // the input boxes, treat it as if the user has not specified a // proxy. hostname = null; } if (!TextUtils.isEmpty(hostname)) { hostname += ':' + portStr; } Settings.Secure.putString(res, Settings.Secure.HTTP_PROXY, hostname); Settings.Secure.putInt( res, Settings.Secure.HTTP_PROXY_WIFI_ONLY, mProxyWifiOnly.isChecked() ? 1 : 0); sendBroadcast(new Intent(Proxy.PROXY_CHANGE_ACTION)); return true; }
public boolean setPriority(BluetoothDevice device, int priority) { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); synchronized (BluetoothHeadsetService.this) { if (!BluetoothAdapter.checkBluetoothAddress(device.getAddress())) { return false; } if (priority < BluetoothHeadset.PRIORITY_OFF) { return false; } Settings.Secure.putInt( getContentResolver(), Settings.Secure.getBluetoothHeadsetPriorityKey(device.getAddress()), priority); if (DBG) log("Saved priority " + device + " = " + priority); return true; } }