public boolean isLowStorage(Activity activity) {
    IntentFilter lowStorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
    return activity.registerReceiver(null, lowStorageFilter) != null;
  }
Check if the device has low storage.
java/com/google/android/apps/authenticator/barcode/BarcodeConditionChecker.java