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

Commit bb45f48e authored by Kannu Mehta's avatar Kannu Mehta Committed by Smriti Gupta
Browse files

Bluedroid: Update PBAP Filter logic to avoid loss of fields.

In PBAP there are filters for unsupported fields. But the logic
to check these has issue. It checks for Attribute string holds
unsupported parameter, rather than begins with.  So if the
field data has pattern matching unsupported field, that complete
attribute are being removed. The current logic fixes the issue.

Change-Id: Iafcc2915a81e3847f7bfe435a3329b708980af6e
CRs-Fixed: 509165
parent 420ab1a5
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -964,7 +964,7 @@ public class BluetoothPbapVcardManager {
            //FN is not the mandatory field in 3.0 vacrd
            if(((!fn) && (vCardType21)) && (vCard.contains("FN"))) {
                for (int i=0; i < attr.length; i++) {
                    if(attr[i].contains("FN")){
                    if(attr[i].startsWith("FN")){
                        vCard = vCard.replace(attr[i] + "\n", "");
                    }
                }
@@ -973,7 +973,7 @@ public class BluetoothPbapVcardManager {
          //NOTE: No need to check photo, we already refrained it if it is not set in the filter
            if((!bday) && (vCard.contains("BDAY"))) {
                for (int i=0; i < attr.length; i++) {
                    if(attr[i].contains("BDAY")){
                    if(attr[i].startsWith("BDAY")){
                        vCard = vCard.replace(attr[i] + "\n", "");
                    }
                }
@@ -981,7 +981,7 @@ public class BluetoothPbapVcardManager {

            if((!adr) && (vCard.contains("ADR"))) {
                for (int i=0; i < attr.length; i++) {
                    if(attr[i].contains("ADR")){
                    if(attr[i].startsWith("ADR")){
                        vCard = vCard.replace(attr[i] + "\n", "");
                    }
                }
@@ -989,7 +989,7 @@ public class BluetoothPbapVcardManager {

            if((!email) && (vCard.contains("EMAIL"))) {
                for (int i=0; i < attr.length; i++) {
                    if(attr[i].contains("EMAIL")){
                    if(attr[i].startsWith("EMAIL")){
                        vCard = vCard.replace(attr[i] + "\n", "");
                    }
                }
@@ -997,7 +997,7 @@ public class BluetoothPbapVcardManager {

            if((!title) && (vCard.contains("TITLE"))) {
                for (int i=0; i < attr.length; i++) {
                    if(attr[i].contains("TITLE")){
                    if(attr[i].startsWith("TITLE")){
                        vCard = vCard.replace(attr[i] + "\n", "");
                    }
                }
@@ -1005,7 +1005,7 @@ public class BluetoothPbapVcardManager {

            if((!org) && (vCard.contains("ORG"))) {
                for (int i=0; i < attr.length; i++) {
                    if(attr[i].contains("ORG")){
                    if(attr[i].startsWith("ORG")){
                        vCard = vCard.replace(attr[i] + "\n", "");
                    }
                }
@@ -1013,7 +1013,7 @@ public class BluetoothPbapVcardManager {

            if((!notes) && (vCard.contains("NOTE"))) {
                for (int i=0; i < attr.length; i++) {
                    if(attr[i].contains("NOTE")){
                    if(attr[i].startsWith("NOTE")){
                        vCard = vCard.replace(attr[i] + "\n", "");
                    }
                }
@@ -1022,9 +1022,9 @@ public class BluetoothPbapVcardManager {
             *Android still ads it for 2.1 with nickname mentioned in lower case, and therefore
             *we need to check for both cases.
             */
            if(((!nickname) || (vCardType21)) && (vCard.toUpperCase().contains("NICKNAME"))) {
            if(((!nickname) || (vCardType21)) && (vCard.contains("NICKNAME"))) {
                for (int i=0; i < attr.length; i++) {
                    if(attr[i].toUpperCase().contains("NICKNAME")){
                    if(attr[i].startsWith("NICKNAME")){
                        vCard = vCard.replace(attr[i] + "\n", "");
                    }
                }
@@ -1032,7 +1032,7 @@ public class BluetoothPbapVcardManager {

            if((!url) && (vCard.contains("URL"))) {
                for (int i=0; i < attr.length; i++) {
                    if(attr[i].contains("URL")){
                    if(attr[i].startsWith("URL")){
                        vCard = vCard.replace(attr[i] + "\n", "");
                    }
                }