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

Commit 7737a357 authored by Steve Kondik's avatar Steve Kondik
Browse files

Merge branch 'jb_mr2' of git://codeaurora.org/platform/frameworks/opt/telephony into cm-10.2

Change-Id: I11128ff839f4940d4e19b23149620843f42a9cf5
parents 67c29620 1fc4b8e7
Loading
Loading
Loading
Loading
+158 −6
Original line number Diff line number Diff line
/*
 * Copyright (C) 2006 The Android Open Source Project
 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
 *
 * Not a Contribution.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -25,11 +28,14 @@ import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SqliteWrapper;
import android.net.Uri;
import android.telephony.MSimSmsManager;
import android.telephony.SmsMessage;
import android.text.TextUtils;
import android.telephony.Rlog;
import android.util.Patterns;

import com.android.internal.telephony.MSimConstants;

import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
@@ -161,6 +167,12 @@ public final class Telephony {
         */
        public static final String LOCKED = "locked";

        /**
         * The sub_id to which the message belongs to
         * <p>Type: INTEGER</p>
         */
        public static final String SUB_ID = "sub_id";

        /**
         * Error code associated with sending or receiving this message
         * <P>Type: INTEGER</P>
@@ -216,7 +228,29 @@ public final class Telephony {
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport) {
            return addMessageToUri(resolver, uri, address, body, subject,
                    date, read, deliveryReport, -1L);
                    date, read, deliveryReport, -1L,
                    MSimSmsManager.getDefault().getPreferredSmsSubscription());
        }

        /**
         * Add an SMS to the given URI.
         *
         * @param resolver the content resolver to use
         * @param uri the URI to add the message to
         * @param address the address of the sender
         * @param body the body of the message
         * @param subject the psuedo-subject of the message
         * @param date the timestamp for the message
         * @param read true if the message has been read, false if not
         * @param deliveryReport true if a delivery report was requested, false if not
         * @param subId the sub_id which the message belongs to
         * @return the URI for the new message
         */
        public static Uri addMessageToUri(ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport, int subId) {
            return addMessageToUri(resolver, uri, address, body, subject,
                    date, read, deliveryReport, -1L, subId);
        }

        /**
@@ -236,8 +270,33 @@ public final class Telephony {
        public static Uri addMessageToUri(ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport, long threadId) {
            ContentValues values = new ContentValues(7);
            return addMessageToUri(resolver, uri, address, body, subject,
                    date, read, deliveryReport, threadId,
                    MSimSmsManager.getDefault().getPreferredSmsSubscription());
        }

        /**
         * Add an SMS to the given URI with thread_id specified.
         *
         * @param resolver the content resolver to use
         * @param uri the URI to add the message to
         * @param address the address of the sender
         * @param body the body of the message
         * @param subject the psuedo-subject of the message
         * @param date the timestamp for the message
         * @param read true if the message has been read, false if not
         * @param deliveryReport true if a delivery report was requested, false if not
         * @param threadId the thread_id of the message
         * @param subId the sub_id which the message belongs to
         * @return the URI for the new message
         */
        public static Uri addMessageToUri(ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport, long threadId, int subId) {
            ContentValues values = new ContentValues(8);
            Rlog.v(TAG,"Telephony addMessageToUri sub id: " + subId);

            values.put(SUB_ID, subId);
            values.put(ADDRESS, address);
            if (date != null) {
                values.put(DATE, date);
@@ -341,7 +400,27 @@ public final class Telephony {
                    String address, String body, String subject, Long date,
                    boolean read) {
                return addMessageToUri(resolver, CONTENT_URI, address, body,
                        subject, date, read, false);
                        subject, date, read, false,
                        MSimSmsManager.getDefault().getPreferredSmsSubscription());
            }

            /**
             * Add an SMS to the Draft box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param read true if the message has been read, false if not
             * @param subId the sub_id which the message belongs to
             * @return the URI for the new message
             */
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date,
                    boolean read, int subId) {
                return addMessageToUri(resolver, CONTENT_URI, address, body,
                        subject, date, read, false, subId);
            }
        }

