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

Commit 7882e20d authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 6814

* changes:
  Change 107 and 146 from partner repo.
parents 9090ff79 daccacb8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ public abstract class ServiceStateTracker extends Handler {
    protected static final int EVENT_POLL_STATE_CDMA_SUBSCRIPTION      = 34;
    protected static final int EVENT_NV_READY                          = 35;
    protected static final int EVENT_ERI_FILE_LOADED                   = 36;
    protected static final int EVENT_OTA_PROVISION_STATUS_CHANGE       = 37;

    //***** Time Zones
    protected static final String TIMEZONE_PROPERTY = "persist.sys.timezone";
+18 −42
Original line number Diff line number Diff line
@@ -352,60 +352,36 @@ public abstract class SmsMessageBase {
    }

    /**
     * Try to parse this message as an email gateway message -> Neither
     * of the standard ways are currently supported: There are two ways
     * specified in TS 23.040 Section 3.8 (not supported via this mechanism) -
     * SMS message "may have its TP-PID set for internet electronic mail - MT
     * Try to parse this message as an email gateway message
     * There are two ways specified in TS 23.040 Section 3.8 :
     *  - SMS message "may have its TP-PID set for internet electronic mail - MT
     * SMS format: [<from-address><space>]<message> - "Depending on the
     * nature of the gateway, the destination/origination address is either
     * derived from the content of the SMS TP-OA or TP-DA field, or the
     * TP-OA/TP-DA field contains a generic gateway address and the to/from
     * address is added at the beginning as shown above." - multiple addreses
     * separated by commas, no spaces - subject field delimited by '()' or '##'
     * and '#' Section 9.2.3.24.11
     * address is added at the beginning as shown above." (which is supported here)
     * - Multiple addreses separated by commas, no spaces, Subject field delimited
     * by '()' or '##' and '#' Section 9.2.3.24.11 (which are NOT supported here)
     */
    protected void extractEmailAddressFromMessageBody() {

        /*
         * a little guesswork here. I haven't found doc for this.
         * the format could be either
        /* Some carriers may use " /" delimiter as below
         *
         * 1. [x@y][ ]/[subject][ ]/[body]
         * -or-
         * 2. [x@y][ ]/[body]
         */
        int slash = 0, slash2 = 0, atSymbol = 0;

        try {
            slash = messageBody.indexOf(" /");
            if (slash == -1) {
                return;
            }

            atSymbol = messageBody.indexOf('@');
            if (atSymbol == -1 || atSymbol > slash) {
                return;
            }

            emailFrom = messageBody.substring(0, slash);

            slash2 = messageBody.indexOf(" /", slash + 2);

            if (slash2 == -1) {
                pseudoSubject = null;
                emailBody = messageBody.substring(slash + 2);
         String[] parts = messageBody.split("( /)|( )", 3);
         if (parts.length < 2 || parts[0].indexOf('@') == -1) return;
         emailFrom = parts[0];
         if (parts.length == 3) {
             pseudoSubject = parts[1];
             emailBody = parts[2];
         } else {
                pseudoSubject = messageBody.substring(slash + 2, slash2);
                emailBody = messageBody.substring(slash2 + 2);
             pseudoSubject = null;
             emailBody = parts[1];
         }

         isEmail = true;
        } catch (Exception ex) {
            Log.w(LOG_TAG,
                    "extractEmailAddressFromMessageBody: exception slash="
                    + slash + ", atSymbol=" + atSymbol + ", slash2="
                    + slash2, ex);
        }
    }

}
+0 −20
Original line number Diff line number Diff line
@@ -191,24 +191,4 @@ public class TelephonyIntents {
    public static final String ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS
            = "android.intent.action.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS";

     /**
     * Broadcast Action: The MDN changed during the CDMA OTA Process
     * The intent will have the following extra values:</p>
     * <ul>
     *   <li><em>mdn</em> - An Integer of the updated MDN number.</li>
     * </ul>
     *
     * <p class="note">
     */
    // TODO(Moto): Generally broadcast intents are for use to allow entities which
    // may not know about each other to "communicate". This seems quite specific
    // and maybe using the registrant style would be better.

    // Moto: Since this is used for apps not in the same process of phone, can the
    // registrant style be used? (Ling Li says: Maybe the "app" can request rather
    // than save the MDN each time and this intent would not be necessary?)
    // Moto response: Moto internal discussion is on-going.
    public static final String ACTION_CDMA_OTA_MDN_CHANGED
            = "android.intent.action.ACTION_MDN_STATE_CHANGED";

}
+1 −1
Original line number Diff line number Diff line
@@ -392,7 +392,7 @@ public class CDMAPhone extends PhoneBase {
    }

    public String getCdmaPrlVersion(){
        return mRuimRecords.getPrlVersion();
        return mSST.getPrlVersion();
    }

    public String getCdmaMIN() {
+44 −20
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
    private int mHomeSystemId;
    private int mHomeNetworkId;
    private String mMin;
    private String mPrlVersion;

    private boolean isEriTextLoaded = false;
    private boolean isSubscriptionFromRuim = false;
@@ -178,6 +179,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {

        cm.registerForNVReady(this, EVENT_NV_READY, null);
        phone.registerForEriFileLoaded(this, EVENT_ERI_FILE_LOADED, null);
        cm.registerForCdmaOtaProvision(this,EVENT_OTA_PROVISION_STATUS_CHANGE, null);

        // system setting property AIRPLANE_MODE_ON is set in Settings.
        int airplaneMode = Settings.System.getInt(
@@ -201,6 +203,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
        cm.unregisterForNetworkStateChanged(this);
        cm.unregisterForRUIMReady(this);
        cm.unregisterForNVReady(this);
        cm.unregisterForCdmaOtaProvision(this);
        phone.unregisterForEriFileLoaded(this);
        phone.mRuimRecords.unregisterForRecordsLoaded(this);
        cm.unSetOnSignalStrengthUpdate(this);
@@ -302,6 +305,10 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {

        case EVENT_NV_READY:
            isSubscriptionFromRuim = false;
            // For Non-RUIM phones, the subscription information is stored in
            // Non Volatile. Here when Non-Volatile is ready, we can poll the CDMA
            // subscription info.
            cm.getCDMASubscription( obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
            pollState();
            // Signal strength polling stops when radio is off
            queueNextSignalStrengthPoll();
@@ -379,11 +386,29 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {

        case EVENT_POLL_STATE_REGISTRATION_CDMA:
        case EVENT_POLL_STATE_OPERATOR_CDMA:
        case EVENT_POLL_STATE_CDMA_SUBSCRIPTION:
            ar = (AsyncResult) msg.obj;
            handlePollStateResult(msg.what, ar);
            break;

        case EVENT_POLL_STATE_CDMA_SUBSCRIPTION: // Handle RIL_CDMA_SUBSCRIPTION
            ar = (AsyncResult) msg.obj;

            if (ar.exception == null) {
                String cdmaSubscription[] = (String[])ar.result;
                if (cdmaSubscription != null && cdmaSubscription.length >= 5) {
                    mMdn = cdmaSubscription[0];
                    mHomeSystemId = Integer.parseInt(cdmaSubscription[1], 16);
                    mHomeNetworkId = Integer.parseInt(cdmaSubscription[2], 16);
                    mMin = cdmaSubscription[3];
                    mPrlVersion = cdmaSubscription[4];
                    Log.d(LOG_TAG,"GET_CDMA_SUBSCRIPTION MDN=" + mMdn);
                } else {
                    Log.w(LOG_TAG,"error parsing cdmaSubscription params num="
                            + cdmaSubscription.length);
                }
            }
            break;

        case EVENT_POLL_SIGNAL_STRENGTH:
            // Just poll signal strength...not part of pollState()

@@ -430,6 +455,19 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
            pollState();
            break;

        case EVENT_OTA_PROVISION_STATUS_CHANGE:
            ar = (AsyncResult)msg.obj;
            if (ar.exception == null) {
                ints = (int[]) ar.result;
                int otaStatus = ints[0];
                if (otaStatus == phone.CDMA_OTA_PROVISION_STATUS_COMMITTED
                    || otaStatus == phone.CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED) {
                    Log.d(LOG_TAG, "Received OTA_PROGRAMMING Complete,Reload MDN ");
                    cm.getCDMASubscription( obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
                }
            }
            break;

        default:
            Log.e(LOG_TAG, "Unhandled message with number: " + msg.what);
        break;
@@ -663,20 +701,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
                }
                break;

            case EVENT_POLL_STATE_CDMA_SUBSCRIPTION: // Handle RIL_CDMA_SUBSCRIPTION
                String cdmaSubscription[] = (String[])ar.result;

                if (cdmaSubscription != null && cdmaSubscription.length >= 4) {
                    mMdn = cdmaSubscription[0];
                    mHomeSystemId = Integer.parseInt(cdmaSubscription[1], 16);
                    mHomeNetworkId = Integer.parseInt(cdmaSubscription[2], 16);
                    mMin = cdmaSubscription[3];

                } else {
                    Log.w(LOG_TAG, "error parsing cdmaSubscription");
                }
                break;

            default:
                Log.e(LOG_TAG, "RIL response handle in wrong phone!"
                    + " Expected CDMA RIL request and get GSM RIL request.");
@@ -792,11 +816,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
            // then count down the responses, which
            // are allowed to arrive out-of-order

            pollingContext[0]++;
            // RIL_REQUEST_CDMA_SUBSCRIPTION is necessary for CDMA
            cm.getCDMASubscription(
                    obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION, pollingContext));

            pollingContext[0]++;
            // RIL_REQUEST_OPERATOR is necessary for CDMA
            cm.getOperator(
@@ -1467,4 +1486,9 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
         return mMin;
    }

    /** Returns null if NV is not yet ready */
    public String getPrlVersion() {
        return mPrlVersion;
    }

}
Loading