Loading apex/blobstore/service/java/com/android/server/blob/BlobMetadata.java +13 −0 Original line number Diff line number Diff line Loading @@ -403,6 +403,19 @@ class BlobMetadata { return null; } boolean shouldAttributeToUser(int userId) { synchronized (mMetadataLock) { for (int i = 0, size = mLeasees.size(); i < size; ++i) { final Leasee leasee = mLeasees.valueAt(i); // Don't attribute the blob to userId if there is a lease on it from another user. if (userId != UserHandle.getUserId(leasee.uid)) { return false; } } } return true; } boolean shouldAttributeToLeasee(@NonNull String packageName, int userId, boolean callerHasStatsPermission) { if (!isALeaseeInUser(packageName, INVALID_UID, userId)) { Loading apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -1333,9 +1333,10 @@ public class BlobStoreManagerService extends SystemService { blobsDataSize.getAndAdd(session.getSize()); }, userHandle.getIdentifier()); // TODO(http://b/187460239): Update this to only include blobs available to userId. forEachBlob(blobMetadata -> { if (blobMetadata.shouldAttributeToUser(userHandle.getIdentifier())) { blobsDataSize.getAndAdd(blobMetadata.getSize()); } }); stats.dataSize += blobsDataSize.get(); Loading Loading
apex/blobstore/service/java/com/android/server/blob/BlobMetadata.java +13 −0 Original line number Diff line number Diff line Loading @@ -403,6 +403,19 @@ class BlobMetadata { return null; } boolean shouldAttributeToUser(int userId) { synchronized (mMetadataLock) { for (int i = 0, size = mLeasees.size(); i < size; ++i) { final Leasee leasee = mLeasees.valueAt(i); // Don't attribute the blob to userId if there is a lease on it from another user. if (userId != UserHandle.getUserId(leasee.uid)) { return false; } } } return true; } boolean shouldAttributeToLeasee(@NonNull String packageName, int userId, boolean callerHasStatsPermission) { if (!isALeaseeInUser(packageName, INVALID_UID, userId)) { Loading
apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -1333,9 +1333,10 @@ public class BlobStoreManagerService extends SystemService { blobsDataSize.getAndAdd(session.getSize()); }, userHandle.getIdentifier()); // TODO(http://b/187460239): Update this to only include blobs available to userId. forEachBlob(blobMetadata -> { if (blobMetadata.shouldAttributeToUser(userHandle.getIdentifier())) { blobsDataSize.getAndAdd(blobMetadata.getSize()); } }); stats.dataSize += blobsDataSize.get(); Loading