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

Commit 9e26d63c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "MAP: use getSystemService to get TelephonyManager"

parents 366d14c2 6a681cdf
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -3709,9 +3709,10 @@ public class BluetoothMapContent {
                if (charset == MAP_MESSAGE_CHARSET_NATIVE) {
                    if (type == 1) { //Inbox
                        message.setSmsBodyPdus(
                                BluetoothMapSmsPdu.getDeliverPdus(msgBody, phone, time));
                                BluetoothMapSmsPdu.getDeliverPdus(mContext, msgBody, phone, time));
                    } else {
                        message.setSmsBodyPdus(BluetoothMapSmsPdu.getSubmitPdus(msgBody, phone));
                        message.setSmsBodyPdus(
                                BluetoothMapSmsPdu.getSubmitPdus(mContext, msgBody, phone));
                    }
                } else /*if (charset == MAP_MESSAGE_CHARSET_UTF8)*/ {
                    message.setSmsBody(msgBody);
+8 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ package com.android.bluetooth.map;

import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA;

import android.content.Context;
import android.telephony.PhoneNumberUtils;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
@@ -503,14 +504,14 @@ public class BluetoothMapSmsPdu {
        return sConcatenatedRef;
    }

    public static ArrayList<SmsPdu> getSubmitPdus(String messageText, String address) {
    public static ArrayList<SmsPdu> getSubmitPdus(Context context, String messageText,
            String address) {
        /* Use the generic GSM/CDMA SMS Message functionality within Android to generate the
         * SMS PDU's as once generated to send the SMS message.
         */

        int activePhone = TelephonyManager.getDefault()
                .getCurrentPhoneType(); // TODO: Change to use: ((TelephonyManager)myContext
        // .getSystemService(Context.TELEPHONY_SERVICE))
        int activePhone = context.getSystemService(TelephonyManager.class)
                .getCurrentPhoneType();
        int phoneType;
        GsmAlphabet.TextEncodingDetails ted = (PHONE_TYPE_CDMA == activePhone)
                ? com.android.internal.telephony.cdma.SmsMessage.calculateLength(
@@ -609,8 +610,9 @@ public class BluetoothMapSmsPdu {
     * @param date The delivery time stamp.
     * @return
     */
    public static ArrayList<SmsPdu> getDeliverPdus(String messageText, String address, long date) {
        ArrayList<SmsPdu> deliverPdus = getSubmitPdus(messageText, address);
    public static ArrayList<SmsPdu> getDeliverPdus(Context context, String messageText,
            String address, long date) {
        ArrayList<SmsPdu> deliverPdus = getSubmitPdus(context, messageText, address);

        /*
         * For CDMA the only difference between deliver and submit pdus are the messageType,