Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 248970aa authored by Arc Wang's avatar Arc Wang
Browse files

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
parent 443a3f03
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ public class StorageAsyncLoader
                UserHandle.of(userId));
        } catch (NameNotFoundException e) {
            Log.e(TAG, "Not able to get Context for user ID " + userId);
            return 0;
            return 0L;
        }

        try (Cursor cursor = perUserContext.getContentResolver().query(
@@ -131,9 +131,9 @@ public class StorageAsyncLoader
                queryArgs,
                null /* cancellationSignal */)) {
            if (cursor == null) {
                return 0;
                return 0L;
            }
            return cursor.moveToFirst() ? cursor.getInt(0) : 0;
            return cursor.moveToFirst() ? cursor.getLong(0) : 0L;
        }
    }