diff options
Diffstat (limited to 'telephony/java')
9 files changed, 132 insertions, 23 deletions
diff --git a/telephony/java/android/telephony/AccessNetworkUtils.java b/telephony/java/android/telephony/AccessNetworkUtils.java index 6b820459be98..b5d97abdd3eb 100644 --- a/telephony/java/android/telephony/AccessNetworkUtils.java +++ b/telephony/java/android/telephony/AccessNetworkUtils.java @@ -567,6 +567,10 @@ public class AccessNetworkUtils { */ public static int getFrequencyFromNrArfcn(int nrArfcn) { + if (nrArfcn == PhysicalChannelConfig.CHANNEL_NUMBER_UNKNOWN) { + return PhysicalChannelConfig.FREQUENCY_UNKNOWN; + } + int globalKhz = 0; int rangeOffset = 0; int arfcnOffset = 0; @@ -632,6 +636,10 @@ public class AccessNetworkUtils { */ public static int getFrequencyFromUarfcn(int band, int uarfcn, boolean isUplink) { + if (uarfcn == PhysicalChannelConfig.CHANNEL_NUMBER_UNKNOWN) { + return PhysicalChannelConfig.FREQUENCY_UNKNOWN; + } + int offsetKhz = 0; for (UtranBandArfcnFrequency uarfcnFrequency : AccessNetworkConstants. UtranBandArfcnFrequency.values()) { @@ -702,6 +710,10 @@ public class AccessNetworkUtils { */ public static int getFrequencyFromArfcn(int band, int arfcn, boolean isUplink) { + if (arfcn == PhysicalChannelConfig.CHANNEL_NUMBER_UNKNOWN) { + return PhysicalChannelConfig.FREQUENCY_UNKNOWN; + } + int uplinkFrequencyFirst = 0; int arfcnOffset = 0; int downlinkOffset = 0; diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 7ac37790fd89..aa61229ecc24 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -286,6 +286,21 @@ public class CarrierConfigManager { "call_barring_default_service_class_int"; /** + * This carrier supports dialing USSD codes to enable/disable supplementary services such as + * call forwarding and call waiting over CDMA. + * <p> + * The supplementary service menu will still need to be set as visible, see + * {@link #KEY_CALL_FORWARDING_VISIBILITY_BOOL} and + * {@link #KEY_ADDITIONAL_SETTINGS_CALL_WAITING_VISIBILITY_BOOL}. + * <p> + * If this is set as false and the supplementary service menu is visible, the associated setting + * will be enabled and disabled based on the availability of supplementary services over UT. See + * {@link #KEY_CARRIER_SUPPORTS_SS_OVER_UT_BOOL}. + * @hide + */ + public static final String KEY_SUPPORT_SS_OVER_CDMA_BOOL = "support_ss_over_cdma_bool"; + + /** * Flag indicating whether the Phone app should ignore EVENT_SIM_NETWORK_LOCKED * events from the Sim. * If true, this will prevent the IccNetworkDepersonalizationPanel from being shown, and @@ -3566,7 +3581,7 @@ public class CarrierConfigManager { "nr_advanced_capable_pco_id_int"; /** - * This configuration allows the framework to use user data communication to detect RRC state, + * This configuration allows the framework to use user data communication to detect Idle state, * and this is used on the 5G icon. * * There is a new way for for RRC state detection at Android 12. If @@ -3574,16 +3589,23 @@ public class CarrierConfigManager { * {@link TelephonyManager#CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED}) returns true, * then framework can use PHYSICAL_CHANNEL_CONFIG for RRC state detection. Based on this * condition, some carriers want to use the legacy behavior that way is using user data - * communication to detect the RRC state. Therefore, this configuration allows the framework - * to use user data communication to detect RRC state. + * communication to detect the Idle state. Therefore, this configuration allows the framework + * to use user data communication to detect Idle state. * - * The precondition is + * There are 3 situations reflects the carrier define Idle state. + * 1. using PHYSICAL_CHANNEL_CONFIG to detect RRC Idle + * 2. using all of data connections to detect RRC Idle. + * 3. using data communication(consider internet data connection only) to detect data Idle. + * + * How to setup for above 3 cases? + * For below part, we call the condition#1 is device support * {@link android.telephony.TelephonyManager#isRadioInterfaceCapabilitySupported}( - * {@link TelephonyManager#CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED}) returns true, - * otherwise this config is not working. - * If this is true, framework uses the user data communication for RRC state detection. - * If this is false, framework uses the PHYSICAL_CHANNEL_CONFIG for RRC state detection. + * {@link TelephonyManager#CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED}). + * The condition#2 is carrier enable the KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL. * + * For case#1, the condition#1 is true and the condition#2 is false. + * For case#2, the condition#1 is false and the condition#2 is false. + * For case#3, the condition#2 is true. * @hide */ public static final String KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL = @@ -5205,6 +5227,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_CALL_BARRING_SUPPORTS_PASSWORD_CHANGE_BOOL, true); sDefaults.putBoolean(KEY_CALL_BARRING_SUPPORTS_DEACTIVATE_ALL_BOOL, true); sDefaults.putInt(KEY_CALL_BARRING_DEFAULT_SERVICE_CLASS_INT, SERVICE_CLASS_VOICE); + sDefaults.putBoolean(KEY_SUPPORT_SS_OVER_CDMA_BOOL, false); sDefaults.putBoolean(KEY_CALL_FORWARDING_VISIBILITY_BOOL, true); sDefaults.putBoolean(KEY_CALL_FORWARDING_WHEN_UNREACHABLE_SUPPORTED_BOOL, true); sDefaults.putBoolean(KEY_CALL_FORWARDING_WHEN_UNANSWERED_SUPPORTED_BOOL, true); diff --git a/telephony/java/android/telephony/CellSignalStrengthNr.java b/telephony/java/android/telephony/CellSignalStrengthNr.java index 72150ddf8597..6ada32e1a86d 100644 --- a/telephony/java/android/telephony/CellSignalStrengthNr.java +++ b/telephony/java/android/telephony/CellSignalStrengthNr.java @@ -178,7 +178,7 @@ public final class CellSignalStrengthNr extends CellSignalStrength implements Pa mCsiSinr = inRangeOrUnavailable(csiSinr, -23, 23); mCsiCqiTableIndex = inRangeOrUnavailable(csiCqiTableIndex, 1, 3); mCsiCqiReport = csiCqiReport.stream() - .map(cqi -> new Integer(inRangeOrUnavailable(Byte.toUnsignedInt(cqi), 1, 3))) + .map(cqi -> new Integer(inRangeOrUnavailable(Byte.toUnsignedInt(cqi), 0, 15))) .collect(Collectors.toList()); mSsRsrp = inRangeOrUnavailable(ssRsrp, -140, -44); mSsRsrq = inRangeOrUnavailable(ssRsrq, -43, 20); diff --git a/telephony/java/android/telephony/PhysicalChannelConfig.java b/telephony/java/android/telephony/PhysicalChannelConfig.java index 8df41fb6b288..d250088c2f10 100644 --- a/telephony/java/android/telephony/PhysicalChannelConfig.java +++ b/telephony/java/android/telephony/PhysicalChannelConfig.java @@ -338,7 +338,8 @@ public final class PhysicalChannelConfig implements Parcelable { private void setUplinkFrequency() { switch (mNetworkType){ case TelephonyManager.NETWORK_TYPE_NR: - mUplinkFrequency = mDownlinkFrequency; + mUplinkFrequency = AccessNetworkUtils.getFrequencyFromNrArfcn( + mUplinkChannelNumber); break; case TelephonyManager.NETWORK_TYPE_LTE: mUplinkFrequency = AccessNetworkUtils.getFrequencyFromEarfcn( diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 2bf411f8afc2..799930c53669 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -14000,7 +14000,12 @@ public class TelephonyManager { IBooleanConsumer aidlConsumer = callback == null ? null : new IBooleanConsumer.Stub() { @Override public void accept(boolean result) { - executor.execute(() -> callback.accept(result)); + final long identity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> callback.accept(result)); + } finally { + Binder.restoreCallingIdentity(identity); + } } }; diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java index 53922ed27c10..36082dc8180e 100644 --- a/telephony/java/android/telephony/ims/ImsMmTelManager.java +++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java @@ -445,7 +445,12 @@ public class ImsMmTelManager implements RegistrationManager { iTelephony.getImsMmTelRegistrationState(mSubId, new IIntegerConsumer.Stub() { @Override public void accept(int result) { - executor.execute(() -> stateCallback.accept(result)); + final long identity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> stateCallback.accept(result)); + } finally { + Binder.restoreCallingIdentity(identity); + } } }); } catch (ServiceSpecificException | RemoteException e) { @@ -487,7 +492,12 @@ public class ImsMmTelManager implements RegistrationManager { new IIntegerConsumer.Stub() { @Override public void accept(int result) { - executor.execute(() -> transportTypeCallback.accept(result)); + final long identity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> transportTypeCallback.accept(result)); + } finally { + Binder.restoreCallingIdentity(identity); + } } }); } catch (ServiceSpecificException | RemoteException e) { @@ -807,7 +817,12 @@ public class ImsMmTelManager implements RegistrationManager { iTelephony.isMmTelCapabilitySupported(mSubId, new IIntegerConsumer.Stub() { @Override public void accept(int result) { - executor.execute(() -> callback.accept(result == 1)); + final long identity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> callback.accept(result == 1)); + } finally { + Binder.restoreCallingIdentity(identity); + } } }, capability, transportType); } catch (ServiceSpecificException sse) { @@ -1452,7 +1467,12 @@ public class ImsMmTelManager implements RegistrationManager { iTelephony.getImsMmTelFeatureState(mSubId, new IIntegerConsumer.Stub() { @Override public void accept(int result) { - executor.execute(() -> callback.accept(result)); + final long identity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> callback.accept(result)); + } finally { + Binder.restoreCallingIdentity(identity); + } } }); } catch (ServiceSpecificException sse) { diff --git a/telephony/java/android/telephony/ims/ImsRcsManager.java b/telephony/java/android/telephony/ims/ImsRcsManager.java index 91c53244a780..8d6fa4141b5c 100644 --- a/telephony/java/android/telephony/ims/ImsRcsManager.java +++ b/telephony/java/android/telephony/ims/ImsRcsManager.java @@ -299,7 +299,12 @@ public class ImsRcsManager { imsRcsController.getImsRcsRegistrationState(mSubId, new IIntegerConsumer.Stub() { @Override public void accept(int result) { - executor.execute(() -> stateCallback.accept(result)); + final long identity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> stateCallback.accept(result)); + } finally { + Binder.restoreCallingIdentity(identity); + } } }); } catch (ServiceSpecificException | RemoteException e) { @@ -345,7 +350,12 @@ public class ImsRcsManager { new IIntegerConsumer.Stub() { @Override public void accept(int result) { - executor.execute(() -> transportTypeCallback.accept(result)); + final long identity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> transportTypeCallback.accept(result)); + } finally { + Binder.restoreCallingIdentity(identity); + } } }); } catch (ServiceSpecificException | RemoteException e) { diff --git a/telephony/java/android/telephony/ims/aidl/SipDelegateAidlWrapper.java b/telephony/java/android/telephony/ims/aidl/SipDelegateAidlWrapper.java index c18ab33eb2c9..f0048248a5cc 100644 --- a/telephony/java/android/telephony/ims/aidl/SipDelegateAidlWrapper.java +++ b/telephony/java/android/telephony/ims/aidl/SipDelegateAidlWrapper.java @@ -193,6 +193,10 @@ public class SipDelegateAidlWrapper implements DelegateStateCallback, DelegateMe return mDelegateBinder; } + public ISipDelegateStateCallback getStateCallbackBinder() { + return mStateBinder; + } + private void notifyLocalMessageFailedToBeReceived(SipMessage m, int reason) { String transactionId = m.getViaBranchParameter(); SipDelegate d = mDelegate; diff --git a/telephony/java/android/telephony/ims/stub/SipTransportImplBase.java b/telephony/java/android/telephony/ims/stub/SipTransportImplBase.java index 1f74c09af0f6..13ea99735ab4 100644 --- a/telephony/java/android/telephony/ims/stub/SipTransportImplBase.java +++ b/telephony/java/android/telephony/ims/stub/SipTransportImplBase.java @@ -21,6 +21,7 @@ import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.os.Binder; import android.os.IBinder; +import android.os.RemoteException; import android.telephony.ims.DelegateMessageCallback; import android.telephony.ims.DelegateRequest; import android.telephony.ims.DelegateStateCallback; @@ -33,6 +34,7 @@ import android.telephony.ims.aidl.SipDelegateAidlWrapper; import android.util.Log; import java.util.ArrayList; +import java.util.NoSuchElementException; import java.util.Objects; import java.util.concurrent.Executor; @@ -49,10 +51,15 @@ import java.util.concurrent.Executor; public class SipTransportImplBase { private static final String LOG_TAG = "SipTransportIB"; - private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() { + private final IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() { @Override public void binderDied() { - mBinderExecutor.execute(() -> binderDiedInternal()); + // Clean up all binders in this case. + mBinderExecutor.execute(() -> binderDiedInternal(null)); + } + @Override + public void binderDied(IBinder who) { + mBinderExecutor.execute(() -> binderDiedInternal(who)); } }; @@ -142,6 +149,7 @@ public class SipTransportImplBase { ISipDelegateStateCallback cb, ISipDelegateMessageCallback mc) { SipDelegateAidlWrapper wrapper = new SipDelegateAidlWrapper(mBinderExecutor, cb, mc); mDelegates.add(wrapper); + linkDeathRecipient(wrapper); createSipDelegate(subId, r, wrapper, wrapper); } @@ -155,6 +163,7 @@ public class SipTransportImplBase { } if (result != null) { + unlinkDeathRecipient(result); mDelegates.remove(result); destroySipDelegate(result.getDelegate(), reason); } else { @@ -163,12 +172,37 @@ public class SipTransportImplBase { } } - private void binderDiedInternal() { + private void linkDeathRecipient(SipDelegateAidlWrapper w) { + try { + w.getStateCallbackBinder().asBinder().linkToDeath(mDeathRecipient, 0); + } catch (RemoteException e) { + Log.w(LOG_TAG, "linkDeathRecipient, remote process already died, cleaning up."); + mDeathRecipient.binderDied(w.getStateCallbackBinder().asBinder()); + } + } + + private void unlinkDeathRecipient(SipDelegateAidlWrapper w) { + try { + w.getStateCallbackBinder().asBinder().unlinkToDeath(mDeathRecipient, 0); + } catch (NoSuchElementException e) { + // Ignore this case. + } + } + + private void binderDiedInternal(IBinder who) { for (SipDelegateAidlWrapper w : mDelegates) { - destroySipDelegate(w.getDelegate(), - SipDelegateManager.SIP_DELEGATE_DESTROY_REASON_SERVICE_DEAD); + // If the binder itself was not given from the platform, just clean up all binders. + if (who == null || w.getStateCallbackBinder().asBinder().equals(who)) { + Log.w(LOG_TAG, "Binder death detected for " + w + ", calling destroy and " + + "removing."); + mDelegates.remove(w); + destroySipDelegate(w.getDelegate(), + SipDelegateManager.SIP_DELEGATE_DESTROY_REASON_SERVICE_DEAD); + return; + } } - mDelegates.clear(); + Log.w(LOG_TAG, "Binder death detected for IBinder " + who + ", but couldn't find matching " + + "SipDelegate"); } /** |