Fix negative size when size is greater than 2,147,483,647
Java integer max is 2,147,483,647, it's about 2GB. Use getLong to get size from provider instead of getInt. Bug: 190721008 Test: manual visual Copy video files more than 2,147,483,647 bytes and observe Videos size information. Change-Id: Ic804db43554fdd580627faebecfe30d9ad2a9120
This commit is contained in:
@@ -122,7 +122,7 @@ public class StorageAsyncLoader
|
|||||||
UserHandle.of(userId));
|
UserHandle.of(userId));
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
Log.e(TAG, "Not able to get Context for user ID " + userId);
|
Log.e(TAG, "Not able to get Context for user ID " + userId);
|
||||||
return 0;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Cursor cursor = perUserContext.getContentResolver().query(
|
try (Cursor cursor = perUserContext.getContentResolver().query(
|
||||||
@@ -131,9 +131,9 @@ public class StorageAsyncLoader
|
|||||||
queryArgs,
|
queryArgs,
|
||||||
null /* cancellationSignal */)) {
|
null /* cancellationSignal */)) {
|
||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
return 0;
|
return 0L;
|
||||||
}
|
}
|
||||||
return cursor.moveToFirst() ? cursor.getInt(0) : 0;
|
return cursor.moveToFirst() ? cursor.getLong(0) : 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user