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

Commit 1dab51cb authored by Matt Garnes's avatar Matt Garnes
Browse files

Merge remote-tracking branch 'caf/LA.BR.1.2.3_1' into caf/cm-12.1

Conflicts:
	src/java/com/android/internal/telephony/InboundSmsHandler.java
	src/java/com/android/internal/telephony/ModemBindingPolicyHandler.java
	src/java/com/android/internal/telephony/PhoneBase.java
	src/java/com/android/internal/telephony/PhoneFactory.java
	src/java/com/android/internal/telephony/SubInfoRecordUpdater.java
	src/java/com/android/internal/telephony/SubscriptionController.java
	src/java/com/android/internal/telephony/cdma/CDMAPhone.java
	src/java/com/android/internal/telephony/gsm/GSMPhone.java
	src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
	src/java/com/android/internal/telephony/util/BlacklistUtils.java

Change-Id: Ic9b874cabde215c296eca27238f1aa041bde32cc
parents 6b3fd951 ce06c062
Loading
Loading
Loading
Loading
+88 −21
Original line number Diff line number Diff line
@@ -240,12 +240,22 @@ public final class Telephony {
        public static final String LOCKED = "locked";

        /**
         * The phone id to which the message belongs to
         * The subscription to which the message belongs to. Its value will be
         * < 0 if the sub id cannot be determined.
         * <p>Type: INTEGER (long) </p>
         */
        public static final String SUBSCRIPTION_ID = "sub_id";

        /**
         * The phoneId to which the message belongs to. Its value will be
         * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} if
         * the sub id cannot be determined.
         * <p>Type: INTEGER (long)</p>
         * @hide
         */
        public static final String PHONE_ID = "phone_id";
         // FIXME LMR1_INTERNAL

        public static final String PHONE_ID = "phone_id";
        /**
         * The MTU size of the mobile interface to which the APN connected
         * @hide
@@ -261,6 +271,8 @@ public final class Telephony {
        /**
         * The identity of the sender of a sent message. It is
         * usually the package name of the app which sends the message.
         * <p class="note"><strong>Note:</strong>
         * This column is read-only. It is set by the provider and can not be changed by apps.
         * <p>Type: TEXT</p>
         */
        public static final String CREATOR = "creator";
@@ -358,11 +370,11 @@ public final class Telephony {
         * @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
         * @param subId the subscription which the message belongs to
         * @return the URI for the new message
         * @hide
         */
        public static Uri addMessageToUri(long subId, ContentResolver resolver,
        public static Uri addMessageToUri(int subId, ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport) {
            return addMessageToUri(subId, resolver, uri, address, body, subject,
@@ -404,11 +416,11 @@ public final class Telephony {
         * @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
         * @param subId the subscription which the message belongs to
         * @return the URI for the new message
         * @hide
         */
        public static Uri addMessageToUri(long subId, ContentResolver resolver,
        public static Uri addMessageToUri(int subId, ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport, long threadId) {
            return addMessageToUri(subId, resolver, uri, address, body, subject,
@@ -432,7 +444,7 @@ public final class Telephony {
         * @return the URI for the new message
         * @hide
         */
        public static Uri addMessageToUri(long subId, ContentResolver resolver,
        public static Uri addMessageToUri(int subId, ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport, long threadId,
                int priority) {
@@ -567,11 +579,11 @@ public final class Telephony {
             * @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
             * @param subId the subscription which the message belongs to
             * @return the URI for the new message
             * @hide
             */
            public static Uri addMessage(long subId, ContentResolver resolver,
            public static Uri addMessage(int subId, ContentResolver resolver,
                    String address, String body, String subject, Long date, boolean read) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
                        subject, date, read, false);
@@ -625,11 +637,11 @@ public final class Telephony {
             * @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
             * @param subId the subscription which the message belongs to
             * @return the URI for the new message
             * @hide
             */
            public static Uri addMessage(long subId, ContentResolver resolver,
            public static Uri addMessage(int subId, ContentResolver resolver,
                    String address, String body, String subject, Long date) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
                        subject, date, true, false);
@@ -670,11 +682,11 @@ public final class Telephony {
             * @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
             * @param subId the subscription which the message belongs to
             * @return the URI for the new message
             * @hide
             */
            public static Uri addMessage(long subId, ContentResolver resolver,
            public static Uri addMessage(int subId, ContentResolver resolver,
                    String address, String body, String subject, Long date) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
                        subject, date, true, false);
@@ -737,11 +749,11 @@ public final class Telephony {
             * @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
             * @param subId the subscription which the message belongs to
             * @return the URI for the new message
             * @hide
             */
            public static Uri addMessage(long subId, ContentResolver resolver,
            public static Uri addMessage(int subId, ContentResolver resolver,
                    String address, String body, String subject, Long date,
                    boolean deliveryReport, long threadId) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
@@ -876,6 +888,16 @@ public final class Telephony {
             * <ul>
             *   <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
             *   that make up the message.</li>
             *   <li><em>"format"</em> - A String describing the format of the PDUs. It can
             *   be either "3gpp" or "3gpp2".</li>
             *   <li><em>"subscription"</em> - An optional long value of the subscription id which
             *   received the message.</li>
             *   <li><em>"slot"</em> - An optional int value of the SIM slot containing the
             *   subscription.</li>
             *   <li><em>"phone"</em> - An optional int value of the phone id associated with the
             *   subscription.</li>
             *   <li><em>"errorCode"</em> - An optional int error code associated with receiving
             *   the message.</li>
             * </ul>
             *
             * <p>The extra values can be extracted using
@@ -984,6 +1006,12 @@ public final class Telephony {
             *   <li><em>"contentTypeParameters" </em>
             *   -(HashMap&lt;String,String&gt;) Any parameters associated with the content type
             *   (decoded from the WSP Content-Type header)</li>
             *   <li><em>"subscription"</em> - An optional long value of the subscription id which
             *   received the message.</li>
             *   <li><em>"slot"</em> - An optional int value of the SIM slot containing the
             *   subscription.</li>
             *   <li><em>"phone"</em> - An optional int value of the phone id associated with the
             *   subscription.</li>
             * </ul>
             *
             * <p>If a BroadcastReceiver encounters an error while processing
@@ -1121,6 +1149,16 @@ public final class Telephony {
            public static final String SMS_REJECTED_ACTION =
                "android.provider.Telephony.SMS_REJECTED";

            /**
             * Broadcast Action: An incoming MMS has been downloaded. The intent is sent to all
             * users, except for secondary users where SMS has been disabled and to managed
             * profiles.
             * @hide
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String MMS_DOWNLOADED_ACTION =
                "android.provider.Telephony.MMS_DOWNLOADED";

            /**
             * Broadcast Action: A new SMS PDU needs to be sent from
             * the device. This intent will only be delivered to a
@@ -1173,7 +1211,7 @@ public final class Telephony {
            public static SmsMessage[] getMessagesFromIntent(Intent intent) {
                Object[] messages = (Object[]) intent.getSerializableExtra("pdus");
                String format = intent.getStringExtra("format");
                long subId = intent.getLongExtra(PhoneConstants.SUBSCRIPTION_KEY,
                int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
                        SubscriptionManager.getDefaultSmsSubId());

                Rlog.v(TAG, " getMessagesFromIntent sub_id : " + subId);
@@ -1746,15 +1784,28 @@ public final class Telephony {
        public static final String LOCKED = "locked";

        /**
         * The phone id to which message belongs to
         * <p>Type: INTEGER</p>
         * The subscription to which the message belongs to. Its value will be
         * < 0 if the sub id cannot be determined.
         * <p>Type: INTEGER (long)</p>
         */
        public static final String SUBSCRIPTION_ID = "sub_id";


        /**
         * The phoneId to which the message belongs to. Its value will be
         * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} if
         * the sub id cannot be determined.
         * <p>Type: INTEGER (long)</p>
         * @hide
         */
         // FIXME LMR1_INTERNAL
        public static final String PHONE_ID = "phone_id";

        /**
         * The identity of the sender of a sent message. It is
         * usually the package name of the app which sends the message.
         * <p class="note"><strong>Note:</strong>
         * This column is read-only. It is set by the provider and can not be changed by apps.
         * <p>Type: TEXT</p>
         */
        public static final String CREATOR = "creator";
@@ -1935,7 +1986,7 @@ public final class Telephony {
                }
            }

            Rlog.e(TAG, "getOrCreateThreadId failed with uri " + uri.toString());
            Rlog.e(TAG, "getOrCreateThreadId failed with " + recipients.size() + " recipients");
            throw new IllegalArgumentException("Unable to find or allocate a thread ID.");
        }
    }
@@ -2593,12 +2644,19 @@ public final class Telephony {
             */
            public static final String LAST_TRY = "last_try";

            /**
             * The subscription to which the message belongs to. Its value will be
             * < 0 if the sub id cannot be determined.
             * <p>Type: INTEGER (long) </p>
             */
            public static final String SUBSCRIPTION_ID = "pending_sub_id";
            /**
             * The phone id to which the pending message belongs to
             * <p>Type: INTEGER (long) </p>
             * @hide
             */
            public static final String PHONE_ID = "pending_phone_id";

        }

        /**
@@ -2807,11 +2865,20 @@ public final class Telephony {
        public static final String MVNO_MATCH_DATA = "mvno_match_data";

        /**
         * The sub_id to which the APN belongs to
         * The subscription to which the APN belongs to
         * <p>Type: INTEGER (long) </p>
         */
        public static final String SUBSCRIPTION_ID = "sub_id";

        /**
         * The phoneId to which the message belongs to. Its value will be
         * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} if
         * the sub id cannot be determined.
         * <p>Type: INTEGER (long)</p>
         * @hide
         */
        public static final String SUB_ID = "sub_id";
         // FIXME LMR1_INTERNAL
        public static final String PHONE_ID = "phone_id";

        /**
         * The profile_id to which the APN saved in modem
+99 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.service.carrier.CarrierMessagingService;
import android.service.carrier.ICarrierMessagingService;

import com.android.internal.util.Preconditions;

/**
 * Provides basic structure for platform to connect to the carrier messaging service.
 * <p>
 * <code>
 * CarrierMessagingServiceManager carrierMessagingServiceManager =
 *     new CarrierMessagingServiceManagerImpl();
 * if (carrierMessagingServiceManager.bindToCarrierMessagingService(context, carrierPackageName)) {
 *   // wait for onServiceReady callback
 * } else {
 *   // Unable to bind: handle error.
 * }
 * </code>
 * <p> Upon completion {@link #disposeConnection} should be called to unbind the
 * CarrierMessagingService.
 * @hide
 */
public abstract class CarrierMessagingServiceManager {
    // Populated by bindToCarrierMessagingService. bindToCarrierMessagingService must complete
    // prior to calling disposeConnection so that mCarrierMessagingServiceConnection is initialized.
    private volatile CarrierMessagingServiceConnection mCarrierMessagingServiceConnection;

    /**
     * Binds to the carrier messaging service under package {@code carrierPackageName}. This method
     * should be called exactly once.
     *
     * @param context the context
     * @param carrierPackageName the carrier package name
     * @return true upon successfully binding to a carrier messaging service, false otherwise
     */
    public boolean bindToCarrierMessagingService(Context context, String carrierPackageName) {
        Preconditions.checkState(mCarrierMessagingServiceConnection == null);

        Intent intent = new Intent(CarrierMessagingService.SERVICE_INTERFACE);
        intent.setPackage(carrierPackageName);
        mCarrierMessagingServiceConnection = new CarrierMessagingServiceConnection();
        return context.bindService(intent, mCarrierMessagingServiceConnection,
                Context.BIND_AUTO_CREATE);
    }

    /**
     * Unbinds the carrier messaging service. This method should be called exactly once.
     *
     * @param context the context
     */
    public void disposeConnection(Context context) {
        Preconditions.checkNotNull(mCarrierMessagingServiceConnection);
        context.unbindService(mCarrierMessagingServiceConnection);
        mCarrierMessagingServiceConnection = null;
    }

    /**
     * Implemented by subclasses to use the carrier messaging service once it is ready.
     *
     * @param carrierMessagingService the carrier messaing service interface
     */
    protected abstract void onServiceReady(ICarrierMessagingService carrierMessagingService);

    /**
     * A basic {@link ServiceConnection}.
     */
    private final class CarrierMessagingServiceConnection implements ServiceConnection {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            onServiceReady(ICarrierMessagingService.Stub.asInterface(service));
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
        }
    }
}
+5 −5
Original line number Diff line number Diff line
@@ -55,14 +55,14 @@ public class CellBroadcastMessage implements Parcelable {
     *
     * @hide
     */
    private long mSubId;
    private int mSubId = 0;

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

@@ -71,7 +71,7 @@ public class CellBroadcastMessage implements Parcelable {
     *
     * @hide
     */
    public long getSubId() {
    public int getSubId() {
        return mSubId;
    }

@@ -93,7 +93,7 @@ public class CellBroadcastMessage implements Parcelable {
        mSmsCbMessage = new SmsCbMessage(in);
        mDeliveryTime = in.readLong();
        mIsRead = (in.readInt() != 0);
        mSubId = in.readLong();
        mSubId = in.readInt();
    }

    /** Parcelable: no special flags. */
@@ -107,7 +107,7 @@ public class CellBroadcastMessage implements Parcelable {
        mSmsCbMessage.writeToParcel(out, flags);
        out.writeLong(mDeliveryTime);
        out.writeInt(mIsRead ? 1 : 0);
        out.writeLong(mSubId);
        out.writeInt(mSubId);
    }

    public static final Parcelable.Creator<CellBroadcastMessage> CREATOR
+199 −207

File changed.

Preview size limit exceeded, changes collapsed.

+28 −14
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@

package android.telephony;

import android.os.Binder;
import android.os.Parcel;
import android.telephony.Rlog;
import android.content.res.Resources;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
@@ -104,13 +104,13 @@ public class SmsMessage {
     *
     * @hide
     */
    private long mSubId = 0;
    private int mSubId = 0;

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

@@ -118,7 +118,7 @@ public class SmsMessage {
     *
     * @hide
     */
    public long getSubId() {
    public int getSubId() {
        return mSubId;
    }

@@ -266,7 +266,7 @@ public class SmsMessage {
     *
     * @hide
     */
    public static SmsMessage createFromEfRecord(int index, byte[] data, long subId) {
    public static SmsMessage createFromEfRecord(int index, byte[] data, int subId) {
        SmsMessageBase wrappedMessage;

        if (isCdmaVoice(subId)) {
@@ -502,7 +502,7 @@ public class SmsMessage {
     * @hide
     */
    public static SubmitPdu getSubmitPdu(String scAddress,
            String destinationAddress, String message, boolean statusReportRequested, long subId) {
            String destinationAddress, String message, boolean statusReportRequested, int subId) {
        SubmitPduBase spb;
        if (useCdmaFormatForMoSms(subId)) {
            spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
@@ -797,7 +797,7 @@ public class SmsMessage {
     * @return true if Cdma format should be used for MO SMS, false otherwise.
     */
    private static boolean useCdmaFormatForMoSms() {
        SmsManager smsManager = SmsManager.getSmsManagerForSubscriber(
        SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(
                SubscriptionManager.getDefaultSmsSubId());
        if (!smsManager.isImsSmsSupported()) {
            // use Voice technology to determine SMS format.
@@ -816,8 +816,8 @@ public class SmsMessage {
     *
     * @return true if Cdma format should be used for MO SMS, false otherwise.
     */
    private static boolean useCdmaFormatForMoSms(long subId) {
        SmsManager smsManager = SmsManager.getSmsManagerForSubscriber(subId);
    private static boolean useCdmaFormatForMoSms(int subId) {
        SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(subId);
        if (!smsManager.isImsSmsSupported()) {
            // use Voice technology to determine SMS format.
            return isCdmaVoice(subId);
@@ -842,7 +842,7 @@ public class SmsMessage {
     * @param subId Subscription Id of the SMS
     * @return true if current phone type is cdma, false otherwise.
     */
    private static boolean isCdmaVoice(long subId) {
    private static boolean isCdmaVoice(int subId) {
        int activePhone = TelephonyManager.getDefault().getCurrentPhoneType(subId);
        return (PHONE_TYPE_CDMA == activePhone);
    }
@@ -856,8 +856,15 @@ public class SmsMessage {
            return true;
        }

        String simOperator = TelephonyManager.getDefault().getSimOperator();
        String gid = TelephonyManager.getDefault().getGroupIdLevel1();
        String simOperator;
        String gid;
        final long identity = Binder.clearCallingIdentity();
        try {
            simOperator = TelephonyManager.getDefault().getSimOperator();
            gid = TelephonyManager.getDefault().getGroupIdLevel1();
        } finally {
            Binder.restoreCallingIdentity(identity);
        }

        for (NoEmsSupportConfig currentConfig : mNoEmsSupportConfigList) {
            if (simOperator.startsWith(currentConfig.mOperatorNumber) &&
@@ -879,8 +886,15 @@ public class SmsMessage {
            return false;
        }

        String simOperator = TelephonyManager.getDefault().getSimOperator();
        String gid = TelephonyManager.getDefault().getGroupIdLevel1();
        String simOperator;
        String gid;
        final long identity = Binder.clearCallingIdentity();
        try {
            simOperator = TelephonyManager.getDefault().getSimOperator();
            gid = TelephonyManager.getDefault().getGroupIdLevel1();
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
        for (NoEmsSupportConfig currentConfig : mNoEmsSupportConfigList) {
            if (simOperator.startsWith(currentConfig.mOperatorNumber) &&
                (TextUtils.isEmpty(currentConfig.mGid1) ||
Loading