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

Commit 49f61d6d authored by Xin Li's avatar Xin Li
Browse files

Merge Android Pie into master

Bug: 112104996
Change-Id: I227b4104792d4235c04a9832f307badb8de492f8
parents 1319e5b0 deb11df6
Loading
Loading
Loading
Loading
+120 −4
Original line number Diff line number Diff line
@@ -476,6 +476,96 @@ enum RilErrno {

  // LCE service not supported
  RIL_E_LCE_NOT_SUPPORTED_NEW = 37;

  // Not sufficient memory to process the request
  RIL_E_NO_MEMORY = 38;

  // Modem hit unexpected error scenario while handling this request
  RIL_E_INTERNAL_ERR = 39;

  // Hit platform or system error
  RIL_E_SYSTEM_ERR = 40;

  // Vendor RIL got unexpected or incorrect response from modem for this request
  RIL_E_MODEM_ERR = 41;

  // Unexpected request for the current state
  RIL_E_INVALID_STATE = 42;

  // Not sufficient resource to process the request
  RIL_E_NO_RESOURCES = 43;

  // Received error from SIM card
  RIL_E_SIM_ERR = 44;

  // Received invalid arguments in request
  RIL_E_INVALID_ARGUMENTS = 45;

  // Cannot process the request in current SIM state
  RIL_E_INVALID_SIM_STATE = 46;

  // Cannot process the request in current Modem state
  RIL_E_INVALID_MODEM_STATE = 47;

  // Received invalid call id in request
  RIL_E_INVALID_CALL_ID = 48;

  // ACK received when there is no SMS to ack
  RIL_E_NO_SMS_TO_ACK = 49;

  // Received error from network
  RIL_E_NETWORK_ERR = 50;

  // Operation denied due to overly-frequent requests
  RIL_E_REQUEST_RATE_LIMITED = 51;

  // SIM is busy
  RIL_E_SIM_BUSY = 52;

  // The target EF is full
  RIL_E_SIM_FULL = 53;

  // Request is rejected by network
  RIL_E_NETWORK_REJECT = 54;

  // Not allowed the request now
  RIL_E_OPERATION_NOT_ALLOWED = 55;

  // The request record is empty
  RIL_E_EMPTY_RECORD = 56;

  // Invalid sms format
  RIL_E_INVALID_SMS_FORMAT = 57;

  // Message not encoded properly
  RIL_E_ENCODING_ERR = 58;

  // SMSC address specified is invalid
  RIL_E_INVALID_SMSC_ADDRESS = 59;

  // No such entry present to perform the request
  RIL_E_NO_SUCH_ENTRY = 60;

  // Network is not ready to perform the request
  RIL_E_NETWORK_NOT_READY = 61;

  // Device does not have this value provisioned
  RIL_E_NOT_PROVISIONED = 62;

  // Device does not have subscription
  RIL_E_NO_SUBSCRIPTION = 63;

  // Network cannot be found
  RIL_E_NO_NETWORK_FOUND = 64;

  // Operation cannot be performed because the device is currently in use
  RIL_E_DEVICE_IN_USE = 65;

  // Operation aborted
  RIL_E_ABORTED = 66;

  // Invalid response sent by vendor code
  RIL_E_INVALID_RESPONSE = 67;
}

// PDP_type values in TS 27.007 section 10.1.1.
@@ -553,6 +643,9 @@ message TelephonyEvent {

    // Carrier Identification Matching Event
    CARRIER_ID_MATCHING = 13;

    // Carrier Key Change event.
    CARRIER_KEY_CHANGED = 14;
  }

  // Setup a packet data connection
