Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +42 −8 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ import com.android.internal.telephony.dataconnection.DcTracker; import com.android.internal.telephony.gsm.GsmMmiCode; import com.android.internal.telephony.gsm.SuppServiceNotification; import com.android.internal.telephony.test.SimulatedRadioControl; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType; import com.android.internal.telephony.uicc.IccCardProxy; import com.android.internal.telephony.uicc.IccException; import com.android.internal.telephony.uicc.IccRecords; Loading Loading @@ -276,6 +277,7 @@ public class GsmCdmaPhone extends Phone { mMeid = null; mPrecisePhoneType = precisePhoneType; logd("Precise phone type " + mPrecisePhoneType); TelephonyManager tm = TelephonyManager.from(mContext); if (isPhoneTypeGsm()) { Loading @@ -302,7 +304,7 @@ public class GsmCdmaPhone extends Phone { logd("init: operatorAlpha='" + operatorAlpha + "' operatorNumeric='" + operatorNumeric + "'"); if (mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP) == null || isPhoneTypeCdmaLte()) { null || isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { if (!TextUtils.isEmpty(operatorAlpha)) { logd("init: set 'gsm.sim.operator.alpha' to operator='" + operatorAlpha + "'"); tm.setSimOperatorNameForPhone(mPhoneId, operatorAlpha); Loading Loading @@ -681,7 +683,7 @@ public class GsmCdmaPhone extends Phone { if (getUnitTestMode()) { return; } if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { TelephonyManager.setTelephonyProperty(mPhoneId, property, value); } else { super.setSystemProperty(property, value); Loading Loading @@ -1571,7 +1573,7 @@ public class GsmCdmaPhone extends Phone { @Override public String getSystemProperty(String property, String defValue) { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { if (getUnitTestMode()) { return null; } Loading Loading @@ -2399,7 +2401,7 @@ public class GsmCdmaPhone extends Phone { if (mSimRecords != null) { mSimRecords.unregisterForRecordsLoaded(this); } if (isPhoneTypeCdmaLte()) { if (isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP); SIMRecords newSimRecords = null; Loading Loading @@ -2461,7 +2463,7 @@ public class GsmCdmaPhone extends Phone { */ @Override public boolean updateCurrentCarrierInProvider() { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { long currentDds = SubscriptionManager.getDefaultDataSubscriptionId(); String operatorNumeric = getOperatorNumeric(); Loading Loading @@ -3146,7 +3148,13 @@ public class GsmCdmaPhone extends Phone { + (ServiceState.isGsm(newVoiceRadioTech) ? "GSM" : "CDMA")); if (ServiceState.isCdma(newVoiceRadioTech)) { UiccCardApplication cdmaApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP2); if (cdmaApplication != null && cdmaApplication.getType() == AppType.APPTYPE_RUIM) { switchPhoneType(PhoneConstants.PHONE_TYPE_CDMA); } else { switchPhoneType(PhoneConstants.PHONE_TYPE_CDMA_LTE); } } else if (ServiceState.isGsm(newVoiceRadioTech)) { switchPhoneType(PhoneConstants.PHONE_TYPE_GSM); } else { Loading Loading @@ -3266,8 +3274,16 @@ public class GsmCdmaPhone extends Phone { if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_NV) { operatorNumeric = SystemProperties.get("ro.cdma.home.operator.numeric"); } else if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_RUIM_SIM) { UiccCardApplication uiccCardApplication = mUiccApplication.get(); if (uiccCardApplication != null && uiccCardApplication.getType() == AppType.APPTYPE_RUIM) { logd("Legacy RUIM app present"); curIccRecords = mIccRecords.get(); } else { // Use sim-records for SimApp, USimApp, CSimApp and ISimApp. curIccRecords = mSimRecords; if (curIccRecords != null) { } if (curIccRecords != null && curIccRecords == mSimRecords) { operatorNumeric = curIccRecords.getOperatorNumeric(); } else { curIccRecords = mIccRecords.get(); Loading Loading @@ -3377,4 +3393,22 @@ public class GsmCdmaPhone extends Phone { return result; } @Override public int getLteOnCdmaMode() { int currentConfig = super.getLteOnCdmaMode(); int lteOnCdmaModeDynamicValue = currentConfig; UiccCardApplication cdmaApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP2); if (cdmaApplication != null && cdmaApplication.getType() == AppType.APPTYPE_RUIM) { //Legacy RUIM cards don't support LTE. lteOnCdmaModeDynamicValue = RILConstants.LTE_ON_CDMA_FALSE; //Override only if static configuration is TRUE. if (currentConfig == RILConstants.LTE_ON_CDMA_TRUE) { return lteOnCdmaModeDynamicValue; } } return currentConfig; } } src/java/com/android/internal/telephony/RIL.java +93 −1 Original line number Diff line number Diff line Loading @@ -1596,7 +1596,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { response); rr.mParcel.writeInt(status); rr.mParcel.writeString(pdu); constructCdmaWriteSmsRilRequest(rr, IccUtils.hexStringToBytes(pdu)); if (RILJ_LOGV) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) Loading @@ -1605,6 +1605,98 @@ public final class RIL extends BaseCommands implements CommandsInterface { send(rr); } /** * Restructures PDU data so that it is consistent with RIL * data structure. * * @param pdu The data to be written to the RUIM card. */ private void constructCdmaWriteSmsRilRequest(RILRequest rr, byte[] pdu) { int address_nbr_of_digits; int subaddr_nbr_of_digits; int bearerDataLength; ByteArrayInputStream bais = new ByteArrayInputStream(pdu); DataInputStream dis = new DataInputStream(bais); try { int teleServiceId = 0; byte servicePresent = 0; int serviceCategory = 0; int address_digit_mode = 0; int address_nbr_mode = 0; int address_ton = 0; int address_nbr_plan = 0; int subaddressType = 0; byte subaddr_odd = 0; teleServiceId = dis.readInt(); rr.mParcel.writeInt(teleServiceId); servicePresent = (byte) dis.readInt(); rr.mParcel.writeByte(servicePresent); serviceCategory = dis.readInt(); rr.mParcel.writeInt(serviceCategory); address_digit_mode = dis.readByte(); rr.mParcel.writeInt(address_digit_mode); address_nbr_mode = dis.readByte(); rr.mParcel.writeInt(address_nbr_mode); address_ton = dis.readByte(); rr.mParcel.writeInt(address_ton); address_nbr_plan = dis.readByte(); rr.mParcel.writeInt(address_nbr_plan); address_nbr_of_digits = dis.readByte(); rr.mParcel.writeByte((byte) address_nbr_of_digits); for (int i = 0; i < address_nbr_of_digits; i++) { rr.mParcel.writeByte(dis.readByte()); // address_orig_bytes[i] } // int subaddressType = dis.readByte(); rr.mParcel.writeInt(subaddressType); // subaddressType subaddr_odd = (byte) dis.readByte(); rr.mParcel.writeByte(subaddr_odd); // subaddr_odd subaddr_nbr_of_digits = (byte) dis.readByte(); rr.mParcel.writeByte((byte) subaddr_nbr_of_digits); for (int i = 0; i < subaddr_nbr_of_digits; i++) { rr.mParcel.writeByte(dis.readByte()); // subaddr_orig_bytes[i] } bearerDataLength = dis.readByte() & 0xff; rr.mParcel.writeInt(bearerDataLength); for (int i = 0; i < bearerDataLength; i++) { rr.mParcel.writeByte(dis.readByte()); // bearerData[i] } riljLog(" teleServiceId=" + teleServiceId + " servicePresent=" + servicePresent + " serviceCategory=" + serviceCategory + " address_digit_mode=" + address_digit_mode + " address_nbr_mode=" + address_nbr_mode + " address_ton=" + address_ton + " address_nbr_plan=" + address_nbr_plan + " address_nbr_of_digits=" + address_nbr_of_digits + " subaddressType=" + subaddressType + " subaddr_odd= " + subaddr_odd + " subaddr_nbr_of_digits=" + subaddr_nbr_of_digits + " bearerDataLength=" + bearerDataLength); } catch (IOException ex) { if (RILJ_LOGD) riljLog("sendSmsCdma: conversion from input stream to object failed: " + ex); } finally { try { if (null != bais) { bais.close(); } if (null != dis) { dis.close(); } } catch (IOException e) { if (RILJ_LOGD) riljLog("sendSmsCdma: close input stream exception" + e); } } } /** * Translates EF_SMS status bits to a status value compatible with * SMS AT commands. See TS 27.005 3.1. Loading src/java/com/android/internal/telephony/SMSDispatcher.java +58 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.annotation.Nullable; import android.annotation.NonNull; import android.app.Activity; import android.app.AlertDialog; import android.app.PendingIntent; Loading Loading @@ -52,6 +53,7 @@ import android.telephony.ServiceState; import android.telephony.TelephonyManager; import android.text.Html; import android.text.Spanned; import android.text.TextPaint; import android.text.TextUtils; import android.util.EventLog; import android.view.LayoutInflater; Loading Loading @@ -87,6 +89,7 @@ public abstract class SMSDispatcher extends Handler { static final String TAG = "SMSDispatcher"; // accessed from inner class static final boolean DBG = false; private static final String SEND_NEXT_MSG_EXTRA = "SendNextMsg"; private static final float MAX_LABEL_SIZE_PX = 500f; private static final int PREMIUM_RULE_USE_SIM = 1; private static final int PREMIUM_RULE_USE_NETWORK = 2; Loading Loading @@ -1082,6 +1085,12 @@ public abstract class SMSDispatcher extends Handler { return true; // not a premium short code } // Do not allow any premium sms during SuW if (Settings.Global.getInt(mResolver, Settings.Global.DEVICE_PROVISIONED, 0) == 0) { Rlog.e(TAG, "Can't send premium sms during Setup Wizard"); return false; } // Wait for user confirmation unless the user has set permission to always allow/deny int premiumSmsPermission = mUsageMonitor.getPremiumSmsPermission( tracker.mAppInfo.packageName); Loading Loading @@ -1140,13 +1149,61 @@ public abstract class SMSDispatcher extends Handler { PackageManager pm = mContext.getPackageManager(); try { ApplicationInfo appInfo = pm.getApplicationInfo(appPackage, 0); return appInfo.loadSafeLabel(pm); String label = appInfo.loadLabel(pm).toString(); return convertSafeLabel(label, appPackage); } catch (PackageManager.NameNotFoundException e) { Rlog.e(TAG, "PackageManager Name Not Found for package " + appPackage); return appPackage; // fall back to package name if we can't get app label } } /** * Check appLabel with the addition that the returned label is safe for being presented * in the UI since it will not contain new lines and the length will be limited to a * reasonable amount. This prevents a malicious party to influence UI * layout via the app label misleading the user into performing a * detrimental for them action. If the label is too long it will be * truncated and ellipsized at the end. * * @param label A string of appLabel from PackageItemInfo#loadLabel * @param appPackage the package name of the app requesting to send an SMS * @return Returns a CharSequence containing the item's label. If the * item does not have a label, its name is returned. */ private CharSequence convertSafeLabel(@NonNull String labelStr, String appPackage) { // If the label contains new line characters it may push the UI // down to hide a part of it. Labels shouldn't have new line // characters, so just truncate at the first time one is seen. final int labelLength = labelStr.length(); int offset = 0; while (offset < labelLength) { final int codePoint = labelStr.codePointAt(offset); final int type = Character.getType(codePoint); if (type == Character.LINE_SEPARATOR || type == Character.CONTROL || type == Character.PARAGRAPH_SEPARATOR) { labelStr = labelStr.substring(0, offset); break; } // replace all non-break space to " " in order to be trimmed if (type == Character.SPACE_SEPARATOR) { labelStr = labelStr.substring(0, offset) + " " + labelStr.substring(offset + Character.charCount(codePoint)); } offset += Character.charCount(codePoint); } labelStr = labelStr.trim(); if (labelStr.isEmpty()) { return appPackage; } TextPaint paint = new TextPaint(); paint.setTextSize(42); return TextUtils.ellipsize(labelStr, paint, MAX_LABEL_SIZE_PX, TextUtils.TruncateAt.END); } /** * Post an alert when SMS needs confirmation due to excessive usage. * @param tracker an SmsTracker for the current message. Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +3 −4 Original line number Diff line number Diff line Loading @@ -580,9 +580,7 @@ public class ServiceStateTracker extends Handler { mCi.unregisterForAvailable(this); mCi.unSetOnRestrictedStateChanged(this); if (mPhone.isPhoneTypeCdmaLte()) { mPhone.registerForSimRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null); } mCellLoc = new CdmaCellLocation(); mNewCellLoc = new CdmaCellLocation(); mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(mPhone.getContext(), mCi, this, Loading Loading @@ -4226,7 +4224,8 @@ public class ServiceStateTracker extends Handler { public void powerOffRadioSafely(DcTracker dcTracker) { synchronized (this) { if (!mPendingRadioPowerOffAfterDataOff) { if (mPhone.isPhoneTypeGsm() || mPhone.isPhoneTypeCdmaLte()) { if (mPhone.isPhoneTypeGsm() || mPhone.isPhoneTypeCdma() || mPhone.isPhoneTypeCdmaLte()) { int dds = SubscriptionManager.getDefaultDataSubscriptionId(); // To minimize race conditions we call cleanUpAllConnections on // both if else paths instead of before this isDisconnected test. Loading src/java/com/android/internal/telephony/TelephonyEventLog.java +15 −11 Original line number Diff line number Diff line Loading @@ -420,6 +420,7 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { if (rilError != 0) b.putInt(DATA_KEY_RIL_ERROR, rilError); switch (rilRequest) { case RIL_REQUEST_SETUP_DATA_CALL: if (ret != null) { DataCallResponse dataCall = (DataCallResponse)ret; b.putInt(DATA_KEY_DATA_CALL_STATUS, dataCall.status); b.putInt(DATA_KEY_DATA_CALL_RETRY, dataCall.suggestedRetryTime); Loading @@ -427,6 +428,7 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { b.putInt(DATA_KEY_DATA_CALL_ACTIVE, dataCall.active); b.putString(DATA_KEY_DATA_CALL_TYPE, dataCall.type); b.putString(DATA_KEY_DATA_CALL_IFNAME, dataCall.ifname); } writeEvent(TAG_RIL_RESPONSE, rilRequest, rilSerial, b); break; Loading @@ -443,10 +445,12 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { case RIL_REQUEST_SEND_SMS_EXPECT_MORE: case RIL_REQUEST_CDMA_SEND_SMS: case RIL_REQUEST_IMS_SEND_SMS: if (ret != null) { SmsResponse smsResponse = (SmsResponse)ret; b.putInt(DATA_KEY_SMS_MESSAGE_REF, smsResponse.mMessageRef); b.putString(DATA_KEY_SMS_ACK_PDU, smsResponse.mAckPdu); b.putInt(DATA_KEY_SMS_ERROR_CODE, smsResponse.mErrorCode); } writeEvent(TAG_RIL_RESPONSE, rilRequest, rilSerial, b); break; } Loading Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +42 −8 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ import com.android.internal.telephony.dataconnection.DcTracker; import com.android.internal.telephony.gsm.GsmMmiCode; import com.android.internal.telephony.gsm.SuppServiceNotification; import com.android.internal.telephony.test.SimulatedRadioControl; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType; import com.android.internal.telephony.uicc.IccCardProxy; import com.android.internal.telephony.uicc.IccException; import com.android.internal.telephony.uicc.IccRecords; Loading Loading @@ -276,6 +277,7 @@ public class GsmCdmaPhone extends Phone { mMeid = null; mPrecisePhoneType = precisePhoneType; logd("Precise phone type " + mPrecisePhoneType); TelephonyManager tm = TelephonyManager.from(mContext); if (isPhoneTypeGsm()) { Loading @@ -302,7 +304,7 @@ public class GsmCdmaPhone extends Phone { logd("init: operatorAlpha='" + operatorAlpha + "' operatorNumeric='" + operatorNumeric + "'"); if (mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP) == null || isPhoneTypeCdmaLte()) { null || isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { if (!TextUtils.isEmpty(operatorAlpha)) { logd("init: set 'gsm.sim.operator.alpha' to operator='" + operatorAlpha + "'"); tm.setSimOperatorNameForPhone(mPhoneId, operatorAlpha); Loading Loading @@ -681,7 +683,7 @@ public class GsmCdmaPhone extends Phone { if (getUnitTestMode()) { return; } if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { TelephonyManager.setTelephonyProperty(mPhoneId, property, value); } else { super.setSystemProperty(property, value); Loading Loading @@ -1571,7 +1573,7 @@ public class GsmCdmaPhone extends Phone { @Override public String getSystemProperty(String property, String defValue) { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { if (getUnitTestMode()) { return null; } Loading Loading @@ -2399,7 +2401,7 @@ public class GsmCdmaPhone extends Phone { if (mSimRecords != null) { mSimRecords.unregisterForRecordsLoaded(this); } if (isPhoneTypeCdmaLte()) { if (isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP); SIMRecords newSimRecords = null; Loading Loading @@ -2461,7 +2463,7 @@ public class GsmCdmaPhone extends Phone { */ @Override public boolean updateCurrentCarrierInProvider() { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) { if (isPhoneTypeGsm() || isPhoneTypeCdmaLte() || isPhoneTypeCdma()) { long currentDds = SubscriptionManager.getDefaultDataSubscriptionId(); String operatorNumeric = getOperatorNumeric(); Loading Loading @@ -3146,7 +3148,13 @@ public class GsmCdmaPhone extends Phone { + (ServiceState.isGsm(newVoiceRadioTech) ? "GSM" : "CDMA")); if (ServiceState.isCdma(newVoiceRadioTech)) { UiccCardApplication cdmaApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP2); if (cdmaApplication != null && cdmaApplication.getType() == AppType.APPTYPE_RUIM) { switchPhoneType(PhoneConstants.PHONE_TYPE_CDMA); } else { switchPhoneType(PhoneConstants.PHONE_TYPE_CDMA_LTE); } } else if (ServiceState.isGsm(newVoiceRadioTech)) { switchPhoneType(PhoneConstants.PHONE_TYPE_GSM); } else { Loading Loading @@ -3266,8 +3274,16 @@ public class GsmCdmaPhone extends Phone { if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_NV) { operatorNumeric = SystemProperties.get("ro.cdma.home.operator.numeric"); } else if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_RUIM_SIM) { UiccCardApplication uiccCardApplication = mUiccApplication.get(); if (uiccCardApplication != null && uiccCardApplication.getType() == AppType.APPTYPE_RUIM) { logd("Legacy RUIM app present"); curIccRecords = mIccRecords.get(); } else { // Use sim-records for SimApp, USimApp, CSimApp and ISimApp. curIccRecords = mSimRecords; if (curIccRecords != null) { } if (curIccRecords != null && curIccRecords == mSimRecords) { operatorNumeric = curIccRecords.getOperatorNumeric(); } else { curIccRecords = mIccRecords.get(); Loading Loading @@ -3377,4 +3393,22 @@ public class GsmCdmaPhone extends Phone { return result; } @Override public int getLteOnCdmaMode() { int currentConfig = super.getLteOnCdmaMode(); int lteOnCdmaModeDynamicValue = currentConfig; UiccCardApplication cdmaApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP2); if (cdmaApplication != null && cdmaApplication.getType() == AppType.APPTYPE_RUIM) { //Legacy RUIM cards don't support LTE. lteOnCdmaModeDynamicValue = RILConstants.LTE_ON_CDMA_FALSE; //Override only if static configuration is TRUE. if (currentConfig == RILConstants.LTE_ON_CDMA_TRUE) { return lteOnCdmaModeDynamicValue; } } return currentConfig; } }
src/java/com/android/internal/telephony/RIL.java +93 −1 Original line number Diff line number Diff line Loading @@ -1596,7 +1596,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { response); rr.mParcel.writeInt(status); rr.mParcel.writeString(pdu); constructCdmaWriteSmsRilRequest(rr, IccUtils.hexStringToBytes(pdu)); if (RILJ_LOGV) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) Loading @@ -1605,6 +1605,98 @@ public final class RIL extends BaseCommands implements CommandsInterface { send(rr); } /** * Restructures PDU data so that it is consistent with RIL * data structure. * * @param pdu The data to be written to the RUIM card. */ private void constructCdmaWriteSmsRilRequest(RILRequest rr, byte[] pdu) { int address_nbr_of_digits; int subaddr_nbr_of_digits; int bearerDataLength; ByteArrayInputStream bais = new ByteArrayInputStream(pdu); DataInputStream dis = new DataInputStream(bais); try { int teleServiceId = 0; byte servicePresent = 0; int serviceCategory = 0; int address_digit_mode = 0; int address_nbr_mode = 0; int address_ton = 0; int address_nbr_plan = 0; int subaddressType = 0; byte subaddr_odd = 0; teleServiceId = dis.readInt(); rr.mParcel.writeInt(teleServiceId); servicePresent = (byte) dis.readInt(); rr.mParcel.writeByte(servicePresent); serviceCategory = dis.readInt(); rr.mParcel.writeInt(serviceCategory); address_digit_mode = dis.readByte(); rr.mParcel.writeInt(address_digit_mode); address_nbr_mode = dis.readByte(); rr.mParcel.writeInt(address_nbr_mode); address_ton = dis.readByte(); rr.mParcel.writeInt(address_ton); address_nbr_plan = dis.readByte(); rr.mParcel.writeInt(address_nbr_plan); address_nbr_of_digits = dis.readByte(); rr.mParcel.writeByte((byte) address_nbr_of_digits); for (int i = 0; i < address_nbr_of_digits; i++) { rr.mParcel.writeByte(dis.readByte()); // address_orig_bytes[i] } // int subaddressType = dis.readByte(); rr.mParcel.writeInt(subaddressType); // subaddressType subaddr_odd = (byte) dis.readByte(); rr.mParcel.writeByte(subaddr_odd); // subaddr_odd subaddr_nbr_of_digits = (byte) dis.readByte(); rr.mParcel.writeByte((byte) subaddr_nbr_of_digits); for (int i = 0; i < subaddr_nbr_of_digits; i++) { rr.mParcel.writeByte(dis.readByte()); // subaddr_orig_bytes[i] } bearerDataLength = dis.readByte() & 0xff; rr.mParcel.writeInt(bearerDataLength); for (int i = 0; i < bearerDataLength; i++) { rr.mParcel.writeByte(dis.readByte()); // bearerData[i] } riljLog(" teleServiceId=" + teleServiceId + " servicePresent=" + servicePresent + " serviceCategory=" + serviceCategory + " address_digit_mode=" + address_digit_mode + " address_nbr_mode=" + address_nbr_mode + " address_ton=" + address_ton + " address_nbr_plan=" + address_nbr_plan + " address_nbr_of_digits=" + address_nbr_of_digits + " subaddressType=" + subaddressType + " subaddr_odd= " + subaddr_odd + " subaddr_nbr_of_digits=" + subaddr_nbr_of_digits + " bearerDataLength=" + bearerDataLength); } catch (IOException ex) { if (RILJ_LOGD) riljLog("sendSmsCdma: conversion from input stream to object failed: " + ex); } finally { try { if (null != bais) { bais.close(); } if (null != dis) { dis.close(); } } catch (IOException e) { if (RILJ_LOGD) riljLog("sendSmsCdma: close input stream exception" + e); } } } /** * Translates EF_SMS status bits to a status value compatible with * SMS AT commands. See TS 27.005 3.1. Loading
src/java/com/android/internal/telephony/SMSDispatcher.java +58 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.annotation.Nullable; import android.annotation.NonNull; import android.app.Activity; import android.app.AlertDialog; import android.app.PendingIntent; Loading Loading @@ -52,6 +53,7 @@ import android.telephony.ServiceState; import android.telephony.TelephonyManager; import android.text.Html; import android.text.Spanned; import android.text.TextPaint; import android.text.TextUtils; import android.util.EventLog; import android.view.LayoutInflater; Loading Loading @@ -87,6 +89,7 @@ public abstract class SMSDispatcher extends Handler { static final String TAG = "SMSDispatcher"; // accessed from inner class static final boolean DBG = false; private static final String SEND_NEXT_MSG_EXTRA = "SendNextMsg"; private static final float MAX_LABEL_SIZE_PX = 500f; private static final int PREMIUM_RULE_USE_SIM = 1; private static final int PREMIUM_RULE_USE_NETWORK = 2; Loading Loading @@ -1082,6 +1085,12 @@ public abstract class SMSDispatcher extends Handler { return true; // not a premium short code } // Do not allow any premium sms during SuW if (Settings.Global.getInt(mResolver, Settings.Global.DEVICE_PROVISIONED, 0) == 0) { Rlog.e(TAG, "Can't send premium sms during Setup Wizard"); return false; } // Wait for user confirmation unless the user has set permission to always allow/deny int premiumSmsPermission = mUsageMonitor.getPremiumSmsPermission( tracker.mAppInfo.packageName); Loading Loading @@ -1140,13 +1149,61 @@ public abstract class SMSDispatcher extends Handler { PackageManager pm = mContext.getPackageManager(); try { ApplicationInfo appInfo = pm.getApplicationInfo(appPackage, 0); return appInfo.loadSafeLabel(pm); String label = appInfo.loadLabel(pm).toString(); return convertSafeLabel(label, appPackage); } catch (PackageManager.NameNotFoundException e) { Rlog.e(TAG, "PackageManager Name Not Found for package " + appPackage); return appPackage; // fall back to package name if we can't get app label } } /** * Check appLabel with the addition that the returned label is safe for being presented * in the UI since it will not contain new lines and the length will be limited to a * reasonable amount. This prevents a malicious party to influence UI * layout via the app label misleading the user into performing a * detrimental for them action. If the label is too long it will be * truncated and ellipsized at the end. * * @param label A string of appLabel from PackageItemInfo#loadLabel * @param appPackage the package name of the app requesting to send an SMS * @return Returns a CharSequence containing the item's label. If the * item does not have a label, its name is returned. */ private CharSequence convertSafeLabel(@NonNull String labelStr, String appPackage) { // If the label contains new line characters it may push the UI // down to hide a part of it. Labels shouldn't have new line // characters, so just truncate at the first time one is seen. final int labelLength = labelStr.length(); int offset = 0; while (offset < labelLength) { final int codePoint = labelStr.codePointAt(offset); final int type = Character.getType(codePoint); if (type == Character.LINE_SEPARATOR || type == Character.CONTROL || type == Character.PARAGRAPH_SEPARATOR) { labelStr = labelStr.substring(0, offset); break; } // replace all non-break space to " " in order to be trimmed if (type == Character.SPACE_SEPARATOR) { labelStr = labelStr.substring(0, offset) + " " + labelStr.substring(offset + Character.charCount(codePoint)); } offset += Character.charCount(codePoint); } labelStr = labelStr.trim(); if (labelStr.isEmpty()) { return appPackage; } TextPaint paint = new TextPaint(); paint.setTextSize(42); return TextUtils.ellipsize(labelStr, paint, MAX_LABEL_SIZE_PX, TextUtils.TruncateAt.END); } /** * Post an alert when SMS needs confirmation due to excessive usage. * @param tracker an SmsTracker for the current message. Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +3 −4 Original line number Diff line number Diff line Loading @@ -580,9 +580,7 @@ public class ServiceStateTracker extends Handler { mCi.unregisterForAvailable(this); mCi.unSetOnRestrictedStateChanged(this); if (mPhone.isPhoneTypeCdmaLte()) { mPhone.registerForSimRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null); } mCellLoc = new CdmaCellLocation(); mNewCellLoc = new CdmaCellLocation(); mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(mPhone.getContext(), mCi, this, Loading Loading @@ -4226,7 +4224,8 @@ public class ServiceStateTracker extends Handler { public void powerOffRadioSafely(DcTracker dcTracker) { synchronized (this) { if (!mPendingRadioPowerOffAfterDataOff) { if (mPhone.isPhoneTypeGsm() || mPhone.isPhoneTypeCdmaLte()) { if (mPhone.isPhoneTypeGsm() || mPhone.isPhoneTypeCdma() || mPhone.isPhoneTypeCdmaLte()) { int dds = SubscriptionManager.getDefaultDataSubscriptionId(); // To minimize race conditions we call cleanUpAllConnections on // both if else paths instead of before this isDisconnected test. Loading
src/java/com/android/internal/telephony/TelephonyEventLog.java +15 −11 Original line number Diff line number Diff line Loading @@ -420,6 +420,7 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { if (rilError != 0) b.putInt(DATA_KEY_RIL_ERROR, rilError); switch (rilRequest) { case RIL_REQUEST_SETUP_DATA_CALL: if (ret != null) { DataCallResponse dataCall = (DataCallResponse)ret; b.putInt(DATA_KEY_DATA_CALL_STATUS, dataCall.status); b.putInt(DATA_KEY_DATA_CALL_RETRY, dataCall.suggestedRetryTime); Loading @@ -427,6 +428,7 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { b.putInt(DATA_KEY_DATA_CALL_ACTIVE, dataCall.active); b.putString(DATA_KEY_DATA_CALL_TYPE, dataCall.type); b.putString(DATA_KEY_DATA_CALL_IFNAME, dataCall.ifname); } writeEvent(TAG_RIL_RESPONSE, rilRequest, rilSerial, b); break; Loading @@ -443,10 +445,12 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { case RIL_REQUEST_SEND_SMS_EXPECT_MORE: case RIL_REQUEST_CDMA_SEND_SMS: case RIL_REQUEST_IMS_SEND_SMS: if (ret != null) { SmsResponse smsResponse = (SmsResponse)ret; b.putInt(DATA_KEY_SMS_MESSAGE_REF, smsResponse.mMessageRef); b.putString(DATA_KEY_SMS_ACK_PDU, smsResponse.mAckPdu); b.putInt(DATA_KEY_SMS_ERROR_CODE, smsResponse.mErrorCode); } writeEvent(TAG_RIL_RESPONSE, rilRequest, rilSerial, b); break; } Loading