Fix bug #19313587 Settings unusable when userdata is full
- take care of low storage space use case: do not start
and Index update if we are is low storage space situation.
Change-Id: Ifa5bb618d087826c004b06aa7821b9634038734c
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 415de5b..8eacc32 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -43,6 +43,7 @@
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
+import android.os.storage.StorageManager;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
@@ -532,7 +533,12 @@
getFragmentManager().addOnBackStackChangedListener(this);
if (mIsShowingDashboard) {
- Index.getInstance(getApplicationContext()).update();
+ // Run the Index update only if we have some space
+ if (!Utils.isLowStorage(this)) {
+ Index.getInstance(getApplicationContext()).update();
+ } else {
+ Log.w(LOG_TAG, "Cannot update the Indexer as we are running low on storage space!");
+ }
}
if (savedState != null) {