am efc9458b: am 4f5555ab: am b80b8bb2: Merge "Fixes an AIOOBE when device admin enforces a small timeout for screen lock" into jb-mr1-dev

* commit 'efc9458b46cdbab7abe5df169d83a09582e8e6cd':
  Fixes an AIOOBE when device admin enforces a small timeout for screen lock
This commit is contained in:
Amith Yamasani
2012-10-22 18:03:49 -07:00
committed by Android Git Automerger

View File

@@ -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);
}