diff options
| author | 2020-07-06 22:23:48 +0000 | |
|---|---|---|
| committer | 2020-07-14 23:00:57 +0000 | |
| commit | 3d655ad09e861ee7b2f17c79270744a4e513f03b (patch) | |
| tree | 23d7a122edb75fc29391a045974ad1d1bd812e63 /apex/blobstore | |
| parent | 978d360e7b4b40a2b455c8afee5a3451ffae848c (diff) | |
Replace manual creation of StatsEvent objects with their appropriate buildStatsEvent() method
Currently, Java clients are manually creating the StatsEvent objects
which can lead to errors. Now that there is support for pulled atoms for
stats-log-api-gen for Java clients, use the appropriate buildStatsEvent
method that was auto generated by stats-log-api-gen.
Bug: 160368804
Test: Ran `m` and completed successfully
Test: Ran `atest statsd_test` and all CTS tests passed
Test: Ran `atest UidAtomTests` and all CTS tests passed except for the CTS tests related to a SIM card because the device does not have a SIM card
Change-Id: Id229ba5ca94203135a8a5e2607de9844e0432ce1
Diffstat (limited to 'apex/blobstore')
| -rw-r--r-- | apex/blobstore/service/java/com/android/server/blob/BlobMetadata.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/apex/blobstore/service/java/com/android/server/blob/BlobMetadata.java b/apex/blobstore/service/java/com/android/server/blob/BlobMetadata.java index 0b760a621d22..9850b5d254d8 100644 --- a/apex/blobstore/service/java/com/android/server/blob/BlobMetadata.java +++ b/apex/blobstore/service/java/com/android/server/blob/BlobMetadata.java @@ -61,6 +61,7 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.util.FrameworkStatsLog; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.XmlUtils; import com.android.server.blob.BlobStoreManagerService.DumpArgs; @@ -496,14 +497,8 @@ class BlobMetadata { final byte[] leaseesBytes = proto.getBytes(); // Construct the StatsEvent to represent this Blob - return StatsEvent.newBuilder() - .setAtomId(atomTag) - .writeLong(mBlobId) - .writeLong(getSize()) - .writeLong(mBlobHandle.getExpiryTimeMillis()) - .writeByteArray(committersBytes) - .writeByteArray(leaseesBytes) - .build(); + return FrameworkStatsLog.buildStatsEvent(atomTag, mBlobId, getSize(), + mBlobHandle.getExpiryTimeMillis(), committersBytes, leaseesBytes); } } |