summaryrefslogtreecommitdiff
path: root/telephony
diff options
context:
space:
mode:
Diffstat (limited to 'telephony')
-rw-r--r--telephony/api/system-current.txt1
-rw-r--r--telephony/common/com/google/android/mms/pdu/PduComposer.java4
-rw-r--r--telephony/java/android/service/euicc/EuiccService.java5
-rwxr-xr-xtelephony/java/android/telephony/CarrierConfigManager.java41
-rw-r--r--telephony/java/android/telephony/ModemActivityInfo.java2
-rw-r--r--telephony/java/android/telephony/SmsMessage.java10
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java6
-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/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
13 files changed, 245 insertions, 27 deletions
diff --git a/telephony/api/system-current.txt b/telephony/api/system-current.txt
index 8ce4b0d158a3..d704398bcd30 100644
--- a/telephony/api/system-current.txt
+++ b/telephony/api/system-current.txt
@@ -641,7 +641,6 @@ package android.telephony {
}
public class SmsMessage {
- method @Nullable public static android.telephony.SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[], boolean);
method @Nullable public static android.telephony.SmsMessage.SubmitPdu getSmsPdu(int, int, @Nullable String, @NonNull String, @NonNull String, long);
method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public static byte[] getSubmitPduEncodedMessage(boolean, @NonNull String, @NonNull String, int, @IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0, to=255) int, @IntRange(from=1, to=255) int, @IntRange(from=1, to=255) int);
}
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/java/android/service/euicc/EuiccService.java b/telephony/java/android/service/euicc/EuiccService.java
index 93155865c166..ae2652e6c229 100644
--- a/telephony/java/android/service/euicc/EuiccService.java
+++ b/telephony/java/android/service/euicc/EuiccService.java
@@ -327,9 +327,8 @@ public abstract class EuiccService extends Service {
* @throws UnsupportedOperationException when sections has more than four layers (e.g 5.8.1.2)
* or when an number is bigger than 15
*/
- public int encodeSmdxSubjectAndReasonCode(@Nullable String subjectCode,
- @Nullable String reasonCode)
- throws NumberFormatException, IllegalArgumentException, UnsupportedOperationException {
+ public int encodeSmdxSubjectAndReasonCode(@NonNull String subjectCode,
+ @NonNull 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 327e8b344eeb..85d4ab33b9b2 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -328,6 +328,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.
*/
@@ -3559,6 +3587,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}.
*/
@@ -3669,6 +3706,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);
@@ -4104,6 +4143,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);
@@ -4362,6 +4402,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/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/SmsMessage.java b/telephony/java/android/telephony/SmsMessage.java
index e537f666d4c0..e7a92e8c4638 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) {
@@ -496,7 +493,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 2facd5a16bc8..54cc2440121c 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -988,11 +988,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/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java
index 05ab6bd75878..5569d3090b66 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/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();