summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2012-10-22 17:56:54 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-22 17:56:54 -0700
commitb80b8bb2535504bada0664a7255b5fa61c2c3947 (patch)
tree29e97ad84ef1a2bec80532e9c26d7169bff20ed6 /src/com
parenta7acb166b282e3aa178eb1f6d1c8ece877d2c64d (diff)
parent64516a191f03a777896798f79792d39cde9592d7 (diff)
downloadpackages_apps_settings-b80b8bb2535504bada0664a7255b5fa61c2c3947.zip
packages_apps_settings-b80b8bb2535504bada0664a7255b5fa61c2c3947.tar.gz
packages_apps_settings-b80b8bb2535504bada0664a7255b5fa61c2c3947.tar.bz2
Merge "Fixes an AIOOBE when device admin enforces a small timeout for screen lock" into jb-mr1-dev
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/settings/DisplaySettings.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 9f812fe..fb839a7 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -154,15 +154,19 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
} else {
final CharSequence[] entries = preference.getEntries();
final CharSequence[] values = preference.getEntryValues();
- int best = 0;
- for (int i = 0; i < values.length; i++) {
- long timeout = Long.parseLong(values[i].toString());
- if (currentTimeout >= timeout) {
- best = i;
+ if (entries == null || entries.length == 0) {
+ summary = "";
+ } else {
+ int best = 0;
+ for (int i = 0; i < values.length; i++) {
+ long timeout = Long.parseLong(values[i].toString());
+ if (currentTimeout >= timeout) {
+ best = i;
+ }
}
+ summary = preference.getContext().getString(R.string.screen_timeout_summary,
+ entries[best]);
}
- summary = preference.getContext().getString(R.string.screen_timeout_summary,
- entries[best]);
}
preference.setSummary(summary);
}