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

Commit 9560590d authored by sandeepjs's avatar sandeepjs
Browse files

Adding compareIgnoreTrailingFs helper method to compare IccId's

Test: build, manual
Bug: 213434330
Change-Id: I20c37c4178c269b71864220852ba067ff70191ba
parent 2cebd2b9
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Build;
import android.telephony.UiccPortInfo;
import android.text.TextUtils;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.GsmAlphabet;
@@ -933,6 +934,13 @@ public class IccUtils {
        return s == null ? null : s.replaceAll("(?i)f*$", "");
    }

    /**
     * Strip all the trailing 'F' characters of a string if exists and compare.
     */
    public static boolean compareIgnoreTrailingFs(String a, String b) {
        return TextUtils.equals(a, b) || TextUtils.equals(stripTrailingFs(a), stripTrailingFs(b));
    }

    /**
     * Converts a character of [0-9a-fA-F] to its hex value in a byte. If the character is not a
     * hex number, 0 will be returned.