Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93ca67e7 authored by Nikolas Havrikov's avatar Nikolas Havrikov Committed by Android (Google) Code Review
Browse files

Merge "Replace LinkedList by a more performant collection"

parents bb8f7f2f f194d4a9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@ import com.android.internal.util.TraceBuffer;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.function.Consumer;

@@ -50,7 +50,7 @@ public class FrameProtoTracer<P, S extends P, T extends P, R>
    private final File mTraceFile;
    private final ProtoTraceParams<P, S, T, R> mParams;
    private Choreographer mChoreographer;
    private final Queue<T> mPool = new LinkedList<>();
    private final Queue<T> mPool = new ArrayDeque<>();
    private final ArrayList<ProtoTraceable<R>> mTraceables = new ArrayList<>();
    private final ArrayList<ProtoTraceable<R>> mTmpTraceables = new ArrayList<>();

+4 −4
Original line number Diff line number Diff line
@@ -18,9 +18,9 @@ package com.android.systemui.classifier;

import android.view.MotionEvent;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;

@@ -33,13 +33,13 @@ import java.util.ListIterator;
 */
public class TimeLimitedMotionEventBuffer implements List<MotionEvent> {

    private final LinkedList<MotionEvent> mMotionEvents;
    private final List<MotionEvent> mMotionEvents;
    private final long mMaxAgeMs;

    public TimeLimitedMotionEventBuffer(long maxAgeMs) {
        super();
        mMaxAgeMs = maxAgeMs;
        mMotionEvents = new LinkedList<>();
        mMotionEvents = new ArrayList<>();
    }

    private void ejectOldEvents() {
@@ -47,7 +47,7 @@ public class TimeLimitedMotionEventBuffer implements List<MotionEvent> {
            return;
        }
        Iterator<MotionEvent> iter = listIterator();
        long mostRecentMs = mMotionEvents.getLast().getEventTime();
        long mostRecentMs = mMotionEvents.get(mMotionEvents.size() - 1).getEventTime();
        while (iter.hasNext()) {
            MotionEvent ev = iter.next();
            if (mostRecentMs - ev.getEventTime() > mMaxAgeMs) {
+2 −2
Original line number Diff line number Diff line
@@ -35,8 +35,8 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

@@ -72,7 +72,7 @@ public class KeyguardIndicationRotateTextViewController extends
    @Nullable private ShowNextIndication mShowNextIndicationRunnable;

    // List of indication types to show. The next indication to show is always at index 0
    private final List<Integer> mIndicationQueue = new LinkedList<>();
    private final List<Integer> mIndicationQueue = new ArrayList<>();
    private @IndicationType int mCurrIndicationType = INDICATION_TYPE_NONE;
    private CharSequence mCurrMessage;
    private long mLastIndicationSwitch;
+1 −2
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import javax.inject.Inject;
@@ -126,7 +125,7 @@ public class TvOngoingPrivacyChip extends CoreStartable implements PrivacyItemCo
    private final Runnable mCollapseRunnable = this::collapseChip;

    private final Runnable mAccessibilityRunnable = this::makeAccessibilityAnnouncement;
    private final List<PrivacyItem> mItemsBeforeLastAnnouncement = new LinkedList<>();
    private final List<PrivacyItem> mItemsBeforeLastAnnouncement = new ArrayList<>();

    @State
    private int mState = STATE_NOT_SHOWN;