Merge "Fix possible NPE when Screen settings is launched quickly in succession."

This commit is contained in:
Amith Yamasani
2011-03-15 17:17:53 -07:00
committed by Android (Google) Code Review

View File

@@ -76,6 +76,12 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
addPreferencesFromResource(R.xml.display_settings); addPreferencesFromResource(R.xml.display_settings);
// Fetch this once before attaching a listener for changes.
try {
mAnimationScales = mWindowManager.getAnimationScales();
} catch (RemoteException e) {
// Shouldn't happen and not much can be done anyway.
}
mAnimations = (ListPreference) findPreference(KEY_ANIMATIONS); mAnimations = (ListPreference) findPreference(KEY_ANIMATIONS);
mAnimations.setOnPreferenceChangeListener(this); mAnimations.setOnPreferenceChangeListener(this);
mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER); mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER);
@@ -189,6 +195,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
try { try {
mAnimationScales = mWindowManager.getAnimationScales(); mAnimationScales = mWindowManager.getAnimationScales();
} catch (RemoteException e) { } catch (RemoteException e) {
// Shouldn't happen and not much can be done anyway.
} }
if (mAnimationScales != null) { if (mAnimationScales != null) {
if (mAnimationScales.length >= 1) { if (mAnimationScales.length >= 1) {