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

Commit affd443b authored by Hemant Gupta's avatar Hemant Gupta Committed by Myles Watson
Browse files

MAP: Support only default telephony SMS TYPE

Precondition:
DUT supports CDMA network.

Usecase:
1) Connect to BMW 2232 Carkit from DUT.
2) Type message on carkit and press send

Expectation:
Carkit displays sending success

Observed Result:
Car kit does not show "sent successfully" notification after SMS was sent.

Root Cause:
Wrong message handle info encoded in pushMessage response for GSM even when DUT
can support only CDMA message type.

Fix:
Use proper encoding for message handle based on DUT supported message type in push
message response.

Test: Carkit can show success for message sent from carkit.

Bug: 35589951
Change-Id: I5e545ff4ab220654f3cabebca5a40e1be5e3745a
parent a254285c
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.Message;
import android.os.ParcelUuid;
import android.os.RemoteException;
import android.os.UserManager;
import android.telephony.TelephonyManager;
import android.text.format.DateUtils;
import android.util.Log;

@@ -676,6 +677,24 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
            // Decode the messageBody
            message = BluetoothMapbMessage.parse(bMsgStream, appParams.getCharset());
            message.setVersionString(messageVersion);
            if (D) {
                Log.d(TAG, "pushMessage: charset" + appParams.getCharset() + "folderId: "
                                + folderElement.getFolderId() + "Name: " + folderName + "TYPE: "
                                + message.getType());
            }
            if (message.getType().equals(TYPE.SMS_GSM) || message.getType().equals(TYPE.SMS_CDMA)) {
                // Convert messages to the default network type.
                TelephonyManager tm =
                        (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
                if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
                    message.setType(TYPE.SMS_GSM);
                } else if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
                    message.setType(TYPE.SMS_CDMA);
                }
                if (D) {
                    Log.d(TAG, "Updated message type: " + message.getType());
                }
            }
            // Send message
            if (mObserver == null || message == null) {
                // Should not happen except at shutdown.