Merge "Don't attribute a blob to a user if there are leasees from other users." into sc-dev am: 08ad40f2d9 am: 6feb5cdf42
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14796666 Change-Id: I8bd6e81d55a91fb98ce04baa3bb49b25eaec6439
This commit is contained in:
@@ -403,6 +403,19 @@ class BlobMetadata {
|
|||||||
return null;
|
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 shouldAttributeToLeasee(@NonNull String packageName, int userId,
|
||||||
boolean callerHasStatsPermission) {
|
boolean callerHasStatsPermission) {
|
||||||
if (!isALeaseeInUser(packageName, INVALID_UID, userId)) {
|
if (!isALeaseeInUser(packageName, INVALID_UID, userId)) {
|
||||||
|
|||||||
@@ -1333,9 +1333,10 @@ public class BlobStoreManagerService extends SystemService {
|
|||||||
blobsDataSize.getAndAdd(session.getSize());
|
blobsDataSize.getAndAdd(session.getSize());
|
||||||
}, userHandle.getIdentifier());
|
}, userHandle.getIdentifier());
|
||||||
|
|
||||||
// TODO(http://b/187460239): Update this to only include blobs available to userId.
|
|
||||||
forEachBlob(blobMetadata -> {
|
forEachBlob(blobMetadata -> {
|
||||||
blobsDataSize.getAndAdd(blobMetadata.getSize());
|
if (blobMetadata.shouldAttributeToUser(userHandle.getIdentifier())) {
|
||||||
|
blobsDataSize.getAndAdd(blobMetadata.getSize());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
stats.dataSize += blobsDataSize.get();
|
stats.dataSize += blobsDataSize.get();
|
||||||
|
|||||||
Reference in New Issue
Block a user