From 4f2a849e254eea87d4796a6eea983d00e9f2f86c Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Sat, 1 Aug 2020 19:55:31 -0700 Subject: Refactored precise data connection state Instead of triggering the data connection state changed event from outside, now the event is triggering from DataConnection. Whenever detecting data connection state changes, the event will be triggered. This significantly reduced the unnecessary redundant events sent to telephony registry, even though it has a duplicate detection mechanism. This are also two behavioral changes. 1. Previously if a data connection supports multiple APN types, there will be multiple data connection state changed event for each APN type. Now there is only one. The listener should use PreciseDataConnectionState.getApnSetting().getApnTypeBitmask() to check which APN types this data connection supports. 2. If setup data call fails before a data connection instance can be created, there won't be any event with fail cause. Fix: 161572838 Test: FrameworksTelephonyTests and manual Merged-In: I9723d5284c2a8fbae9f63179dc30ddc42da1d0fc Change-Id: I9723d5284c2a8fbae9f63179dc30ddc42da1d0fc (cherry picked from commit 34a09a4cbd2fbb32d0dd7b8879483b879125bf52) --- .../telephony/TelephonyRegistryManager.java | 29 +++------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/telephony/TelephonyRegistryManager.java b/core/java/android/telephony/TelephonyRegistryManager.java index 2dbce7b0fc7b..3673ae7f7a37 100644 --- a/core/java/android/telephony/TelephonyRegistryManager.java +++ b/core/java/android/telephony/TelephonyRegistryManager.java @@ -26,10 +26,8 @@ import android.os.Binder; import android.os.Build; import android.os.RemoteException; import android.os.ServiceManager; -import android.telephony.Annotation.ApnType; import android.telephony.Annotation.CallState; import android.telephony.Annotation.DataActivityType; -import android.telephony.Annotation.DataFailureCause; import android.telephony.Annotation.DisconnectCauses; import android.telephony.Annotation.NetworkType; import android.telephony.Annotation.PreciseCallStates; @@ -37,7 +35,6 @@ import android.telephony.Annotation.PreciseDisconnectCauses; import android.telephony.Annotation.RadioPowerState; import android.telephony.Annotation.SimActivationState; import android.telephony.Annotation.SrvccState; -import android.telephony.data.ApnSetting; import android.telephony.emergency.EmergencyNumber; import android.telephony.ims.ImsReasonInfo; import android.util.Log; @@ -413,17 +410,16 @@ public class TelephonyRegistryManager { * @param subId for which data connection state changed. * @param slotIndex for which data connections state changed. Can be derived from subId except * when subId is invalid. - * @param apnType the apn type bitmask, defined with {@code ApnSetting#TYPE_*} flags. * @param preciseState the PreciseDataConnectionState * - * @see android.telephony.PreciseDataConnection + * @see PreciseDataConnectionState * @see TelephonyManager#DATA_DISCONNECTED */ public void notifyDataConnectionForSubscriber(int slotIndex, int subId, - @ApnType int apnType, @Nullable PreciseDataConnectionState preciseState) { + @NonNull PreciseDataConnectionState preciseState) { try { sRegistry.notifyDataConnectionForSubscriber( - slotIndex, subId, apnType, preciseState); + slotIndex, subId, preciseState); } catch (RemoteException ex) { // system process is dead } @@ -622,25 +618,6 @@ public class TelephonyRegistryManager { } } - /** - * Notify precise data connection failed cause on certain subscription. - * - * @param subId for which data connection failed. - * @param slotIndex for which data conenction failed. Can be derived from subId except when - * subId is invalid. - * @param apnType the apn type bitmask, defined with {@code ApnSetting#TYPE_*} flags. - * @param apn the APN {@link ApnSetting#getApnName()} of this data connection. - * @param failCause data fail cause. - */ - public void notifyPreciseDataConnectionFailed(int subId, int slotIndex, @ApnType int apnType, - @Nullable String apn, @DataFailureCause int failCause) { - try { - sRegistry.notifyPreciseDataConnectionFailed(slotIndex, subId, apnType, apn, failCause); - } catch (RemoteException ex) { - // system process is dead - } - } - /** * Notify single Radio Voice Call Continuity (SRVCC) state change for the currently active call * on certain subscription. -- cgit v1.2.3