Merge "Fix "division by zero" crash after USB mass storage disconnects" am: a44b4feed4

am: 4ed2bb1ba9

* commit '4ed2bb1ba93d8b5fe101c660d24898bf3ed44592':
  Fix "division by zero" crash after USB mass storage disconnects
This commit is contained in:
Amith Yamasani
2016-01-05 00:33:03 +00:00
committed by android-build-merger

View File

@@ -75,7 +75,9 @@ public class StorageVolumePreference extends Preference {
final String used = Formatter.formatFileSize(context, usedBytes);
final String total = Formatter.formatFileSize(context, totalBytes);
setSummary(context.getString(R.string.storage_volume_summary, used, total));
mUsedPercent = (int) ((usedBytes * 100) / totalBytes);
if (totalBytes > 0) {
mUsedPercent = (int) ((usedBytes * 100) / totalBytes);
}
if (freeBytes < mStorageManager.getStorageLowBytes(path)) {
mColor = StorageSettings.COLOR_WARNING;