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

Commit 87e76ac3 authored by Hemant Gupta's avatar Hemant Gupta Committed by android-build-merger
Browse files

Merge "PBAP: Handle '-' in TEL field properly when custom TAG is used." am: 36ef5953

am: e8c854d6

Change-Id: I66cb4188acf9f56235ff685a37e65da6690d106b
parents ea741e01 e8c854d6
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -970,10 +970,20 @@ public class BluetoothPbapVcardManager {
        String stripedVCard = "";
        for (int i = 0; i < attr.length; i++) {
            if (attr[i].startsWith("TEL")) {
                attr[i] = attr[i].replace("(", "");
                attr[i] = attr[i].replace(")", "");
                attr[i] = attr[i].replace("-", "");
                attr[i] = attr[i].replace(" ", "");
                String[] vTagAndTel = attr[i].split(":", 2);
                int telLenBefore = vTagAndTel[1].length();
                // Remove '-', '(', ')' or ' ' from TEL number
                vTagAndTel[1] = vTagAndTel[1].replace("-", "")
                                             .replace("(", "")
                                             .replace(")", "")
                                             .replace(" ", "");
                if (vTagAndTel[1].length() < telLenBefore) {
                    if (V) {
                        Log.v(TAG, "Fixing vCard TEL to " + vTagAndTel[1]);
                    }
                    attr[i] = new StringBuilder().append(vTagAndTel[0]).append(":")
                                                 .append(vTagAndTel[1]).toString();
                }
            }
        }