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
This commit is contained in:
@@ -52,6 +52,7 @@ import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFrameLayout;
|
||||
import android.preference.PreferenceGroup;
|
||||
@@ -1071,4 +1072,15 @@ public final class Utils {
|
||||
return inflater.inflate(resId, parent, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if we are running low on storage space or not.
|
||||
*
|
||||
* @param context The context
|
||||
* @return true if we are running low on storage space
|
||||
*/
|
||||
public static boolean isLowStorage(Context context) {
|
||||
final StorageManager sm = StorageManager.from(context);
|
||||
return (sm.getStorageBytesUntilLow(context.getFilesDir()) < 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user