@@ -373,7 +452,25 @@ public final class Telephony {
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date) {
                return addMessageToUri(resolver, CONTENT_URI, address, body,
                        subject, date, true, false);
                        subject, date, true, false,
                        MSimSmsManager.getDefault().getPreferredSmsSubscription());
            }

            /**
             * Add an SMS to the Draft box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param subId the sub_id which the message belongs to
             * @return the URI for the new message
             */
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date, int subId) {
                return addMessageToUri(resolver, CONTENT_URI, address, body,
                        subject, date, true, false, subId);
            }
        }

@@ -405,7 +502,25 @@ public final class Telephony {
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date) {
                return addMessageToUri(resolver, CONTENT_URI, address, body,
                        subject, date, true, false);
                        subject, date, true, false,
                        MSimSmsManager.getDefault().getPreferredSmsSubscription());
            }

            /**
             * Add an SMS to the Draft box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param subId the sub_id which the message belongs to
             * @return the URI for the new message
             */
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date, int subId) {
                return addMessageToUri(resolver, CONTENT_URI, address, body,
                        subject, date, true, false, subId);
            }

            /**
@@ -454,8 +569,28 @@ public final class Telephony {
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date,
                    boolean deliveryReport, long threadId) {
                return addMessageToUri(resolver, CONTENT_URI, address, body, subject, date,
                        true, deliveryReport, threadId,
                        MSimSmsManager.getDefault().getPreferredSmsSubscription());
            }

            /**
             * Add an SMS to the Out box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param deliveryReport whether a delivery report was requested for the message
             * @param subId the sub_id which the message belongs to
             * @return the URI for the new message
             */
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date,
                    boolean deliveryReport, long threadId, int subId) {
                return addMessageToUri(resolver, CONTENT_URI, address, body,
                        subject, date, true, deliveryReport, threadId);
                        subject, date, true, deliveryReport, threadId, subId);
            }
        }

@@ -706,6 +841,9 @@ public final class Telephony {
                Object[] messages = (Object[]) intent.getSerializableExtra("pdus");
                String format = intent.getStringExtra("format");
                byte[][] pduObjs = new byte[messages.length][];
                int subId = intent.getIntExtra(MSimConstants.SUBSCRIPTION_KEY, 0);

                Rlog.v(TAG, " getMessagesFromIntent sub_id : " + subId);

                for (int i = 0; i < messages.length; i++) {
                    pduObjs[i] = (byte[]) messages[i];
@@ -716,6 +854,7 @@ public final class Telephony {
                for (int i = 0; i < pduCount; i++) {
                    pdus[i] = pduObjs[i];
                    msgs[i] = SmsMessage.createFromPdu(pdus[i], format);
                    msgs[i].setSubId(subId);
                }
                return msgs;
            }
@@ -1177,6 +1316,12 @@ public final class Telephony {
         */
        public static final String LOCKED = "locked";

        /**
         * The sub id to which message belongs to
         * <p>Type: INTEGER</p>
         */
        public static final String SUB_ID = "sub_id";

        /**
         * Meta data used externally.
         * <P>Type: TEXT</P>
@@ -1852,6 +1997,13 @@ public final class Telephony {
          * gid: 4E, 33, ...
          */
        public static final String MVNO_MATCH_DATA = "mvno_match_data";

        /**
         * Initial Preferred APN
         * true : initial preferred APN, false : not initial preferred APN.
         * Default is false.
         */
        public static final String PREFERRED = "preferred";
    }

    /**
+25 −0
Original line number Diff line number Diff line
@@ -49,6 +49,31 @@ public class CellBroadcastMessage implements Parcelable {
    private final long mDeliveryTime;
    private boolean mIsRead;

    /**
     * Indicates the subId
     *
     * @hide
     */
    private int mSubId = 0;

    /**
     * set Subscription information
     *
     * @hide
     */
    public void setSubId(int subId) {
        mSubId = subId;
    }

    /**
     * get Subscription information
     *
     * @hide
     */
    public int getSubId() {
        return mSubId;
    }

    public CellBroadcastMessage(SmsCbMessage message) {
        mSmsCbMessage = message;
        mDeliveryTime = System.currentTimeMillis();
Loading