Delete a blob after the last lease of it is released.
Also, avoid deleting it if it was committed recently to allow app that contributed it to acquire a lease. Bug: 151378266 Test: atest --test-mapping apex/blobstore Change-Id: I32f9bc0d0e9d74e7a07c279b5057f53ccb610673
This commit is contained in:
@@ -46,7 +46,7 @@ public class DummyBlobData {
|
||||
byte[] mFileDigest;
|
||||
long mExpiryTimeMs;
|
||||
|
||||
public DummyBlobData(Builder builder) {
|
||||
private DummyBlobData(Builder builder) {
|
||||
mRandom = new Random(builder.getRandomSeed());
|
||||
mFile = new File(builder.getContext().getFilesDir(), builder.getFileName());
|
||||
mFileSize = builder.getFileSize();
|
||||
|
||||
@@ -124,7 +124,11 @@ public class Utils {
|
||||
final BlobStoreManager blobStoreManager = (BlobStoreManager) context.getSystemService(
|
||||
Context.BLOB_STORE_SERVICE);
|
||||
blobStoreManager.releaseLease(blobHandle);
|
||||
assertThat(blobStoreManager.getLeaseInfo(blobHandle)).isNull();
|
||||
try {
|
||||
assertThat(blobStoreManager.getLeaseInfo(blobHandle)).isNull();
|
||||
} catch (SecurityException e) {
|
||||
// Expected, ignore
|
||||
}
|
||||
}
|
||||
|
||||
private static void assertLeaseInfo(LeaseInfo leaseInfo, String packageName,
|
||||
|
||||
Reference in New Issue
Block a user