Handle monkey crash

Don't create dialog if we don't have one to create, and make sure
that storage-related prefs are removed when they aren't needed.

Bug: 22571238
Change-Id: I452cbf75313cd14572fc7b57bd6164292cf17209
This commit is contained in:
Jason Monk
2015-07-20 13:40:40 -04:00
parent bf9a425d5c
commit bd45c3cbe0
2 changed files with 4 additions and 1 deletions

View File

@@ -18,6 +18,7 @@
android:title="@string/application_info_label"> android:title="@string/application_info_label">
<com.android.settings.applications.SpacePreference <com.android.settings.applications.SpacePreference
android:key="storage_space"
android:layout_height="8dp" /> android:layout_height="8dp" />
<Preference <Preference

View File

@@ -71,6 +71,7 @@ public class AppStorageSettings extends AppInfoWithHeader
private static final String KEY_STORAGE_USED = "storage_used"; private static final String KEY_STORAGE_USED = "storage_used";
private static final String KEY_CHANGE_STORAGE = "change_storage_button"; private static final String KEY_CHANGE_STORAGE = "change_storage_button";
private static final String KEY_STORAGE_SPACE = "storage_space";
private static final String KEY_STORAGE_CATEGORY = "storage_category"; private static final String KEY_STORAGE_CATEGORY = "storage_category";
private static final String KEY_TOTAL_SIZE = "total_size"; private static final String KEY_TOTAL_SIZE = "total_size";
@@ -182,7 +183,7 @@ public class AppStorageSettings extends AppInfoWithHeader
} else { } else {
showDialogInner(DLG_CLEAR_DATA, 0); showDialogInner(DLG_CLEAR_DATA, 0);
} }
} else if (v == mChangeStorageButton) { } else if (v == mChangeStorageButton && mDialogBuilder != null) {
mDialogBuilder.show(); mDialogBuilder.show();
} }
} }
@@ -350,6 +351,7 @@ public class AppStorageSettings extends AppInfoWithHeader
} else { } else {
removePreference(KEY_STORAGE_USED); removePreference(KEY_STORAGE_USED);
removePreference(KEY_CHANGE_STORAGE); removePreference(KEY_CHANGE_STORAGE);
removePreference(KEY_STORAGE_SPACE);
} }
} }