summaryrefslogtreecommitdiff
path: root/telephony
diff options
context:
space:
mode:
Diffstat (limited to 'telephony')
-rw-r--r--telephony/api/system-current.txt79
-rw-r--r--telephony/common/com/google/android/mms/pdu/PduComposer.java4
-rw-r--r--telephony/framework-telephony-jarjar-rules.txt9
-rw-r--r--telephony/java/android/service/euicc/EuiccService.java3
-rwxr-xr-xtelephony/java/android/telephony/CarrierConfigManager.java41
-rw-r--r--telephony/java/android/telephony/DisconnectCause.java7
-rw-r--r--telephony/java/android/telephony/MbmsDownloadSession.java67
-rw-r--r--telephony/java/android/telephony/ModemActivityInfo.java2
-rw-r--r--telephony/java/android/telephony/NetworkRegistrationInfo.java4
-rw-r--r--telephony/java/android/telephony/PinResult.java6
-rw-r--r--telephony/java/android/telephony/SmsMessage.java27
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java6
-rw-r--r--telephony/java/android/telephony/ims/ImsCallSessionListener.java27
-rw-r--r--telephony/java/android/telephony/ims/RcsUceAdapter.java141
-rw-r--r--telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl3
-rw-r--r--telephony/java/android/telephony/ims/aidl/IRcsUcePublishStateCallback.aidl26
-rw-r--r--telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java3
-rw-r--r--telephony/java/android/telephony/mbms/MbmsErrors.java41
-rwxr-xr-xtelephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl2
-rw-r--r--telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java23
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneConstants.java1
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/SmsMessage.java16
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java13
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/SmsMessage.java4
24 files changed, 441 insertions, 114 deletions
diff --git a/telephony/api/system-current.txt b/telephony/api/system-current.txt
index 8ce4b0d158a3..73799dc5f006 100644
--- a/telephony/api/system-current.txt
+++ b/telephony/api/system-current.txt
@@ -179,85 +179,6 @@ package android.telephony {
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationInfo> CREATOR;
}
- public final class DisconnectCause {
- field public static final int ALREADY_DIALING = 72; // 0x48
- field public static final int ANSWERED_ELSEWHERE = 52; // 0x34
- field public static final int BUSY = 4; // 0x4
- field public static final int CALLING_DISABLED = 74; // 0x4a
- field public static final int CALL_BARRED = 20; // 0x14
- field public static final int CALL_PULLED = 51; // 0x33
- field public static final int CANT_CALL_WHILE_RINGING = 73; // 0x49
- field public static final int CDMA_ACCESS_BLOCKED = 35; // 0x23
- field public static final int CDMA_ACCESS_FAILURE = 32; // 0x20
- field public static final int CDMA_ALREADY_ACTIVATED = 49; // 0x31
- field public static final int CDMA_DROP = 27; // 0x1b
- field public static final int CDMA_INTERCEPT = 28; // 0x1c
- field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26; // 0x1a
- field public static final int CDMA_NOT_EMERGENCY = 34; // 0x22
- field public static final int CDMA_PREEMPTED = 33; // 0x21
- field public static final int CDMA_REORDER = 29; // 0x1d
- field public static final int CDMA_RETRY_ORDER = 31; // 0x1f
- field public static final int CDMA_SO_REJECT = 30; // 0x1e
- field public static final int CONGESTION = 5; // 0x5
- field public static final int CS_RESTRICTED = 22; // 0x16
- field public static final int CS_RESTRICTED_EMERGENCY = 24; // 0x18
- field public static final int CS_RESTRICTED_NORMAL = 23; // 0x17
- field public static final int DATA_DISABLED = 54; // 0x36
- field public static final int DATA_LIMIT_REACHED = 55; // 0x37
- field public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57; // 0x39
- field public static final int DIALED_MMI = 39; // 0x27
- field public static final int DIAL_LOW_BATTERY = 62; // 0x3e
- field public static final int DIAL_MODIFIED_TO_DIAL = 48; // 0x30
- field public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66; // 0x42
- field public static final int DIAL_MODIFIED_TO_SS = 47; // 0x2f
- field public static final int DIAL_MODIFIED_TO_USSD = 46; // 0x2e
- field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69; // 0x45
- field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70; // 0x46
- field public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67; // 0x43
- field public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68; // 0x44
- field public static final int EMERGENCY_PERM_FAILURE = 64; // 0x40
- field public static final int EMERGENCY_TEMP_FAILURE = 63; // 0x3f
- field public static final int ERROR_UNSPECIFIED = 36; // 0x24
- field public static final int FDN_BLOCKED = 21; // 0x15
- field public static final int ICC_ERROR = 19; // 0x13
- field public static final int IMEI_NOT_ACCEPTED = 58; // 0x3a
- field public static final int IMS_ACCESS_BLOCKED = 60; // 0x3c
- field public static final int IMS_MERGED_SUCCESSFULLY = 45; // 0x2d
- field public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71; // 0x47
- field public static final int INCOMING_AUTO_REJECTED = 81; // 0x51
- field public static final int INCOMING_MISSED = 1; // 0x1
- field public static final int INCOMING_REJECTED = 16; // 0x10
- field public static final int INVALID_CREDENTIALS = 10; // 0xa
- field public static final int INVALID_NUMBER = 7; // 0x7
- field public static final int LIMIT_EXCEEDED = 15; // 0xf
- field public static final int LOCAL = 3; // 0x3
- field public static final int LOST_SIGNAL = 14; // 0xe
- field public static final int LOW_BATTERY = 61; // 0x3d
- field public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53; // 0x35
- field public static final int MMI = 6; // 0x6
- field public static final int NORMAL = 2; // 0x2
- field public static final int NORMAL_UNSPECIFIED = 65; // 0x41
- field public static final int NOT_DISCONNECTED = 0; // 0x0
- field public static final int NOT_VALID = -1; // 0xffffffff
- field public static final int NO_PHONE_NUMBER_SUPPLIED = 38; // 0x26
- field public static final int NUMBER_UNREACHABLE = 8; // 0x8
- field public static final int OTASP_PROVISIONING_IN_PROCESS = 76; // 0x4c
- field public static final int OUTGOING_CANCELED = 44; // 0x2c
- field public static final int OUTGOING_EMERGENCY_CALL_PLACED = 80; // 0x50
- field public static final int OUTGOING_FAILURE = 43; // 0x2b
- field public static final int OUT_OF_NETWORK = 11; // 0xb
- field public static final int OUT_OF_SERVICE = 18; // 0x12
- field public static final int POWER_OFF = 17; // 0x11
- field public static final int SERVER_ERROR = 12; // 0xc
- field public static final int SERVER_UNREACHABLE = 9; // 0x9
- field public static final int TIMED_OUT = 13; // 0xd
- field public static final int TOO_MANY_ONGOING_CALLS = 75; // 0x4b
- field public static final int UNOBTAINABLE_NUMBER = 25; // 0x19
- field public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50; // 0x32
- field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
- field public static final int WIFI_LOST = 59; // 0x3b
- }
-
public final class ImsiEncryptionInfo implements android.os.Parcelable {
method public int describeContents();
method @Nullable public String getKeyIdentifier();
diff --git a/telephony/common/com/google/android/mms/pdu/PduComposer.java b/telephony/common/com/google/android/mms/pdu/PduComposer.java
index b8b212c493aa..5e1f556f4c4a 100644
--- a/telephony/common/com/google/android/mms/pdu/PduComposer.java
+++ b/telephony/common/com/google/android/mms/pdu/PduComposer.java
@@ -745,7 +745,9 @@ public class PduComposer {
return PDU_COMPOSE_CONTENT_ERROR;
}
- // X-Mms-Report-Allowed Optional (not support)
+ // X-Mms-Report-Allowed Optional
+ appendHeader(PduHeaders.REPORT_ALLOWED);
+
return PDU_COMPOSE_SUCCESS;
}
diff --git a/telephony/framework-telephony-jarjar-rules.txt b/telephony/framework-telephony-jarjar-rules.txt
new file mode 100644
index 000000000000..212eba153a15
--- /dev/null
+++ b/telephony/framework-telephony-jarjar-rules.txt
@@ -0,0 +1,9 @@
+rule android.telephony.Annotation* android.telephony.framework.Annotation@1
+rule android.util.RecurrenceRule* android.telephony.RecurrenceRule@1
+rule com.android.i18n.phonenumbers.** com.android.telephony.framework.phonenumbers.@1
+rule com.android.internal.os.SomeArgs* android.telephony.SomeArgs@1
+rule com.android.internal.util.BitwiseInputStream* android.telephony.BitwiseInputStream@1
+rule com.android.internal.util.BitwiseOutputStream* android.telephony.BitwiseOutputStream@1
+rule com.android.internal.util.Preconditions* android.telephony.Preconditions@1
+rule com.android.internal.util.IndentingPrintWriter* android.telephony.IndentingPrintWriter@1
+rule com.android.internal.util.HexDump* android.telephony.HexDump@1
diff --git a/telephony/java/android/service/euicc/EuiccService.java b/telephony/java/android/service/euicc/EuiccService.java
index 93155865c166..fcbb008c79b3 100644
--- a/telephony/java/android/service/euicc/EuiccService.java
+++ b/telephony/java/android/service/euicc/EuiccService.java
@@ -328,8 +328,7 @@ public abstract class EuiccService extends Service {
* or when an number is bigger than 15
*/
public int encodeSmdxSubjectAndReasonCode(@Nullable String subjectCode,
- @Nullable String reasonCode)
- throws NumberFormatException, IllegalArgumentException, UnsupportedOperationException {
+ @Nullable String reasonCode) {
final int maxSupportedSection = 3;
final int maxSupportedDigit = 15;
final int bitsPerSection = 4;
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 53aad2351a32..6d0677daeae2 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -354,6 +354,34 @@ public class CarrierConfigManager {
"only_auto_select_in_home_network";
/**
+ * Flag indicating whether to show single operator row in the choose network setting.
+ *
+ * The device configuration value {@code config_enableNewAutoSelectNetworkUI} ultimately
+ * controls whether this carrier configuration option is used. Where
+ * {@code config_enableNewAutoSelectNetworkUI} is false, the value of the
+ * {@link #KEY_SHOW_SINGLE_OPERATOR_ROW_IN_CHOOSE_NETWORK_SETTING_BOOL} carrier configuration
+ * option is ignored.
+ *
+ * If {@code true}, default value, merge the duplicate networks which with the same plmn, keep
+ * the one that with the higher signal strength level.
+ * If {@code false}, show all operators without merging.
+ * @hide
+ */
+ public static final String KEY_SHOW_SINGLE_OPERATOR_ROW_IN_CHOOSE_NETWORK_SETTING_BOOL =
+ "show_single_operator_row_in_choose_network_setting_bool";
+
+ /**
+ * Flag indicating whether to display SPN as network name for home network in choose
+ * network setting.
+ *
+ * If {@code true}, display SPN as network name in choose network setting.
+ * If {@code false}, display PLMN in choose network setting.
+ * @hide
+ */
+ public static final String KEY_SHOW_SPN_FOR_HOME_IN_CHOOSE_NETWORK_SETTING_BOOL =
+ "show_spn_for_home_in_choose_network_setting_bool";
+
+ /**
* Control whether users receive a simplified network settings UI and improved network
* selection.
*/
@@ -3750,6 +3778,15 @@ public class CarrierConfigManager {
"carrier_certificate_string_array";
/**
+ * Flag specifying whether the incoming call number should be formatted to national number
+ * for Japan. @return {@code true} convert to the national format, {@code false} otherwise.
+ * e.g. "+819012345678" -> "09012345678"
+ * @hide
+ */
+ public static final String KEY_FORMAT_INCOMING_NUMBER_TO_NATIONAL_FOR_JP_BOOL =
+ "format_incoming_number_to_national_for_jp_bool";
+
+ /**
* DisconnectCause array to play busy tone. Value should be array of
* {@link android.telephony.DisconnectCause}.
*/
@@ -3872,6 +3909,8 @@ public class CarrierConfigManager {
sDefaults.putBoolean(KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL, false);
sDefaults.putBoolean(KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL, false);
sDefaults.putBoolean(KEY_ONLY_AUTO_SELECT_IN_HOME_NETWORK_BOOL, false);
+ sDefaults.putBoolean(KEY_SHOW_SINGLE_OPERATOR_ROW_IN_CHOOSE_NETWORK_SETTING_BOOL, true);
+ sDefaults.putBoolean(KEY_SHOW_SPN_FOR_HOME_IN_CHOOSE_NETWORK_SETTING_BOOL, false);
sDefaults.putBoolean(KEY_SIMPLIFIED_NETWORK_SETTINGS_BOOL, false);
sDefaults.putBoolean(KEY_HIDE_SIM_LOCK_SETTINGS_BOOL, false);
@@ -4318,6 +4357,7 @@ public class CarrierConfigManager {
sDefaults.putBoolean(KEY_SUPPORT_WPS_OVER_IMS_BOOL, true);
sDefaults.putAll(Ims.getDefaults());
sDefaults.putStringArray(KEY_CARRIER_CERTIFICATE_STRING_ARRAY, null);
+ sDefaults.putBoolean(KEY_FORMAT_INCOMING_NUMBER_TO_NATIONAL_FOR_JP_BOOL, false);
sDefaults.putIntArray(KEY_DISCONNECT_CAUSE_PLAY_BUSYTONE_INT_ARRAY,
new int[] {4 /* BUSY */});
sDefaults.putBoolean(KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL, false);
@@ -4580,6 +4620,7 @@ public class CarrierConfigManager {
} catch (RemoteException ex) {
Rlog.e(TAG, "getDefaultCarrierServicePackageName ICarrierConfigLoader is null"
+ ex.toString());
+ ex.rethrowAsRuntimeException();
}
return "";
}
diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java
index be85b30f272b..2704418935d9 100644
--- a/telephony/java/android/telephony/DisconnectCause.java
+++ b/telephony/java/android/telephony/DisconnectCause.java
@@ -17,16 +17,14 @@
package android.telephony;
import android.annotation.NonNull;
-import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
/**
* Describes the cause of a disconnected call. Those disconnect causes can be converted into a more
* generic {@link android.telecom.DisconnectCause} object.
*
- * @hide
+ * Used in {@link PhoneStateListener#onCallDisconnectCauseChanged}.
*/
-@SystemApi
public final class DisconnectCause {
/** The disconnect cause is not valid (Not received a disconnect cause) */
@@ -337,20 +335,17 @@ public final class DisconnectCause {
/**
* Indicates that the call is dropped due to RTCP inactivity, primarily due to media path
* disruption.
- * @hide
*/
public static final int MEDIA_TIMEOUT = 77;
/**
* Indicates that an emergency call cannot be placed over WFC because the service is not
* available in the current location.
- * @hide
*/
public static final int EMERGENCY_CALL_OVER_WFC_NOT_AVAILABLE = 78;
/**
* Indicates that WiFi calling service is not available in the current location.
- * @hide
*/
public static final int WFC_SERVICE_NOT_AVAILABLE_IN_THIS_LOCATION = 79;
diff --git a/telephony/java/android/telephony/MbmsDownloadSession.java b/telephony/java/android/telephony/MbmsDownloadSession.java
index 45deea206cfc..3f671ca2d809 100644
--- a/telephony/java/android/telephony/MbmsDownloadSession.java
+++ b/telephony/java/android/telephony/MbmsDownloadSession.java
@@ -231,6 +231,8 @@ public class MbmsDownloadSession implements AutoCloseable {
private static final String DESTINATION_SANITY_CHECK_FILE_NAME = "destinationSanityCheckFile";
+ private static final int MAX_SERVICE_ANNOUNCEMENT_SIZE = 10 * 1024; // 10KB
+
private static AtomicBoolean sIsInitialized = new AtomicBoolean(false);
private final Context mContext;
@@ -318,6 +320,16 @@ public class MbmsDownloadSession implements AutoCloseable {
return session;
}
+ /**
+ * Returns the maximum size of the service announcement descriptor that can be provided via
+ * {@link #addServiceAnnouncement}
+ * @return The maximum length of the byte array passed as an argument to
+ * {@link #addServiceAnnouncement}.
+ */
+ public static int getMaximumServiceAnnouncementSize() {
+ return MAX_SERVICE_ANNOUNCEMENT_SIZE;
+ }
+
private int bindAndInitialize() {
mServiceConnection = new ServiceConnection() {
@Override
@@ -424,6 +436,61 @@ public class MbmsDownloadSession implements AutoCloseable {
}
/**
+ * Inform the middleware of a service announcement descriptor received from a group
+ * communication server.
+ *
+ * When participating in a group call via the {@link MbmsGroupCallSession} API, applications may
+ * receive a service announcement descriptor from the group call server that informs them of
+ * files that may be relevant to users communicating on the group call.
+ *
+ * After supplying the service announcement descriptor received from the server to the
+ * middleware via this API, applications will receive information on the available files via
+ * {@link MbmsDownloadSessionCallback#onFileServicesUpdated}, and the available files will be
+ * downloadable via {@link MbmsDownloadSession#download} like other files published via
+ * {@link MbmsDownloadSessionCallback#onFileServicesUpdated}.
+ *
+ * Asynchronous error codes via the {@link MbmsDownloadSessionCallback#onError(int, String)}
+ * callback may include any of the errors that are not specific to the streaming use-case.
+ *
+ * May throw an {@link IllegalStateException} when the middleware has not yet been bound,
+ * or an {@link IllegalArgumentException} if the byte array is too large, or an
+ * {@link UnsupportedOperationException} if the middleware has not implemented this method.
+ *
+ * @param contents The contents of the service announcement descriptor received from the
+ * group call server. If the size of this array is greater than the value of
+ * {@link #getMaximumServiceAnnouncementSize()}, an
+ * {@link IllegalArgumentException} will be thrown.
+ */
+ public void addServiceAnnouncement(@NonNull byte[] contents) {
+ IMbmsDownloadService downloadService = mService.get();
+ if (downloadService == null) {
+ throw new IllegalStateException("Middleware not yet bound");
+ }
+
+ if (contents.length > MAX_SERVICE_ANNOUNCEMENT_SIZE) {
+ throw new IllegalArgumentException("File too large");
+ }
+
+ try {
+ int returnCode = downloadService.addServiceAnnouncement(
+ mSubscriptionId, contents);
+ if (returnCode == MbmsErrors.UNKNOWN) {
+ // Unbind and throw an obvious error
+ close();
+ throw new IllegalStateException("Middleware must not return an unknown error code");
+ }
+ if (returnCode != MbmsErrors.SUCCESS) {
+ sendErrorToApp(returnCode, null);
+ }
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, "Remote process died");
+ mService.set(null);
+ sIsInitialized.set(false);
+ sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
+ }
+ }
+
+ /**
* Sets the temp file root for downloads.
* All temp files created for the middleware to write to will be contained in the specified
* directory. Applications that wish to specify a location only need to call this method once
diff --git a/telephony/java/android/telephony/ModemActivityInfo.java b/telephony/java/android/telephony/ModemActivityInfo.java
index 2b72ab7635c3..debb119c94bc 100644
--- a/telephony/java/android/telephony/ModemActivityInfo.java
+++ b/telephony/java/android/telephony/ModemActivityInfo.java
@@ -234,7 +234,7 @@ public final class ModemActivityInfo implements Parcelable {
}
/**
- * Indicate if the ModemActivityInfo is invalid due to modem's invalid reporting.
+ * Indicates if the modem has reported valid {@link ModemActivityInfo}.
*
* @return {@code true} if this {@link ModemActivityInfo} record is valid,
* {@code false} otherwise.
diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java
index 93fbb00ff9d5..31a83c9334d5 100644
--- a/telephony/java/android/telephony/NetworkRegistrationInfo.java
+++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java
@@ -389,7 +389,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
}
/**
- * @return {@code true} if registered on roaming network, {@code false} otherwise.
+ * @return {@code true} if registered on roaming or home network, {@code false} otherwise.
*/
public boolean isRegistered() {
return mRegistrationState == REGISTRATION_STATE_HOME
@@ -397,7 +397,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
}
/**
- * @return {@code true} if registered on roaming network, {@code false} otherwise.
+ * @return {@code true} if searching for service, {@code false} otherwise.
*/
public boolean isSearching() {
return mRegistrationState == REGISTRATION_STATE_NOT_REGISTERED_SEARCHING;
diff --git a/telephony/java/android/telephony/PinResult.java b/telephony/java/android/telephony/PinResult.java
index 98d6448e77ea..c2a4f33e95b9 100644
--- a/telephony/java/android/telephony/PinResult.java
+++ b/telephony/java/android/telephony/PinResult.java
@@ -37,6 +37,7 @@ public final class PinResult implements Parcelable {
PIN_RESULT_TYPE_SUCCESS,
PIN_RESULT_TYPE_INCORRECT,
PIN_RESULT_TYPE_FAILURE,
+ PIN_RESULT_TYPE_ABORTED,
})
public @interface PinResultType {}
@@ -55,6 +56,11 @@ public final class PinResult implements Parcelable {
*/
public static final int PIN_RESULT_TYPE_FAILURE = PhoneConstants.PIN_GENERAL_FAILURE;
+ /**
+ * Indicates that the pin attempt was aborted.
+ */
+ public static final int PIN_RESULT_TYPE_ABORTED = PhoneConstants.PIN_OPERATION_ABORTED;
+
private static final PinResult sFailedResult =
new PinResult(PinResult.PIN_RESULT_TYPE_FAILURE, -1);
diff --git a/telephony/java/android/telephony/SmsMessage.java b/telephony/java/android/telephony/SmsMessage.java
index e537f666d4c0..347dcc81ce4e 100644
--- a/telephony/java/android/telephony/SmsMessage.java
+++ b/telephony/java/android/telephony/SmsMessage.java
@@ -321,12 +321,9 @@ public class SmsMessage {
* @param data Message data.
* @param isCdma Indicates weather the type of the SMS is CDMA.
* @return An SmsMessage representing the message.
- *
- * @hide
*/
- @SystemApi
@Nullable
- public static SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) {
+ public static SmsMessage createSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) {
SmsMessageBase wrappedMessage;
if (isCdma) {
@@ -342,6 +339,23 @@ public class SmsMessage {
}
/**
+ * Create an SmsMessage from a native SMS-Submit PDU, specified by Bluetooth Message Access
+ * Profile Specification v1.4.2 5.8.
+ * This is used by Bluetooth MAP profile to decode message when sending non UTF-8 SMS messages.
+ *
+ * @param data Message data.
+ * @param isCdma Indicates weather the type of the SMS is CDMA.
+ * @return An SmsMessage representing the message.
+ *
+ * @hide
+ */
+ @SystemApi
+ @Nullable
+ public static SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) {
+ return null;
+ }
+
+ /**
* Get the TP-Layer-Length for the given SMS-SUBMIT PDU Basically, the
* length in bytes (not hex chars) less the SMSC header
*
@@ -496,7 +510,10 @@ public class SmsMessage {
String newMsgBody = null;
Resources r = Resources.getSystem();
if (r.getBoolean(com.android.internal.R.bool.config_sms_force_7bit_encoding)) {
- newMsgBody = Sms7BitEncodingTranslator.translate(text, isCdma);
+ // 7-bit ASCII table based translation is required only for CDMA single-part SMS since
+ // ENCODING_7BIT_ASCII is used for CDMA single-part SMS and ENCODING_GSM_7BIT_ALPHABET
+ // is used for CDMA multi-part SMS.
+ newMsgBody = Sms7BitEncodingTranslator.translate(text, isCdma && ted.msgCount == 1);
}
if (TextUtils.isEmpty(newMsgBody)) {
newMsgBody = text;
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index e9ee06c246ba..4ad52ae5e077 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -1111,11 +1111,15 @@ public class SubscriptionManager {
* individual records themselves. When a change occurs the onSubscriptionsChanged method of
* the listener will be invoked immediately if there has been a notification. The
* onSubscriptionChanged method will also be triggered once initially when calling this
- * function.
+ * function. The callback will be invoked on the looper specified in the listener's constructor.
*
* @param listener an instance of {@link OnSubscriptionsChangedListener} with
* onSubscriptionsChanged overridden.
+ *
+ * @deprecated Will get exception if the parameter listener is not initialized with a Looper.
+ * Use {@link #addOnSubscriptionsChangedListener(Executor, OnSubscriptionsChangedListener)}.
*/
+ @Deprecated
public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) {
if (listener == null) return;
addOnSubscriptionsChangedListener(listener.mExecutor, listener);
diff --git a/telephony/java/android/telephony/ims/ImsCallSessionListener.java b/telephony/java/android/telephony/ims/ImsCallSessionListener.java
index 81af99fb40b7..d21a05103241 100644
--- a/telephony/java/android/telephony/ims/ImsCallSessionListener.java
+++ b/telephony/java/android/telephony/ims/ImsCallSessionListener.java
@@ -683,5 +683,32 @@ public class ImsCallSessionListener {
e.rethrowFromSystemServer();
}
}
+
+ /**
+ * Notifies the result of transfer request.
+ * @hide
+ */
+ public void callSessionTransferred() {
+ try {
+ mListener.callSessionTransferred();
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Notifies the result of transfer request.
+ *
+ * @param reasonInfo {@link ImsReasonInfo} containing a reason for the
+ * session transfer failure
+ * @hide
+ */
+ public void callSessionTransferFailed(ImsReasonInfo reasonInfo) {
+ try {
+ mListener.callSessionTransferFailed(reasonInfo);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
}
diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java
index ec112790a144..a427d056f915 100644
--- a/telephony/java/android/telephony/ims/RcsUceAdapter.java
+++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java
@@ -31,7 +31,7 @@ import android.os.RemoteException;
import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.ims.aidl.IImsRcsController;
import android.telephony.ims.aidl.IRcsUceControllerCallback;
-import android.telephony.ims.feature.RcsFeature;
+import android.telephony.ims.aidl.IRcsUcePublishStateCallback;
import android.util.Log;
import java.lang.annotation.Retention;
@@ -185,6 +185,58 @@ public class RcsUceAdapter {
})
public @interface PublishState {}
+ /**
+ * An application can use {@link #registerPublishStateCallback} to register a
+ * {@link PublishStateCallback), which will notify the user when the publish state to the
+ * network changes.
+ * @hide
+ */
+ public static class PublishStateCallback {
+
+ private static class PublishStateBinder extends IRcsUcePublishStateCallback.Stub {
+
+ private final PublishStateCallback mLocalCallback;
+ private Executor mExecutor;
+
+ PublishStateBinder(PublishStateCallback c) {
+ mLocalCallback = c;
+ }
+
+ @Override
+ public void onPublishStateChanged(int publishState) {
+ if (mLocalCallback == null) return;
+
+ long callingIdentity = Binder.clearCallingIdentity();
+ try {
+ mExecutor.execute(() -> mLocalCallback.onChanged(publishState));
+ } finally {
+ restoreCallingIdentity(callingIdentity);
+ }
+ }
+
+ private void setExecutor(Executor executor) {
+ mExecutor = executor;
+ }
+ }
+
+ private final PublishStateBinder mBinder = new PublishStateBinder(this);
+
+ /**@hide*/
+ public final IRcsUcePublishStateCallback getBinder() {
+ return mBinder;
+ }
+
+ private void setExecutor(Executor executor) {
+ mBinder.setExecutor(executor);
+ }
+
+ /**
+ * Notifies the callback when the publish state has changed.
+ * @param publishState The latest update to the publish state.
+ */
+ public void onChanged(@PublishState int publishState) {
+ }
+ }
/**
* Provides a one-time callback for the response to a UCE request. After this callback is called
@@ -321,6 +373,8 @@ public class RcsUceAdapter {
try {
return imsRcsController.getUcePublishState(mSubId);
+ } catch (android.os.ServiceSpecificException e) {
+ throw new ImsException(e.getMessage(), e.errorCode);
} catch (RemoteException e) {
Log.e(TAG, "Error calling IImsRcsController#getUcePublishState", e);
throw new ImsException("Remote IMS Service is not available",
@@ -329,6 +383,91 @@ public class RcsUceAdapter {
}
/**
+ * Registers a {@link PublishStateCallback} with the system, which will provide publish state
+ * updates for the subscription specified in {@link ImsManager@getRcsManager(subid)}.
+ * <p>
+ * Use {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to subscription
+ * changed events and call {@link #unregisterPublishStateCallback} to clean up.
+ * <p>
+ * The registered {@link PublishStateCallback} will also receive a callback when it is
+ * registered with the current publish state.
+ *
+ * @param executor The executor the listener callback events should be run on.
+ * @param c The {@link PublishStateCallback} to be added.
+ * @throws ImsException if the subscription associated with this callback is valid, but
+ * the {@link ImsService} associated with the subscription is not available. This can happen if
+ * the service crashed, for example. See {@link ImsException#getCode()} for a more detailed
+ * reason.
+ * @hide
+ */
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public void registerPublishStateCallback(@NonNull @CallbackExecutor Executor executor,
+ @NonNull PublishStateCallback c) throws ImsException {
+ if (c == null) {
+ throw new IllegalArgumentException("Must include a non-null PublishStateCallback.");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
+ }
+
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "registerPublishStateCallback : IImsRcsController is null");
+ throw new ImsException("Cannot find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
+ c.setExecutor(executor);
+ try {
+ imsRcsController.registerUcePublishStateCallback(mSubId, c.getBinder());
+ } catch (android.os.ServiceSpecificException e) {
+ throw new ImsException(e.getMessage(), e.errorCode);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#registerUcePublishStateCallback", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+ }
+
+ /**
+ * Removes an existing {@link PublishStateCallback}.
+ * <p>
+ * When the subscription associated with this callback is removed
+ * (SIM removed, ESIM swap,etc...), this callback will automatically be removed. If this method
+ * is called for an inactive subscription, it will result in a no-op.
+ *
+ * @param c The callback to be unregistered.
+ * @throws ImsException if the subscription associated with this callback is valid, but
+ * the {@link ImsService} associated with the subscription is not available. This can happen if
+ * the service crashed, for example. See {@link ImsException#getCode()} for a more detailed
+ * reason.
+ * @hide
+ */
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public void unregisterPublishStateCallback(@NonNull PublishStateCallback c)
+ throws ImsException {
+ if (c == null) {
+ throw new IllegalArgumentException("Must include a non-null PublishStateCallback.");
+ }
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "unregisterPublishStateCallback: IImsRcsController is null");
+ throw new ImsException("Cannot find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
+ try {
+ imsRcsController.unregisterUcePublishStateCallback(mSubId, c.getBinder());
+ } catch (android.os.ServiceSpecificException e) {
+ throw new ImsException(e.getMessage(), e.errorCode);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#unregisterUcePublishStateCallback", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+ }
+
+ /**
* The user’s setting for whether or not User Capability Exchange (UCE) is enabled for the
* associated subscription.
* <p>
diff --git a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
index 483c66eedc0c..9e461420e126 100644
--- a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
+++ b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
@@ -19,6 +19,7 @@ package android.telephony.ims.aidl;
import android.net.Uri;
import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.aidl.IRcsUceControllerCallback;
+import android.telephony.ims.aidl.IRcsUcePublishStateCallback;
import android.telephony.ims.aidl.IImsRegistrationCallback;
import com.android.internal.telephony.IIntegerConsumer;
@@ -47,4 +48,6 @@ interface IImsRcsController {
int getUcePublishState(int subId);
boolean isUceSettingEnabled(int subId, String callingPackage, String callingFeatureId);
void setUceSettingEnabled(int subId, boolean isEnabled);
+ void registerUcePublishStateCallback(int subId, IRcsUcePublishStateCallback c);
+ void unregisterUcePublishStateCallback(int subId, IRcsUcePublishStateCallback c);
}
diff --git a/telephony/java/android/telephony/ims/aidl/IRcsUcePublishStateCallback.aidl b/telephony/java/android/telephony/ims/aidl/IRcsUcePublishStateCallback.aidl
new file mode 100644
index 000000000000..b6e84154f80f
--- /dev/null
+++ b/telephony/java/android/telephony/ims/aidl/IRcsUcePublishStateCallback.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2020 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.ims.aidl;
+
+/**
+ * Interface for RCS UCE publish state change callbacks.
+ *
+ * {@hide}
+ */
+oneway interface IRcsUcePublishStateCallback {
+ void onPublishStateChanged(int publishState);
+}
diff --git a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java
index ce9a73a21657..a9a33c0e1507 100644
--- a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java
@@ -403,8 +403,7 @@ public class ImsSmsImplBase {
message.mWrappedSmsMessage.mMessageRef,
STATUS_REPORT_STATUS_ERROR);
} else {
- Log.w(LOG_TAG,
- "onSmsStatusReportReceivedWithoutMessageRef: Invalid pdu entered.");
+ Log.w(LOG_TAG, "onSmsStatusReportReceived: Invalid pdu entered.");
acknowledgeSmsReport(token, 0, STATUS_REPORT_STATUS_ERROR);
}
}
diff --git a/telephony/java/android/telephony/mbms/MbmsErrors.java b/telephony/java/android/telephony/mbms/MbmsErrors.java
index 52e4d333b29d..40f3ae82d778 100644
--- a/telephony/java/android/telephony/mbms/MbmsErrors.java
+++ b/telephony/java/android/telephony/mbms/MbmsErrors.java
@@ -16,8 +16,12 @@
package android.telephony.mbms;
+import android.annotation.IntDef;
import android.telephony.MbmsStreamingSession;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
public class MbmsErrors {
/**
* Indicates that the middleware has sent an error code that is not defined in the version of
@@ -138,6 +142,13 @@ public class MbmsErrors {
/** Indicates the the middleware has no record of the supplied {@link FileInfo} */
public static final int ERROR_UNKNOWN_FILE_INFO = 403;
+
+ /**
+ * Indicates that the service announcement descriptor passed via
+ * {@link android.telephony.MbmsDownloadSession#addServiceAnnouncement(byte[])}
+ * is malformed.
+ */
+ public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT = 404;
}
/**
@@ -156,5 +167,35 @@ public class MbmsErrors {
public static final int ERROR_DUPLICATE_START_GROUP_CALL = 502;
}
+ /** @hide */
+ @IntDef(value = {
+ SUCCESS,
+ ERROR_NO_UNIQUE_MIDDLEWARE,
+ ERROR_MIDDLEWARE_NOT_BOUND,
+ ERROR_MIDDLEWARE_LOST,
+ InitializationErrors.ERROR_DUPLICATE_INITIALIZE,
+ InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED,
+ InitializationErrors.ERROR_UNABLE_TO_INITIALIZE,
+ GeneralErrors.ERROR_MIDDLEWARE_NOT_YET_READY,
+ GeneralErrors.ERROR_OUT_OF_MEMORY,
+ GeneralErrors.ERROR_MIDDLEWARE_TEMPORARILY_UNAVAILABLE,
+ GeneralErrors.ERROR_IN_E911,
+ GeneralErrors.ERROR_NOT_CONNECTED_TO_HOME_CARRIER_LTE,
+ GeneralErrors.ERROR_UNABLE_TO_READ_SIM,
+ GeneralErrors.ERROR_CARRIER_CHANGE_NOT_ALLOWED,
+ StreamingErrors.ERROR_CONCURRENT_SERVICE_LIMIT_REACHED,
+ StreamingErrors.ERROR_UNABLE_TO_START_SERVICE,
+ StreamingErrors.ERROR_DUPLICATE_START_STREAM,
+ DownloadErrors.ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT,
+ DownloadErrors.ERROR_UNKNOWN_DOWNLOAD_REQUEST,
+ DownloadErrors.ERROR_UNKNOWN_FILE_INFO,
+ DownloadErrors.ERROR_MALFORMED_SERVICE_ANNOUNCEMENT,
+ GroupCallErrors.ERROR_UNABLE_TO_START_SERVICE,
+ GroupCallErrors.ERROR_DUPLICATE_START_GROUP_CALL,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface MbmsError {
+ }
+
private MbmsErrors() {}
}
diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
index 445087fb78d5..04efd53eb743 100755
--- a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
+++ b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
@@ -35,6 +35,8 @@ interface IMbmsDownloadService
int setTempFileRootDirectory(int subId, String rootDirectoryPath);
+ int addServiceAnnouncement(int subId, in byte[] contents);
+
int download(in DownloadRequest downloadRequest);
int addStatusListener(in DownloadRequest downloadRequest,
diff --git a/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
index 9f22d0a49806..3053ea03bebe 100644
--- a/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
+++ b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
@@ -216,6 +216,29 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
}
/**
+ * Called when the client application wishes to receive file information according to a
+ * service announcement descriptor received from a group call server.
+ *
+ * The service announcement descriptor is in the format of a multipart MIME file with XML parts,
+ * though no validation is performed on the contents of the {@code contents} argument --
+ * implementing middleware applications should perform their own validation and return
+ * {@link MbmsErrors.DownloadErrors#ERROR_MALFORMED_SERVICE_ANNOUNCEMENT} if the descriptor is
+ * malformed.
+ *
+ * @param subscriptionId The subscription id the service announcement applies to.
+ * @param contents The contents of the service announcement descriptor.
+ * @return {@link MbmsErrors#SUCCESS}, or
+ * {@link MbmsErrors.DownloadErrors#ERROR_MALFORMED_SERVICE_ANNOUNCEMENT}
+ */
+ // TODO: are there any public specifications of what the file format is that I can link to?
+ @Override
+ public @MbmsErrors.MbmsError int addServiceAnnouncement(
+ int subscriptionId, @NonNull byte[] contents) {
+ throw new UnsupportedOperationException("addServiceAnnouncement not supported by"
+ + " this middleware.");
+ }
+
+ /**
* Issues a request to download a set of files.
*
* The middleware should expect that {@link #setTempFileRootDirectory(int, String)} has been
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index 4d677545bc39..151187c5071f 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -108,6 +108,7 @@ public class PhoneConstants {
public static final int PIN_RESULT_SUCCESS = 0;
public static final int PIN_PASSWORD_INCORRECT = 1;
public static final int PIN_GENERAL_FAILURE = 2;
+ public static final int PIN_OPERATION_ABORTED = 3;
/**
* Return codes for <code>enableApnType()</code>
diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
index 6ed0be24a0f1..542e08d743ab 100644
--- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
@@ -17,7 +17,7 @@
package com.android.internal.telephony.cdma;
import android.compat.annotation.UnsupportedAppUsage;
-import android.content.res.Resources;
+import android.os.Build;
import android.sysprop.TelephonyProperties;
import android.telephony.PhoneNumberUtils;
import android.telephony.SmsCbLocation;
@@ -27,7 +27,6 @@ import android.text.TextUtils;
import android.util.Log;
import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
-import com.android.internal.telephony.Sms7BitEncodingTranslator;
import com.android.internal.telephony.SmsAddress;
import com.android.internal.telephony.SmsConstants;
import com.android.internal.telephony.SmsHeader;
@@ -156,7 +155,8 @@ public class SmsMessage extends SmsMessageBase {
*
* @hide
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link "
+ + "android.telephony.SmsMessage} API instead")
public static SmsMessage createFromEfRecord(int index, byte[] data) {
try {
SmsMessage msg = new SmsMessage();
@@ -414,15 +414,7 @@ public class SmsMessage extends SmsMessageBase {
@UnsupportedAppUsage
public static TextEncodingDetails calculateLength(CharSequence messageBody,
boolean use7bitOnly, boolean isEntireMsg) {
- CharSequence newMsgBody = null;
- Resources r = Resources.getSystem();
- if (r.getBoolean(com.android.internal.R.bool.config_sms_force_7bit_encoding)) {
- newMsgBody = Sms7BitEncodingTranslator.translate(messageBody, true /* isCdmaFormat */);
- }
- if (TextUtils.isEmpty(newMsgBody)) {
- newMsgBody = messageBody;
- }
- return BearerData.calcTextEncodingDetails(newMsgBody, use7bitOnly, isEntireMsg);
+ return BearerData.calcTextEncodingDetails(messageBody, use7bitOnly, isEntireMsg);
}
/**
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
index c074e6e9a438..4fbafb78fe3c 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
@@ -21,9 +21,11 @@ import android.content.res.Resources;
import android.telephony.SmsCbCmasInfo;
import android.telephony.cdma.CdmaSmsCbProgramData;
import android.telephony.cdma.CdmaSmsCbProgramResults;
+import android.text.TextUtils;
import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
+import com.android.internal.telephony.Sms7BitEncodingTranslator;
import com.android.internal.telephony.SmsConstants;
import com.android.internal.telephony.SmsHeader;
import com.android.internal.telephony.SmsMessageBase;
@@ -540,8 +542,17 @@ public final class BearerData {
*/
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,
boolean force7BitEncoding, boolean isEntireMsg) {
+ CharSequence newMsg = null;
+ Resources r = Resources.getSystem();
+ if (r.getBoolean(com.android.internal.R.bool.config_sms_force_7bit_encoding)) {
+ newMsg = Sms7BitEncodingTranslator.translate(msg, true /* isCdmaFormat */);
+ }
+ if (TextUtils.isEmpty(newMsg)) {
+ newMsg = msg;
+ }
+
TextEncodingDetails ted;
- int septets = countAsciiSeptets(msg, force7BitEncoding);
+ int septets = countAsciiSeptets(newMsg, force7BitEncoding);
if (septets != -1 && septets <= SmsConstants.MAX_USER_DATA_SEPTETS) {
ted = new TextEncodingDetails();
ted.msgCount = 1;
diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
index 08580012ad17..ccb14749109d 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
@@ -27,6 +27,7 @@ import static com.android.internal.telephony.SmsConstants.MessageClass;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.res.Resources;
+import android.os.Build;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
@@ -178,7 +179,8 @@ public class SmsMessage extends SmsMessageBase {
*
* @hide
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link "
+ + "android.telephony.SmsMessage} API instead")
public static SmsMessage createFromEfRecord(int index, byte[] data) {
try {
SmsMessage msg = new SmsMessage();