diff options
-rw-r--r-- | res/values/arrays.xml | 34 | ||||
-rw-r--r-- | res/values/strings.xml | 35 | ||||
-rw-r--r-- | res/xml/security_settings_app_cyanogenmod.xml | 34 | ||||
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 24 |
4 files changed, 104 insertions, 23 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml index a3e6601..3862ae2 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- /* -** ** Copyright 2007 The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -76,7 +75,7 @@ <!-- Do not translate. --> <item>1800000</item> </string-array> - + <!-- Display settings. The delay in inactivity before the dream is shown. These are shown in a list dialog. --> <string-array name="dream_timeout_entries"> <item>Never</item> @@ -108,8 +107,8 @@ <!-- Do not translate. --> <item>1800000</item> </string-array> - - <!-- Security settings. The delay after screen is turned off until device locks. + + <!-- Security settings. The delay after screen is turned off until device locks. These are shown in a list dialog. --> <string-array name="lock_after_timeout_entries"> <item>Immediately</item> @@ -144,7 +143,7 @@ <!-- Do not translate. --> <item>1800000</item> </string-array> - + <string-array name="entries_font_size"> <item msgid="6490061470416867723">Small</item> <item msgid="3579015730662088893">Normal</item> @@ -158,7 +157,7 @@ <item>1.15</item> <item>1.30</item> </string-array> - + <!-- TTS settings --> <!-- Default speech rate choices --> @@ -186,6 +185,7 @@ <item>High</item> <item>Very high</item> </string-array> + <!-- Do not translate. --> <string-array name="tts_pitch_values"> <item>50</item> @@ -211,7 +211,6 @@ <item>spa</item> </string-array> - <!-- Wi-Fi settings --> <!-- Match this with the order of NetworkInfo.DetailedState. --> <skip /> @@ -580,7 +579,7 @@ <string-array name="long_press_timeout_selector_titles"> <!-- A title for the option for short long-press timeout [CHAR LIMIT=25] --> <item>Short</item> - <!-- A title for the option for medium long-press timeout [CHAR LIMIT=25] --> + <!-- A title for the option for medium long-press timeout [CHAR LIMIT=25] --> <item>Medium</item> <!-- A title for the option for long long-press timeout [CHAR LIMIT=25] --> <item>Long</item> @@ -1053,8 +1052,8 @@ </string-array> <string-array name="entries_network_widget"> - <item>2G/3G+2G</item> - <item>2G/3G Only</item> + <item>2G/3G+2G</item> + <item>2G/3G Only</item> <item>2G/3G Only/3G+2G</item> </string-array> @@ -1240,5 +1239,20 @@ <item>2</item> </string-array> + <!--- Sms security limit --> + <string-array name="sms_security_check_limit_entries" translatable="false"> + <item>@string/sms_security_check_limit_default</item> + <item>50</item> + <item>100</item> + <item>200</item> + </string-array> + + <string-array name="sms_security_check_limit_values" translatable="false"> + <item>30</item> + <item>50</item> + <item>100</item> + <item>200</item> + </string-array> + <!-- **** CYANOGENMOD EDITS END **** --> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 9726304..f52fd11 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,17 +1,20 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2007 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +<!-- +/* +** Copyright 2007 The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Strings for Dialog yes button --> @@ -5068,5 +5071,11 @@ <string name="pref_wifi_disable_hdcp_title">Skip HDCP negotiation</string> <string name="pref_wifi_disable_hdcp_summary">Try this option if you can connect but don\'t get any output</string> + <!--- Sms security limit --> + <string name="app_security_title">App security</string> + <string name="sms_security_check_limit_title">SMS message limit</string> + <string name="sms_security_check_limit_summary">Display an alert dialog to prevent applications from sending SMS messages too frequently. Current limit: %d messages in 15 minutes</string> + <string name="sms_security_check_limit_default">30 (Default)</string> + <!-- **** CYANOGENMOD ADDITIONS END **** --> </resources> diff --git a/res/xml/security_settings_app_cyanogenmod.xml b/res/xml/security_settings_app_cyanogenmod.xml new file mode 100644 index 0000000..8aaddcd --- /dev/null +++ b/res/xml/security_settings_app_cyanogenmod.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android"> + + <PreferenceCategory + android:key="app_security" + android:title="@string/app_security_title"> + + <ListPreference + android:key="sms_security_check_limit" + android:dialogTitle="@string/sms_security_check_limit_title" + android:title="@string/sms_security_check_limit_title" + android:entries="@array/sms_security_check_limit_entries" + android:entryValues="@array/sms_security_check_limit_values" + android:defaultValue="30" /> + + </PreferenceCategory> + +</PreferenceScreen> diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index 44ca959..6353ffc 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -90,6 +90,7 @@ public class SecuritySettings extends SettingsPreferenceFragment private static final String HOME_UNLOCK_PREF = "home_unlock"; private static final String LOCKSCREEN_QUICK_UNLOCK_CONTROL = "quick_unlock_control"; private static final String KEY_VIBRATE_PREF = "lockscreen_vibrate"; + private static final String KEY_SMS_SECURITY_CHECK_PREF = "sms_security_check_limit"; DevicePolicyManager mDPM; @@ -119,6 +120,7 @@ public class SecuritySettings extends SettingsPreferenceFragment private CheckBoxPreference mMenuUnlock; private CheckBoxPreference mHomeUnlock; private CheckBoxPreference mQuickUnlockScreen; + private ListPreference mSmsSecurityCheck; @Override public void onCreate(Bundle savedInstanceState) { @@ -147,6 +149,9 @@ public class SecuritySettings extends SettingsPreferenceFragment } ContentResolver resolver = getActivity().getApplicationContext().getContentResolver(); + // Add package manager to check if features are available + PackageManager pm = getPackageManager(); + // Add options for lock/unlock screen int resid = 0; if (!mLockPatternUtils.isSecure()) { @@ -379,6 +384,15 @@ public class SecuritySettings extends SettingsPreferenceFragment } } + boolean isTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); + if (isTelephony) { + addPreferencesFromResource(R.xml.security_settings_app_cyanogenmod); + mSmsSecurityCheck = (ListPreference) root.findPreference(KEY_SMS_SECURITY_CHECK_PREF); + mSmsSecurityCheck.setOnPreferenceChangeListener(this); + int smsSecurityCheck = Integer.valueOf(mSmsSecurityCheck.getValue()); + updateSmsSecuritySummary(smsSecurityCheck); + } + return root; } @@ -457,6 +471,11 @@ public class SecuritySettings extends SettingsPreferenceFragment mSlideLockTimeoutDelay.setSummary(entries[best]); } + private void updateSmsSecuritySummary(int i) { + String message = getString(R.string.sms_security_check_limit_summary, i); + mSmsSecurityCheck.setSummary(message); + } + private void updateSlideAfterScreenOffSummary() { // Update summary message with current value long currentTimeout = Settings.System.getInt(getActivity().getApplicationContext() @@ -708,6 +727,11 @@ public class SecuritySettings extends SettingsPreferenceFragment Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), Settings.System.SCREEN_LOCK_SLIDE_SCREENOFF_DELAY, slideScreenOffDelay); updateSlideAfterScreenOffSummary(); + } else if (preference == mSmsSecurityCheck) { + int smsSecurityCheck = Integer.valueOf((String) value); + Settings.Secure.putInt(getContentResolver(), Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT, + smsSecurityCheck); + updateSmsSecuritySummary(smsSecurityCheck); } return true; } |