Loading apct-tests/perftests/blobstore/src/com/android/perftests/blob/BlobStorePerfTests.java +3 −2 Original line number Diff line number Diff line Loading @@ -121,8 +121,9 @@ public class BlobStorePerfTests { } private DummyBlobData prepareDataBlob(int fileSizeInMb) throws Exception { final DummyBlobData blobData = new DummyBlobData(mContext, fileSizeInMb * 1024 * 1024 /* bytes */); final DummyBlobData blobData = new DummyBlobData.Builder(mContext) .setFileSize(fileSizeInMb * 1024 * 1024 /* bytes */) .build(); blobData.prepare(); return blobData; } Loading apex/blobstore/framework/java/android/app/blob/BlobInfo.java +8 −8 Original line number Diff line number Diff line Loading @@ -32,21 +32,21 @@ public final class BlobInfo implements Parcelable { private final long mId; private final long mExpiryTimeMs; private final CharSequence mLabel; private final List<AccessorInfo> mAccessors; private final List<LeaseInfo> mLeaseInfos; public BlobInfo(long id, long expiryTimeMs, CharSequence label, List<AccessorInfo> accessors) { List<LeaseInfo> leaseInfos) { mId = id; mExpiryTimeMs = expiryTimeMs; mLabel = label; mAccessors = accessors; mLeaseInfos = leaseInfos; } private BlobInfo(Parcel in) { mId = in.readLong(); mExpiryTimeMs = in.readLong(); mLabel = in.readCharSequence(); mAccessors = in.readArrayList(null /* classloader */); mLeaseInfos = in.readArrayList(null /* classloader */); } public long getId() { Loading @@ -61,8 +61,8 @@ public final class BlobInfo implements Parcelable { return mLabel; } public List<AccessorInfo> getAccessors() { return Collections.unmodifiableList(mAccessors); public List<LeaseInfo> getLeases() { return Collections.unmodifiableList(mLeaseInfos); } @Override Loading @@ -70,7 +70,7 @@ public final class BlobInfo implements Parcelable { dest.writeLong(mId); dest.writeLong(mExpiryTimeMs); dest.writeCharSequence(mLabel); dest.writeList(mAccessors); dest.writeList(mLeaseInfos); } @Override Loading @@ -83,7 +83,7 @@ public final class BlobInfo implements Parcelable { + "id: " + mId + "," + "expiryMs: " + mExpiryTimeMs + "," + "label: " + mLabel + "," + "accessors: " + AccessorInfo.toShortString(mAccessors) + "," + "leases: " + LeaseInfo.toShortString(mLeaseInfos) + "," + "}"; } Loading apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java +45 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.CurrentTimeMillisLong; import android.annotation.IdRes; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemService; import android.annotation.TestApi; import android.content.Context; Loading Loading @@ -521,6 +522,50 @@ public class BlobStoreManager { } } /** * Return the {@link BlobHandle BlobHandles} corresponding to the data blobs that * the calling app has acquired a lease on using {@link #acquireLease(BlobHandle, int)} or * one of it's other variants. * * @hide */ @TestApi @NonNull public List<BlobHandle> getLeasedBlobs() throws IOException { try { return mService.getLeasedBlobs(mContext.getOpPackageName()); } catch (ParcelableException e) { e.maybeRethrow(IOException.class); throw new RuntimeException(e); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Return {@link LeaseInfo} representing a lease acquired using * {@link #acquireLease(BlobHandle, int)} or one of it's other variants, * or {@code null} if there is no lease acquired. * * @throws SecurityException when the blob represented by the {@code blobHandle} does not * exist or the caller does not have access to it. * @throws IllegalArgumentException when {@code blobHandle} is invalid. * * @hide */ @TestApi @Nullable public LeaseInfo getLeaseInfo(@NonNull BlobHandle blobHandle) throws IOException { try { return mService.getLeaseInfo(blobHandle, mContext.getOpPackageName()); } catch (ParcelableException e) { e.maybeRethrow(IOException.class); throw new RuntimeException(e); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Represents an ongoing session of a blob's contribution to the blob store managed by the * system. Loading apex/blobstore/framework/java/android/app/blob/IBlobStoreManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.app.blob; import android.app.blob.BlobHandle; import android.app.blob.BlobInfo; import android.app.blob.IBlobStoreSession; import android.app.blob.LeaseInfo; import android.os.RemoteCallback; /** {@hide} */ Loading @@ -35,4 +36,7 @@ interface IBlobStoreManager { List<BlobInfo> queryBlobsForUser(int userId); void deleteBlob(long blobId); List<BlobHandle> getLeasedBlobs(in String packageName); LeaseInfo getLeaseInfo(in BlobHandle blobHandle, in String packageName); } No newline at end of file apex/blobstore/framework/java/android/app/blob/LeaseInfo.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.blob; /** {@hide} */ parcelable LeaseInfo; No newline at end of file Loading
apct-tests/perftests/blobstore/src/com/android/perftests/blob/BlobStorePerfTests.java +3 −2 Original line number Diff line number Diff line Loading @@ -121,8 +121,9 @@ public class BlobStorePerfTests { } private DummyBlobData prepareDataBlob(int fileSizeInMb) throws Exception { final DummyBlobData blobData = new DummyBlobData(mContext, fileSizeInMb * 1024 * 1024 /* bytes */); final DummyBlobData blobData = new DummyBlobData.Builder(mContext) .setFileSize(fileSizeInMb * 1024 * 1024 /* bytes */) .build(); blobData.prepare(); return blobData; } Loading
apex/blobstore/framework/java/android/app/blob/BlobInfo.java +8 −8 Original line number Diff line number Diff line Loading @@ -32,21 +32,21 @@ public final class BlobInfo implements Parcelable { private final long mId; private final long mExpiryTimeMs; private final CharSequence mLabel; private final List<AccessorInfo> mAccessors; private final List<LeaseInfo> mLeaseInfos; public BlobInfo(long id, long expiryTimeMs, CharSequence label, List<AccessorInfo> accessors) { List<LeaseInfo> leaseInfos) { mId = id; mExpiryTimeMs = expiryTimeMs; mLabel = label; mAccessors = accessors; mLeaseInfos = leaseInfos; } private BlobInfo(Parcel in) { mId = in.readLong(); mExpiryTimeMs = in.readLong(); mLabel = in.readCharSequence(); mAccessors = in.readArrayList(null /* classloader */); mLeaseInfos = in.readArrayList(null /* classloader */); } public long getId() { Loading @@ -61,8 +61,8 @@ public final class BlobInfo implements Parcelable { return mLabel; } public List<AccessorInfo> getAccessors() { return Collections.unmodifiableList(mAccessors); public List<LeaseInfo> getLeases() { return Collections.unmodifiableList(mLeaseInfos); } @Override Loading @@ -70,7 +70,7 @@ public final class BlobInfo implements Parcelable { dest.writeLong(mId); dest.writeLong(mExpiryTimeMs); dest.writeCharSequence(mLabel); dest.writeList(mAccessors); dest.writeList(mLeaseInfos); } @Override Loading @@ -83,7 +83,7 @@ public final class BlobInfo implements Parcelable { + "id: " + mId + "," + "expiryMs: " + mExpiryTimeMs + "," + "label: " + mLabel + "," + "accessors: " + AccessorInfo.toShortString(mAccessors) + "," + "leases: " + LeaseInfo.toShortString(mLeaseInfos) + "," + "}"; } Loading
apex/blobstore/framework/java/android/app/blob/BlobStoreManager.java +45 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.CurrentTimeMillisLong; import android.annotation.IdRes; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemService; import android.annotation.TestApi; import android.content.Context; Loading Loading @@ -521,6 +522,50 @@ public class BlobStoreManager { } } /** * Return the {@link BlobHandle BlobHandles} corresponding to the data blobs that * the calling app has acquired a lease on using {@link #acquireLease(BlobHandle, int)} or * one of it's other variants. * * @hide */ @TestApi @NonNull public List<BlobHandle> getLeasedBlobs() throws IOException { try { return mService.getLeasedBlobs(mContext.getOpPackageName()); } catch (ParcelableException e) { e.maybeRethrow(IOException.class); throw new RuntimeException(e); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Return {@link LeaseInfo} representing a lease acquired using * {@link #acquireLease(BlobHandle, int)} or one of it's other variants, * or {@code null} if there is no lease acquired. * * @throws SecurityException when the blob represented by the {@code blobHandle} does not * exist or the caller does not have access to it. * @throws IllegalArgumentException when {@code blobHandle} is invalid. * * @hide */ @TestApi @Nullable public LeaseInfo getLeaseInfo(@NonNull BlobHandle blobHandle) throws IOException { try { return mService.getLeaseInfo(blobHandle, mContext.getOpPackageName()); } catch (ParcelableException e) { e.maybeRethrow(IOException.class); throw new RuntimeException(e); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Represents an ongoing session of a blob's contribution to the blob store managed by the * system. Loading
apex/blobstore/framework/java/android/app/blob/IBlobStoreManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.app.blob; import android.app.blob.BlobHandle; import android.app.blob.BlobInfo; import android.app.blob.IBlobStoreSession; import android.app.blob.LeaseInfo; import android.os.RemoteCallback; /** {@hide} */ Loading @@ -35,4 +36,7 @@ interface IBlobStoreManager { List<BlobInfo> queryBlobsForUser(int userId); void deleteBlob(long blobId); List<BlobHandle> getLeasedBlobs(in String packageName); LeaseInfo getLeaseInfo(in BlobHandle blobHandle, in String packageName); } No newline at end of file
apex/blobstore/framework/java/android/app/blob/LeaseInfo.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.blob; /** {@hide} */ parcelable LeaseInfo; No newline at end of file