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

Commit d9d83fd9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use Concurrent Map instead to avoid ConcurrentModificationException...

Merge "Use Concurrent Map instead to avoid ConcurrentModificationException with mAutoTransactPatterns." into main
parents 54868b01 3e2defe1
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.regex.Pattern;

/**
@@ -138,7 +141,7 @@ public final class ApduServiceInfo implements Parcelable {

    private final Map<String, Boolean> mAutoTransact;

    private final Map<Pattern, Boolean> mAutoTransactPatterns;
    private final ConcurrentMap<Pattern, Boolean> mAutoTransactPatterns;

    /**
     * Whether this service should only be started when the device is unlocked.
@@ -251,7 +254,7 @@ public final class ApduServiceInfo implements Parcelable {
        this.mStaticAidGroups = new HashMap<String, AidGroup>();
        this.mDynamicAidGroups = new HashMap<String, AidGroup>();
        this.mAutoTransact = autoTransact;
        this.mAutoTransactPatterns = autoTransactPatterns;
        this.mAutoTransactPatterns = new ConcurrentHashMap<>(autoTransactPatterns);
        this.mOffHostName = offHost;
        this.mStaticOffHostName = staticOffHost;
        this.mOnHost = onHost;
@@ -383,8 +386,8 @@ public final class ApduServiceInfo implements Parcelable {
            mStaticAidGroups = new HashMap<String, AidGroup>();
            mDynamicAidGroups = new HashMap<String, AidGroup>();
            mAutoTransact = new HashMap<String, Boolean>();
            mAutoTransactPatterns = new TreeMap<Pattern, Boolean>(
                    Comparator.comparing(Pattern::toString));
            mAutoTransactPatterns =
                     new ConcurrentSkipListMap<>(Comparator.comparing(Pattern::toString));
            mOnHost = onHost;

            final int depth = parser.getDepth();