private void save() { // Sanity check boolean doSave = true; for (int i = 1; i < mLevels.length; i++) { if (mLevels[i] <= mLevels[i - 1]) { Toast.makeText(this, getString(R.string.ll_bad_levels), Toast.LENGTH_SHORT).show(); doSave = false; break; } } if (doSave) { Settings.System.putString( getContentResolver(), Settings.System.LIGHT_SENSOR_LEVELS, intArrayToString(mLevels)); Settings.System.putString( getContentResolver(), Settings.System.LIGHT_SENSOR_LCD_VALUES, intArrayToString(mLcdValues)); Settings.System.putString( getContentResolver(), Settings.System.LIGHT_SENSOR_BUTTON_VALUES, intArrayToString(mBtnValues)); Settings.System.putString( getContentResolver(), Settings.System.LIGHT_SENSOR_KEYBOARD_VALUES, intArrayToString(mKbValues)); long tag = Settings.System.getLong(getContentResolver(), Settings.System.LIGHTS_CHANGED, 0) + 1; Settings.System.putLong(getContentResolver(), Settings.System.LIGHTS_CHANGED, tag); mHasChanges = false; mSave.setEnabled(mHasChanges); } }
public static void setVoiceCallDefaultSim( Context context, ContentResolver contentResolver, List<SimInfoRecord> simInfos, long[] simIdForSlot, int nSimCount) { if (!FeatureOption.MTK_BSP_PACKAGE) { long defSIM = Settings.System.DEFAULT_SIM_NOT_SET; long oldVoiceCallDefaultSIM = Settings.System.getLong( contentResolver, Settings.System.VOICE_CALL_SIM_SETTING, Settings.System.DEFAULT_SIM_NOT_SET); logd("nSimCount = : " + nSimCount); if (nSimCount > 1) { defSIM = Settings.System.DEFAULT_SIM_SETTING_ALWAYS_ASK; if (isVoiceCallDefaultSIM(oldVoiceCallDefaultSIM)) { logd("setVoiceCallDefaultSim -- To : " + Settings.System.DEFAULT_SIM_SETTING_ALWAYS_ASK); Settings.System.putLong( contentResolver, Settings.System.VOICE_CALL_SIM_SETTING, Settings.System.DEFAULT_SIM_SETTING_ALWAYS_ASK); } } else if (nSimCount == 1) { defSIM = simInfos.get(0).mSimInfoId; if (!(SipManager.isVoipSupported(context) && isVoipEnabled(contentResolver)) || (isVoiceCallDefaultSIM(oldVoiceCallDefaultSIM))) { logd("setVoiceCallDefaultSim -- To : " + defSIM); Settings.System.putLong(contentResolver, Settings.System.VOICE_CALL_SIM_SETTING, defSIM); } } if (isSimRemoved(oldVoiceCallDefaultSIM, simIdForSlot, PhoneConstants.GEMINI_SIM_NUM)) { logd("setVoiceCallDefaultSim -- To : " + defSIM); Settings.System.putLong(contentResolver, Settings.System.VOICE_CALL_SIM_SETTING, defSIM); } } }