Apply fixes for EfficientCollections.

Drop-in replacements suggested for inefficient collections.  Also
annotate a handful of places where we're unable to update.

Bug: 155703208
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I48b600508df8160ac9b40fea7afca974b2c972f6
This commit is contained in:
Jeff Sharkey
2020-10-16 20:35:31 -06:00
parent a49ba3ac12
commit df8dc2b4a5
10 changed files with 53 additions and 40 deletions

View File

@@ -16,10 +16,11 @@
package android.util.proto;
import android.util.LongArray;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
/**
* Class to read to a protobuf stream.
@@ -98,7 +99,7 @@ public final class ProtoInputStream extends ProtoStream {
/**
* Keeps track of the currently read nested Objects, for end object checking and debug
*/
private ArrayList<Long> mExpectedObjectTokenStack = null;
private LongArray mExpectedObjectTokenStack = null;
/**
* Current nesting depth of start calls.
@@ -498,7 +499,7 @@ public final class ProtoInputStream extends ProtoStream {
int messageSize = (int) readVarint();
if (mExpectedObjectTokenStack == null) {
mExpectedObjectTokenStack = new ArrayList<>();
mExpectedObjectTokenStack = new LongArray();
}
if (++mDepth == mExpectedObjectTokenStack.size()) {
// Create a token to keep track of nested Object and extend the object stack