diff options
Diffstat (limited to 'telephony')
7 files changed, 78 insertions, 12 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/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/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 5ed6cb9ea2fb..4caa0f78ae51 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); } /** |