@@ -743,6 +836,26 @@ message TelephonyEvent {
    optional RilDataCall call = 3;
  }

  // Carrier Key Change Event.
  message CarrierKeyChange {

    enum KeyType {

      // Key Type Unknown.
      UNKNOWN = 0;
      // Key Type for WLAN.
      WLAN = 1;
      // Key Type for EPDG.
      EPDG = 2;
    }

    // Key type of the Encryption key.
    optional KeyType key_type = 1;

    // Whether the download was successful or not.
    optional bool isDownloadSuccessful = 2;
  }

  // Deactivate packet data connection
  message RilDeactivateDataCall {

@@ -850,6 +963,9 @@ message TelephonyEvent {

  // Carrier id matching event
  optional CarrierIdMatching carrier_id_matching = 16;

  // Carrier key change
  optional CarrierKeyChange carrier_key_change = 17;
}

enum TimeInterval {
@@ -1229,16 +1345,16 @@ message SmsSession {

    message CBMessage {
      // CB message format
      optional Format msgFormat = 1;
      optional Format msg_format = 1;

      // CB message priority
      optional CBPriority msgPriority = 2;
      optional CBPriority msg_priority = 2;

      // Type of CB msg
      optional CBMessageType msgType = 3;
      optional CBMessageType msg_type = 3;

      // Service category of CB message
      optional int32 serviceCategory = 4;
      optional int32 service_category = 4;
    }

    enum CBMessageType {
+2 −0
Original line number Diff line number Diff line
@@ -211,11 +211,13 @@ public class CarrierIdentifier extends Handler {
                    if (mIccRecords != null) {
                        logd("Removing stale icc objects.");
                        mIccRecords.unregisterForRecordsLoaded(this);
                        mIccRecords.unregisterForRecordsOverride(this);
                        mIccRecords = null;
                    }
                    if (newIccRecords != null) {
                        logd("new Icc object");
                        newIccRecords.registerForRecordsLoaded(this, SIM_LOAD_EVENT, null);
                        newIccRecords.registerForRecordsOverride(this, SIM_LOAD_EVENT, null);
                        mIccRecords = newIccRecords;
                    }
                }
+24 −15
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;

import com.android.internal.telephony.metrics.TelephonyMetrics;

import java.util.Date;

/**
@@ -50,30 +52,30 @@ public class CarrierInfoManager {
    /**
     * Returns Carrier specific information that will be used to encrypt the IMSI and IMPI.
     * @param keyType whether the key is being used for WLAN or ePDG.
     * @param mContext
     * @param context
     * @return ImsiEncryptionInfo which contains the information, including the public key, to be
     *         used for encryption.
     */
    public static ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int keyType,
                                                                     Context mContext) {
                                                                     Context context) {
        String mcc = "";
        String mnc = "";
        final TelephonyManager telephonyManager =
                (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
        String networkOperator = telephonyManager.getNetworkOperator();
        if (!TextUtils.isEmpty(networkOperator)) {
            mcc = networkOperator.substring(0, 3);
            mnc = networkOperator.substring(3);
                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        String simOperator = telephonyManager.getSimOperator();
        if (!TextUtils.isEmpty(simOperator)) {
            mcc = simOperator.substring(0, 3);
            mnc = simOperator.substring(3);
            Log.i(LOG_TAG, "using values for mnc, mcc: " + mnc + "," + mcc);
        } else {
            Log.e(LOG_TAG, "Invalid networkOperator: " + networkOperator);
            Log.e(LOG_TAG, "Invalid networkOperator: " + simOperator);
            return null;
        }
        Cursor findCursor = null;
        try {
            // In the current design, MVNOs are not supported. If we decide to support them,
            // we'll need to add to this CL.
            ContentResolver mContentResolver = mContext.getContentResolver();
            ContentResolver mContentResolver = context.getContentResolver();
            String[] columns = {Telephony.CarrierColumns.PUBLIC_KEY,
                    Telephony.CarrierColumns.EXPIRATION_TIME,
                    Telephony.CarrierColumns.KEY_IDENTIFIER};
@@ -107,12 +109,13 @@ public class CarrierInfoManager {
    /**
     * Inserts or update the Carrier Key in the database
     * @param imsiEncryptionInfo ImsiEncryptionInfo object.
     * @param mContext Context.
     * @param context Context.
     */
    public static void updateOrInsertCarrierKey(ImsiEncryptionInfo imsiEncryptionInfo,
                                                Context mContext) {
                                                Context context, int phoneId) {
        byte[] keyBytes = imsiEncryptionInfo.getPublicKey().getEncoded();
        ContentResolver mContentResolver = mContext.getContentResolver();
        ContentResolver mContentResolver = context.getContentResolver();
        TelephonyMetrics tm = TelephonyMetrics.getInstance();
        // In the current design, MVNOs are not supported. If we decide to support them,
        // we'll need to add to this CL.
        ContentValues contentValues = new ContentValues();
@@ -125,6 +128,7 @@ public class CarrierInfoManager {
        contentValues.put(Telephony.CarrierColumns.PUBLIC_KEY, keyBytes);
        contentValues.put(Telephony.CarrierColumns.EXPIRATION_TIME,
                imsiEncryptionInfo.getExpirationTime().getTime());
        boolean downloadSuccessfull = true;
        try {
            Log.i(LOG_TAG, "Inserting imsiEncryptionInfo into db");
            mContentResolver.insert(Telephony.CarrierColumns.CONTENT_URI, contentValues);
@@ -145,12 +149,17 @@ public class CarrierInfoManager {
                                String.valueOf(imsiEncryptionInfo.getKeyType())});
                if (nRows == 0) {
                    Log.d(LOG_TAG, "Error updating values:" + imsiEncryptionInfo);
                    downloadSuccessfull = false;
                }
            } catch (Exception ex) {
                Log.d(LOG_TAG, "Error updating values:" + imsiEncryptionInfo + ex);
                downloadSuccessfull = false;
            }
        }  catch (Exception e) {
            Log.d(LOG_TAG, "Error inserting/updating values:" + imsiEncryptionInfo + e);
            downloadSuccessfull = false;
        } finally {
            tm.writeCarrierKeyEvent(phoneId, imsiEncryptionInfo.getKeyType(), downloadSuccessfull);
        }
    }

@@ -162,12 +171,12 @@ public class CarrierInfoManager {
     *        {@link java.security.PublicKey} and the Key Identifier.
     *        The keyIdentifier Attribute value pair that helps a server locate
     *        the private key to decrypt the permanent identity.
     * @param mContext Context.
     * @param context Context.
     */
    public static void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo,
                                                       Context mContext) {
                                                       Context context, int phoneId) {
        Log.i(LOG_TAG, "inserting carrier key: " + imsiEncryptionInfo);
        updateOrInsertCarrierKey(imsiEncryptionInfo, mContext);
        updateOrInsertCarrierKey(imsiEncryptionInfo, context, phoneId);
        //todo send key to modem. Will be done in a subsequent CL.
    }

+1 −0
Original line number Diff line number Diff line
@@ -281,6 +281,7 @@ public class CarrierServiceStateTracker extends Handler {
            CarrierConfigManager carrierConfigManager = (CarrierConfigManager)
                    context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
            PersistableBundle b = carrierConfigManager.getConfigForSubId(mPhone.getSubId());

            for (Map.Entry<Integer, NotificationType> entry : mNotificationTypeMap.entrySet()) {
                NotificationType notificationType = entry.getValue();
                notificationType.setDelay(b);
+28 −18
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static com.android.internal.telephony.CommandsInterface.CF_REASON_UNCONDI
import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_VOICE;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
@@ -1387,7 +1388,11 @@ public class GsmCdmaPhone extends Phone {
            if (b != null) {
                String defaultVmNumber =
                        b.getString(CarrierConfigManager.KEY_DEFAULT_VM_NUMBER_STRING);
                if (!TextUtils.isEmpty(defaultVmNumber)) {
                String defaultVmNumberRoaming =
                        b.getString(CarrierConfigManager.KEY_DEFAULT_VM_NUMBER_ROAMING_STRING);
                if (!TextUtils.isEmpty(defaultVmNumberRoaming) && mSST.mSS.getRoaming()) {
                    number = defaultVmNumberRoaming;
                } else {
                    number = defaultVmNumber;
                }
            }
@@ -1504,15 +1509,20 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    @Nullable
    public String getSubscriberId() {
        if (isPhoneTypeGsm()) {
            IccRecords r = mIccRecords.get();
            return (r != null) ? r.getIMSI() : null;
        } else if (isPhoneTypeCdma()) {
            return mSST.getImsi();
        } else { //isPhoneTypeCdmaLte()
            return (mSimRecords != null) ? mSimRecords.getIMSI() : "";
        String subscriberId = null;
        if (isPhoneTypeCdma()) {
            subscriberId = mSST.getImsi();
        } else {
            // Both Gsm and CdmaLte get the IMSI from Usim.
            IccRecords iccRecords = mUiccController.getIccRecords(
                    mPhoneId, UiccController.APP_FAM_3GPP);
            if (iccRecords != null) {
                subscriberId = iccRecords.getIMSI();
            }
        }
        return subscriberId;
    }

    @Override
@@ -1522,7 +1532,7 @@ public class GsmCdmaPhone extends Phone {

    @Override
    public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo) {
        CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext);
        CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext, mPhoneId);
    }

    @Override
@@ -1536,13 +1546,13 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void resetCarrierKeysForImsiEncryption() {
        mCIM.resetCarrierKeysForImsiEncryption(mContext, mPhoneId);
    public int getCarrierIdListVersion() {
        return mCarrerIdentifier.getCarrierListVersion();
    }

    @Override
    public int getCarrierIdListVersion() {
        return mCarrerIdentifier.getCarrierListVersion();
    public void resetCarrierKeysForImsiEncryption() {
        mCIM.resetCarrierKeysForImsiEncryption(mContext, mPhoneId);
    }

    @Override
@@ -2339,14 +2349,14 @@ public class GsmCdmaPhone extends Phone {
                    int current_cdma_roaming_mode =
                            Settings.Global.getInt(getContext().getContentResolver(),
                            Settings.Global.CDMA_ROAMING_MODE,
                            CarrierConfigManager.CDMA_ROAMING_MODE_RADIO_DEFAULT);
                            TelephonyManager.CDMA_ROAMING_MODE_RADIO_DEFAULT);
                    switch (config_cdma_roaming_mode) {
                        // Carrier's cdma_roaming_mode will overwrite the user's previous settings
                        // Keep the user's previous setting in global variable which will be used
                        // when carrier's setting is turn off.
                        case CarrierConfigManager.CDMA_ROAMING_MODE_HOME:
                        case CarrierConfigManager.CDMA_ROAMING_MODE_AFFILIATED:
                        case CarrierConfigManager.CDMA_ROAMING_MODE_ANY:
                        case TelephonyManager.CDMA_ROAMING_MODE_HOME:
                        case TelephonyManager.CDMA_ROAMING_MODE_AFFILIATED:
                        case TelephonyManager.CDMA_ROAMING_MODE_ANY:
                            logd("cdma_roaming_mode is going to changed to "
                                    + config_cdma_roaming_mode);
                            setCdmaRoamingPreference(config_cdma_roaming_mode,
@@ -2355,7 +2365,7 @@ public class GsmCdmaPhone extends Phone {

                        // When carrier's setting is turn off, change the cdma_roaming_mode to the
                        // previous user's setting
                        case CarrierConfigManager.CDMA_ROAMING_MODE_RADIO_DEFAULT:
                        case TelephonyManager.CDMA_ROAMING_MODE_RADIO_DEFAULT:
                            if (current_cdma_roaming_mode != config_cdma_roaming_mode) {
                                logd("cdma_roaming_mode is going to changed to "
                                        + current_cdma_roaming_mode);
Loading