summaryrefslogtreecommitdiff
path: root/telephony
diff options
context:
space:
mode:
Diffstat (limited to 'telephony')
-rw-r--r--telephony/common/com/android/internal/telephony/SmsApplication.java31
-rw-r--r--telephony/java/android/telephony/AccessNetworkConstants.java3
-rw-r--r--telephony/java/android/telephony/AnomalyReporter.java16
-rw-r--r--telephony/java/android/telephony/DataFailCause.java7
-rw-r--r--telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java8
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java14
-rw-r--r--telephony/java/android/telephony/UiccSlotInfo.java2
-rw-r--r--telephony/java/android/telephony/data/ApnSetting.java12
-rw-r--r--telephony/java/android/telephony/ims/ImsMmTelManager.java7
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyIntents.java20
10 files changed, 87 insertions, 33 deletions
diff --git a/telephony/common/com/android/internal/telephony/SmsApplication.java b/telephony/common/com/android/internal/telephony/SmsApplication.java
index 4924a82c385f..423022599de6 100644
--- a/telephony/common/com/android/internal/telephony/SmsApplication.java
+++ b/telephony/common/com/android/internal/telephony/SmsApplication.java
@@ -1146,4 +1146,35 @@ public final class SmsApplication {
}
return null;
}
+
+ /**
+ * Check if a package is default mms app (or equivalent, like bluetooth)
+ *
+ * @param context context from the calling app
+ * @param packageName the name of the package to be checked
+ * @return true if the package is default mms app or bluetooth
+ */
+ @UnsupportedAppUsage
+ public static boolean isDefaultMmsApplication(Context context, String packageName) {
+ if (packageName == null) {
+ return false;
+ }
+ String defaultMmsPackage = getDefaultMmsApplicationPackageName(context);
+ String bluetoothPackageName = context.getResources()
+ .getString(com.android.internal.R.string.config_systemBluetoothStack);
+
+ if ((defaultMmsPackage != null && defaultMmsPackage.equals(packageName))
+ || bluetoothPackageName.equals(packageName)) {
+ return true;
+ }
+ return false;
+ }
+
+ private static String getDefaultMmsApplicationPackageName(Context context) {
+ ComponentName component = getDefaultMmsApplication(context, false);
+ if (component != null) {
+ return component.getPackageName();
+ }
+ return null;
+ }
}
diff --git a/telephony/java/android/telephony/AccessNetworkConstants.java b/telephony/java/android/telephony/AccessNetworkConstants.java
index 7eec86a40c13..0fdf40d99c94 100644
--- a/telephony/java/android/telephony/AccessNetworkConstants.java
+++ b/telephony/java/android/telephony/AccessNetworkConstants.java
@@ -23,6 +23,7 @@ import android.hardware.radio.V1_5.AccessNetwork;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.Locale;
/**
* Contains access network related constants.
@@ -114,7 +115,7 @@ public final class AccessNetworkConstants {
/** @hide */
public static @RadioAccessNetworkType int fromString(@NonNull String str) {
- switch (str.toUpperCase()) {
+ switch (str.toUpperCase(Locale.ROOT)) {
case "UNKNOWN": return UNKNOWN;
case "GERAN": return GERAN;
case "UTRAN": return UTRAN;
diff --git a/telephony/java/android/telephony/AnomalyReporter.java b/telephony/java/android/telephony/AnomalyReporter.java
index e7d95e4f53b3..061b71b25275 100644
--- a/telephony/java/android/telephony/AnomalyReporter.java
+++ b/telephony/java/android/telephony/AnomalyReporter.java
@@ -27,6 +27,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.ParcelUuid;
+import android.provider.DeviceConfig;
import com.android.internal.telephony.TelephonyStatsLog;
import com.android.internal.util.IndentingPrintWriter;
@@ -57,6 +58,9 @@ import java.util.concurrent.ConcurrentHashMap;
public final class AnomalyReporter {
private static final String TAG = "AnomalyReporter";
+ private static final String KEY_IS_TELEPHONY_ANOMALY_REPORT_ENABLED =
+ "is_telephony_anomaly_report_enabled";
+
private static Context sContext = null;
private static Map<UUID, Integer> sEvents = new ConcurrentHashMap<>();
@@ -106,6 +110,18 @@ public final class AnomalyReporter {
return;
}
+ // Don't report if the server-side flag isn't loaded, as it implies other anomaly report
+ // related config hasn't loaded.
+ try {
+ boolean isAnomalyReportEnabledFromServer = DeviceConfig.getBoolean(
+ DeviceConfig.NAMESPACE_TELEPHONY, KEY_IS_TELEPHONY_ANOMALY_REPORT_ENABLED,
+ false);
+ if (!isAnomalyReportEnabledFromServer) return;
+ } catch (Exception e) {
+ Rlog.w(TAG, "Unable to read device config, dropping event=" + eventId);
+ return;
+ }
+
TelephonyStatsLog.write(
TELEPHONY_ANOMALY_DETECTED,
carrierId,
diff --git a/telephony/java/android/telephony/DataFailCause.java b/telephony/java/android/telephony/DataFailCause.java
index 5f7cfd109ec9..23835a7732cf 100644
--- a/telephony/java/android/telephony/DataFailCause.java
+++ b/telephony/java/android/telephony/DataFailCause.java
@@ -125,6 +125,12 @@ public final class DataFailCause {
public static final int UNSUPPORTED_QCI_VALUE = 0x3B;
/** Procedure requested by the UE was rejected because the bearer handling is not supported. */
public static final int BEARER_HANDLING_NOT_SUPPORTED = 0x3C;
+ /**
+ * This cause is used to report a service or option not available event only when no other
+ * cause in the service or option not available class applies.
+ * @hide // TODO: Unhide in U.
+ */
+ public static final int SERVICE_OR_OPTION_NOT_AVAILABLE = 0x3F;
/** Max number of Packet Data Protocol (PDP) context reached. */
public static final int ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED = 0x41;
/** Unsupported APN in current public land mobile network (PLMN). */
@@ -1142,6 +1148,7 @@ public final class DataFailCause {
sFailCauseMap.put(ONLY_NON_IP_ALLOWED, "ONLY_NON_IP_ALLOWED");
sFailCauseMap.put(UNSUPPORTED_QCI_VALUE, "UNSUPPORTED_QCI_VALUE");
sFailCauseMap.put(BEARER_HANDLING_NOT_SUPPORTED, "BEARER_HANDLING_NOT_SUPPORTED");
+ sFailCauseMap.put(SERVICE_OR_OPTION_NOT_AVAILABLE, "SERVICE_OR_OPTION_NOT_AVAILABLE");
sFailCauseMap.put(ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED,
"ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED");
sFailCauseMap.put(UNSUPPORTED_APN_IN_CURRENT_PLMN,
diff --git a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java
index 24dfbd028d03..a004cc3a1642 100644
--- a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java
+++ b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java
@@ -21,6 +21,7 @@ import android.os.Build;
import android.text.Editable;
import android.text.Selection;
import android.text.TextWatcher;
+import android.text.style.TtsSpan;
import com.android.i18n.phonenumbers.AsYouTypeFormatter;
import com.android.i18n.phonenumbers.PhoneNumberUtil;
@@ -119,6 +120,13 @@ public class PhoneNumberFormattingTextWatcher implements TextWatcher {
}
mSelfChange = false;
}
+
+ //remove previous TTS spans
+ TtsSpan[] ttsSpans = s.getSpans(0, s.length(), TtsSpan.class);
+ for (TtsSpan ttsSpan : ttsSpans) {
+ s.removeSpan(ttsSpan);
+ }
+
PhoneNumberUtils.ttsSpanAsPhoneNumber(s, 0, s.length());
}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 291524ad7c59..13550f02266b 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -3425,10 +3425,20 @@ public class SubscriptionManager {
* Get subscriptionInfo list of subscriptions that are in the same group of given subId.
* See {@link #createSubscriptionGroup(List)} for more details.
*
- * Caller will either have {@link android.Manifest.permission#READ_PHONE_STATE}
- * permission or had carrier privilege permission on the subscription.
+ * Caller must have {@link android.Manifest.permission#READ_PHONE_STATE}
+ * or carrier privilege permission on the subscription.
* {@link TelephonyManager#hasCarrierPrivileges()}
*
+ * <p>Starting with API level 33, this method will return an empty List if the caller does
+ * not have access to device identifiers.
+ * This method can be invoked if one of the following requirements is met:
+ * <ul>
+ * <li>If the app has carrier privilege permission.
+ * {@link TelephonyManager#hasCarrierPrivileges()}
+ * <li>If the app has {@link android.Manifest.permission#READ_PHONE_STATE} permission and
+ * access to device identifiers.
+ * </ul>
+ *
* @throws IllegalStateException if Telephony service is in bad state.
* @throws SecurityException if the caller doesn't meet the requirements
* outlined above.
diff --git a/telephony/java/android/telephony/UiccSlotInfo.java b/telephony/java/android/telephony/UiccSlotInfo.java
index 06c5b5cfeda1..5e02532e85a8 100644
--- a/telephony/java/android/telephony/UiccSlotInfo.java
+++ b/telephony/java/android/telephony/UiccSlotInfo.java
@@ -129,7 +129,7 @@ public class UiccSlotInfo implements Parcelable {
this.mLogicalSlotIdx = logicalSlotIdx;
this.mIsExtendedApduSupported = isExtendedApduSupported;
this.mIsRemovable = false;
- this.mPortList = null;
+ this.mPortList = new ArrayList<UiccPortInfo>();
}
/**
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java
index 081a74a58342..f794a7971343 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -24,7 +24,6 @@ import android.content.ContentValues;
import android.database.Cursor;
import android.hardware.radio.V1_5.ApnTypes;
import android.net.Uri;
-import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.Telephony;
@@ -964,7 +963,7 @@ public class ApnSetting implements Parcelable {
ServiceState.convertBearerBitmaskToNetworkTypeBitmask(bearerBitmask);
}
int mtuV4 = cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.MTU_V4));
- if (mtuV4 == -1) {
+ if (mtuV4 == UNSET_MTU) {
mtuV4 = cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.MTU));
}
@@ -2190,11 +2189,10 @@ public class ApnSetting implements Parcelable {
}
if ((mApnTypeBitmask & TYPE_MMS) != 0 && !TextUtils.isEmpty(mMmsProxyAddress)
&& mMmsProxyAddress.startsWith("http")) {
- if (Build.IS_DEBUGGABLE) {
- throw new IllegalArgumentException("mms proxy(" + mMmsProxyAddress
- + ") should be a hostname, not a url");
- }
- return null;
+ Log.wtf(LOG_TAG,"mms proxy(" + mMmsProxyAddress
+ + ") should be a hostname, not a url");
+ Uri mMmsProxyAddressUri = Uri.parse(mMmsProxyAddress);
+ mMmsProxyAddress = mMmsProxyAddressUri.getHost();
}
return new ApnSetting(this);
}
diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java
index 5bae1ad72d93..a6ccb220d74e 100644
--- a/telephony/java/android/telephony/ims/ImsMmTelManager.java
+++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java
@@ -223,6 +223,10 @@ public class ImsMmTelManager implements RegistrationManager {
private final int mSubId;
private final BinderCacheManager<ITelephony> mBinderCache;
+ // Cache Telephony Binder interfaces, one cache per process.
+ private static final BinderCacheManager<ITelephony> sTelephonyCache =
+ new BinderCacheManager<>(ImsMmTelManager::getITelephonyInterface);
+
/**
* Create an instance of {@link ImsMmTelManager} for the subscription id specified.
*
@@ -251,8 +255,7 @@ public class ImsMmTelManager implements RegistrationManager {
throw new IllegalArgumentException("Invalid subscription ID");
}
- return new ImsMmTelManager(subId, new BinderCacheManager<>(
- ImsMmTelManager::getITelephonyInterface));
+ return new ImsMmTelManager(subId, sTelephonyCache);
}
/**
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index 546d2ce0e115..b905212a9100 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -424,24 +424,4 @@ public class TelephonyIntents {
*/
@Deprecated
public static final String EXTRA_DEFAULT_NETWORK_AVAILABLE = "defaultNetworkAvailable";
-
- /**
- * <p>Broadcast sent to show Emergency notification due to Voice Over Wifi availability
- *
- * <p class="note">
- * You can <em>not</em> receive this through components declared
- * in manifests, only by explicitly registering for it with
- * {@link android.content.Context#registerReceiver(android.content.BroadcastReceiver,
- * android.content.IntentFilter) Context.registerReceiver()}.
- *
- * <p class="note">
- * Requires no permission.
- *
- * <p class="note">This is a protected intent that can only be sent
- * by the system.
- *
- * @hide
- */
- public static final String ACTION_VOWIFI_ENABLED
- = "com.android.internal.telephony.ACTION_VOWIFI_ENABLED";
}