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

Commit 2b627724 authored by Ioannis Ilkos's avatar Ioannis Ilkos
Browse files

Add statically built regex pattern to avoid rebuilding all the time

Bug: b/129682219
Change-Id: I4a94c641d99964bed96ecb1725b84c8a9331879d
Test: Build, treehugger
parent 3cae8500
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.util.Log;

import java.util.HashMap;
import java.util.List;
import java.util.regex.Pattern;

/**
 * This class can be used to query the state of
@@ -48,6 +49,7 @@ import java.util.List;
 * on the device.
 */
public final class CardEmulation {
    private static final Pattern AID_PATTERN = Pattern.compile("[0-9A-Fa-f]{10,32}\\*?\\#?");
    static final String TAG = "CardEmulation";

    /**
@@ -732,7 +734,7 @@ public final class CardEmulation {
        }

        // Verify hex characters
        if (!aid.matches("[0-9A-Fa-f]{10,32}\\*?\\#?")) {
        if (!AID_PATTERN.matcher(aid).matches()) {
            Log.e(TAG, "AID " + aid + " is not a valid AID.");
            return false;
        }