Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +1 −1 Original line number Diff line number Diff line Loading @@ -411,7 +411,7 @@ public class GsmCdmaPhone extends Phone { mLinkBandwidthEstimator = mTelephonyComponentFactory .inject(LinkBandwidthEstimator.class.getName()) .makeLinkBandwidthEstimator(this); .makeLinkBandwidthEstimator(this, getLooper()); mCallWaitingController = new CallWaitingController(this); Loading src/java/com/android/internal/telephony/TelephonyComponentFactory.java +2 −2 Original line number Diff line number Diff line Loading @@ -523,8 +523,8 @@ public class TelephonyComponentFactory { /** * Create a new LinkBandwidthEstimator. */ public LinkBandwidthEstimator makeLinkBandwidthEstimator(Phone phone) { return new LinkBandwidthEstimator(phone, mTelephonyFacade); public LinkBandwidthEstimator makeLinkBandwidthEstimator(Phone phone, Looper looper) { return new LinkBandwidthEstimator(phone, looper, mTelephonyFacade); } /** Loading src/java/com/android/internal/telephony/data/AccessNetworksManager.java +22 −24 Original line number Diff line number Diff line Loading @@ -69,7 +69,6 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.stream.Collectors; /** Loading @@ -86,7 +85,8 @@ public class AccessNetworksManager extends Handler { /** * The counters to detect frequent QNS attempt to change preferred network transport by ApnType. */ private final @NonNull SparseArray<SlidingWindowEventCounter> mApnTypeToQnsChangeNetworkCounter; @NonNull private final SparseArray<SlidingWindowEventCounter> mApnTypeToQnsChangeNetworkCounter; private final String mLogTag; private final LocalLog mLocalLog = new LocalLog(64); Loading @@ -109,12 +109,11 @@ public class AccessNetworksManager extends Handler { private final CarrierConfigManager mCarrierConfigManager; private @Nullable DataConfigManager mDataConfigManager; @Nullable private DataConfigManager mDataConfigManager; private IQualifiedNetworksService mIQualifiedNetworksService; private AccessNetworksManagerDeathRecipient mDeathRecipient; private String mTargetBindingPackageName; private QualifiedNetworksServiceConnection mServiceConnection; Loading @@ -122,7 +121,8 @@ public class AccessNetworksManager extends Handler { // Available networks. Key is the APN type. private final SparseArray<int[]> mAvailableNetworks = new SparseArray<>(); private final @TransportType int[] mAvailableTransports; @TransportType private final int[] mAvailableTransports; private final RegistrantList mQualifiedNetworksChangedRegistrants = new RegistrantList(); Loading @@ -135,7 +135,8 @@ public class AccessNetworksManager extends Handler { /** * Callbacks for passing information to interested clients. */ private final @NonNull Set<AccessNetworksManagerCallback> mAccessNetworksManagerCallbacks = @NonNull private final Set<AccessNetworksManagerCallback> mAccessNetworksManagerCallbacks = new ArraySet<>(); private final FeatureFlags mFeatureFlags; Loading @@ -144,7 +145,8 @@ public class AccessNetworksManager extends Handler { * Represents qualified network types list on a specific APN type. */ public static class QualifiedNetworks { public final @ApnType int apnType; @ApnType public final int apnType; // The qualified networks in preferred order. Each network is a AccessNetworkType. public final @NonNull @RadioAccessNetworkType int[] qualifiedNetworks; public QualifiedNetworks(@ApnType int apnType, @NonNull int[] qualifiedNetworks) { Loading Loading @@ -198,11 +200,12 @@ public class AccessNetworksManager extends Handler { public void onServiceConnected(ComponentName name, IBinder service) { if (DBG) log("onServiceConnected " + name); mIQualifiedNetworksService = IQualifiedNetworksService.Stub.asInterface(service); mDeathRecipient = new AccessNetworksManagerDeathRecipient(); AccessNetworksManagerDeathRecipient deathRecipient = new AccessNetworksManagerDeathRecipient(); mLastBoundPackageName = getQualifiedNetworksServicePackageName(); try { service.linkToDeath(mDeathRecipient, 0 /* flags */); service.linkToDeath(deathRecipient, 0 /* flags */); mIQualifiedNetworksService.createNetworkAvailabilityProvider(mPhone.getPhoneId(), new QualifiedNetworksServiceCallback()); } catch (RemoteException e) { Loading Loading @@ -328,10 +331,7 @@ public class AccessNetworksManager extends Handler { log("onNetworkValidationRequested: networkCapability = [" + DataUtils.networkCapabilityToString(networkCapability) + "]"); dnc.requestNetworkValidation(networkCapability, new Consumer<>() { @Override public void accept(Integer result) { post(() -> { dnc.requestNetworkValidation(networkCapability, result -> post(() -> { try { log("onNetworkValidationRequestDone:" + DataServiceCallback.resultCodeToString(result)); Loading @@ -340,9 +340,7 @@ public class AccessNetworksManager extends Handler { // Ignore if the remote process is no longer available to call back. loge("onNetworkValidationRequestDone RemoteException" + e); } }); } }); })); } @Override Loading src/java/com/android/internal/telephony/data/AutoDataSwitchController.java +51 −38 Original line number Diff line number Diff line Loading @@ -137,17 +137,26 @@ public class AutoDataSwitchController extends Handler { private static final long RETRY_LONG_DELAY_TIMER_THRESHOLD_MILLIS = TimeUnit .MINUTES.toMillis(1); private final @NonNull LocalLog mLocalLog = new LocalLog(128); private final @NonNull Context mContext; private static @NonNull FeatureFlags sFeatureFlags = new FeatureFlagsImpl(); private final @NonNull SubscriptionManagerService mSubscriptionManagerService; private final @NonNull PhoneSwitcher mPhoneSwitcher; private final @NonNull AutoDataSwitchControllerCallback mPhoneSwitcherCallback; private final @NonNull AlarmManager mAlarmManager; @NonNull private final LocalLog mLocalLog = new LocalLog(128); @NonNull private final Context mContext; @NonNull private static FeatureFlags sFeatureFlags = new FeatureFlagsImpl(); @NonNull private final SubscriptionManagerService mSubscriptionManagerService; @NonNull private final PhoneSwitcher mPhoneSwitcher; @NonNull private final AutoDataSwitchControllerCallback mPhoneSwitcherCallback; @NonNull private final AlarmManager mAlarmManager; /** A map of a scheduled event to its associated extra for action when the event fires off. */ private final @NonNull Map<Integer, Object> mScheduledEventsToExtras; @NonNull private final Map<Integer, Object> mScheduledEventsToExtras; /** A map of an event to its associated alarm listener callback for when the event fires off. */ private final @NonNull Map<Integer, AlarmManager.OnAlarmListener> mEventsToAlarmListener; @NonNull private final Map<Integer, AlarmManager.OnAlarmListener> mEventsToAlarmListener; /** * Event extras for checking environment stability. * @param targetPhoneId The target phone Id to switch to when the stability check pass. Loading Loading @@ -193,7 +202,7 @@ public class AutoDataSwitchController extends Handler { * To indicate whether allow using roaming nDDS if user enabled its roaming when the DDS is not * usable(OOS or disabled roaming) */ private boolean mAllowNddsRoamning = true; private boolean mAllowNddsRoaming = true; /** The count of consecutive auto switch validation failure **/ private int mAutoSwitchValidationFailedCount = 0; /** Loading @@ -202,7 +211,8 @@ public class AutoDataSwitchController extends Handler { private int mAutoDataSwitchValidationMaxRetry; /** The signal status of phones, where index corresponds to phone Id. */ private @NonNull PhoneSignalStatus[] mPhonesSignalStatus; @NonNull private PhoneSignalStatus[] mPhonesSignalStatus; /** * The phone Id of the pending switching phone. Used for pruning frequent switch evaluation. */ Loading Loading @@ -268,23 +278,24 @@ public class AutoDataSwitchController extends Handler { boolean isUsingNonTerrestrialNetwork = sFeatureFlags.carrierEnabledSatelliteFlag() && (serviceState != null) && serviceState.isUsingNonTerrestrialNetwork(); switch (mDataRegState) { case NetworkRegistrationInfo.REGISTRATION_STATE_HOME: return switch (mDataRegState) { case NetworkRegistrationInfo.REGISTRATION_STATE_HOME -> { if (isUsingNonTerrestrialNetwork) { return UsableState.NON_TERRESTRIAL; yield UsableState.NON_TERRESTRIAL; } return UsableState.HOME; case NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING: yield UsableState.HOME; } case NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING -> { if (mPhone.getDataRoamingEnabled()) { if (isUsingNonTerrestrialNetwork) { return UsableState.NON_TERRESTRIAL; yield UsableState.NON_TERRESTRIAL; } return UsableState.ROAMING_ENABLED; yield UsableState.ROAMING_ENABLED; } return UsableState.NOT_USABLE; default: return UsableState.NOT_USABLE; yield UsableState.NOT_USABLE; } default -> UsableState.NOT_USABLE; }; } @Override Loading Loading @@ -450,7 +461,7 @@ public class AutoDataSwitchController extends Handler { DataConfigManager dataConfig = phone.getDataNetworkController().getDataConfigManager(); mScoreTolerance = dataConfig.getAutoDataSwitchScoreTolerance(); mRequirePingTestBeforeSwitch = dataConfig.isPingTestBeforeAutoDataSwitchRequired(); mAllowNddsRoamning = dataConfig.doesAutoDataSwitchAllowRoaming(); mAllowNddsRoaming = dataConfig.doesAutoDataSwitchAllowRoaming(); mAutoDataSwitchAvailabilityStabilityTimeThreshold = dataConfig.getAutoDataSwitchAvailabilityStabilityTimeThreshold(); mAutoDataSwitchPerformanceStabilityTimeThreshold = Loading Loading @@ -929,7 +940,7 @@ public class AutoDataSwitchController extends Handler { * @return {@code true} If the feature of switching to roaming non DDS is enabled. */ private boolean isNddsRoamingEnabled() { return sFeatureFlags.autoDataSwitchAllowRoaming() && mAllowNddsRoamning; return sFeatureFlags.autoDataSwitchAllowRoaming() && mAllowNddsRoaming; } /** Loading Loading @@ -1012,19 +1023,20 @@ public class AutoDataSwitchController extends Handler { } /** Auto data switch evaluation reason to string. */ public static @NonNull String evaluationReasonToString( @NonNull public static String evaluationReasonToString( @AutoDataSwitchEvaluationReason int reason) { switch (reason) { case EVALUATION_REASON_REGISTRATION_STATE_CHANGED: return "REGISTRATION_STATE_CHANGED"; case EVALUATION_REASON_DISPLAY_INFO_CHANGED: return "DISPLAY_INFO_CHANGED"; case EVALUATION_REASON_SIGNAL_STRENGTH_CHANGED: return "SIGNAL_STRENGTH_CHANGED"; case EVALUATION_REASON_DEFAULT_NETWORK_CHANGED: return "DEFAULT_NETWORK_CHANGED"; case EVALUATION_REASON_DATA_SETTINGS_CHANGED: return "DATA_SETTINGS_CHANGED"; case EVALUATION_REASON_RETRY_VALIDATION: return "RETRY_VALIDATION"; case EVALUATION_REASON_SIM_LOADED: return "SIM_LOADED"; case EVALUATION_REASON_VOICE_CALL_END: return "VOICE_CALL_END"; } return "Unknown(" + reason + ")"; return switch (reason) { case EVALUATION_REASON_REGISTRATION_STATE_CHANGED -> "REGISTRATION_STATE_CHANGED"; case EVALUATION_REASON_DISPLAY_INFO_CHANGED -> "DISPLAY_INFO_CHANGED"; case EVALUATION_REASON_SIGNAL_STRENGTH_CHANGED -> "SIGNAL_STRENGTH_CHANGED"; case EVALUATION_REASON_DEFAULT_NETWORK_CHANGED -> "DEFAULT_NETWORK_CHANGED"; case EVALUATION_REASON_DATA_SETTINGS_CHANGED -> "DATA_SETTINGS_CHANGED"; case EVALUATION_REASON_RETRY_VALIDATION -> "RETRY_VALIDATION"; case EVALUATION_REASON_SIM_LOADED -> "SIM_LOADED"; case EVALUATION_REASON_VOICE_CALL_END -> "VOICE_CALL_END"; default -> "Unknown(" + reason + ")"; }; } /** @return {@code true} if the sub is active. */ Loading Loading @@ -1085,8 +1097,9 @@ public class AutoDataSwitchController extends Handler { * @param isDueToAutoSwitch {@code true} if the switch was due to auto data switch feature. */ public void displayAutoDataSwitchNotification(int phoneId, boolean isDueToAutoSwitch) { NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager notificationManager = mContext.getSystemService( NotificationManager.class); if (notificationManager == null) return; if (mDisplayedNotification) { // cancel posted notification if any exist notificationManager.cancel(AUTO_DATA_SWITCH_NOTIFICATION_TAG, Loading src/java/com/android/internal/telephony/data/CellularDataService.java +15 −11 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telephony.data; import static android.telephony.data.DataServiceCallback.RESULT_SUCCESS; import android.annotation.NonNull; import android.annotation.Nullable; import android.net.LinkProperties; import android.os.AsyncResult; Loading @@ -41,6 +42,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; /** * This class represents cellular data service which handles telephony data requests and response Loading @@ -61,6 +63,7 @@ public class CellularDataService extends DataService { private static final int CANCEL_HANDOVER = 8; private static final int APN_UNTHROTTLED = 9; @SuppressWarnings("unchecked") private class CellularDataServiceProvider extends DataService.DataServiceProvider { private final Map<Message, DataServiceCallback> mCallbackMap = new HashMap<>(); Loading @@ -69,14 +72,15 @@ public class CellularDataService extends DataService { private final Phone mPhone; @SuppressWarnings("unchecked") private CellularDataServiceProvider(int slotId) { super(slotId); mPhone = PhoneFactory.getPhone(getSlotIndex()); mHandler = new Handler(Looper.myLooper()) { mHandler = new Handler(Objects.requireNonNull(Looper.myLooper())) { @Override public void handleMessage(Message message) { public void handleMessage(@NonNull Message message) { DataServiceCallback callback = mCallbackMap.remove(message); AsyncResult ar = (AsyncResult) message.obj; Loading Loading @@ -162,10 +166,10 @@ public class CellularDataService extends DataService { } @Override public void setupDataCall(int accessNetworkType, DataProfile dataProfile, public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties, int pduSessionId, NetworkSliceInfo sliceInfo, TrafficDescriptor trafficDescriptor, boolean matchAllRuleAllowed, DataServiceCallback callback) { boolean matchAllRuleAllowed, @Nullable DataServiceCallback callback) { // TODO: remove isRoaming parameter if (DBG) log("setupDataCall " + getSlotIndex()); Loading Loading @@ -198,8 +202,8 @@ public class CellularDataService extends DataService { } @Override public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, DataServiceCallback callback) { public void setInitialAttachApn(@NonNull DataProfile dataProfile, boolean isRoaming, @Nullable DataServiceCallback callback) { // TODO: remove isRoaming parameter if (DBG) log("setInitialAttachApn " + getSlotIndex()); Loading @@ -215,8 +219,8 @@ public class CellularDataService extends DataService { } @Override public void setDataProfile(List<DataProfile> dps, boolean isRoaming, DataServiceCallback callback) { public void setDataProfile(@NonNull List<DataProfile> dps, boolean isRoaming, @Nullable DataServiceCallback callback) { // TODO: remove isRoaming parameter if (DBG) log("setDataProfile " + getSlotIndex()); Loading @@ -232,7 +236,7 @@ public class CellularDataService extends DataService { } @Override public void requestDataCallList(DataServiceCallback callback) { public void requestDataCallList(@Nullable DataServiceCallback callback) { if (DBG) log("requestDataCallList " + getSlotIndex()); Message message = null; Loading @@ -246,7 +250,7 @@ public class CellularDataService extends DataService { } @Override public void startHandover(int cid, DataServiceCallback callback) { public void startHandover(int cid, @Nullable DataServiceCallback callback) { if (DBG) log("startHandover " + getSlotIndex()); Message message = null; // Only obtain the message when the caller wants a callback. If the caller doesn't care Loading @@ -259,7 +263,7 @@ public class CellularDataService extends DataService { } @Override public void cancelHandover(int cid, DataServiceCallback callback) { public void cancelHandover(int cid, @Nullable DataServiceCallback callback) { Message message = null; // Only obtain the message when the caller wants a callback. If the caller doesn't care // the request completed or results, then no need to pass the message down. Loading Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +1 −1 Original line number Diff line number Diff line Loading @@ -411,7 +411,7 @@ public class GsmCdmaPhone extends Phone { mLinkBandwidthEstimator = mTelephonyComponentFactory .inject(LinkBandwidthEstimator.class.getName()) .makeLinkBandwidthEstimator(this); .makeLinkBandwidthEstimator(this, getLooper()); mCallWaitingController = new CallWaitingController(this); Loading
src/java/com/android/internal/telephony/TelephonyComponentFactory.java +2 −2 Original line number Diff line number Diff line Loading @@ -523,8 +523,8 @@ public class TelephonyComponentFactory { /** * Create a new LinkBandwidthEstimator. */ public LinkBandwidthEstimator makeLinkBandwidthEstimator(Phone phone) { return new LinkBandwidthEstimator(phone, mTelephonyFacade); public LinkBandwidthEstimator makeLinkBandwidthEstimator(Phone phone, Looper looper) { return new LinkBandwidthEstimator(phone, looper, mTelephonyFacade); } /** Loading
src/java/com/android/internal/telephony/data/AccessNetworksManager.java +22 −24 Original line number Diff line number Diff line Loading @@ -69,7 +69,6 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.stream.Collectors; /** Loading @@ -86,7 +85,8 @@ public class AccessNetworksManager extends Handler { /** * The counters to detect frequent QNS attempt to change preferred network transport by ApnType. */ private final @NonNull SparseArray<SlidingWindowEventCounter> mApnTypeToQnsChangeNetworkCounter; @NonNull private final SparseArray<SlidingWindowEventCounter> mApnTypeToQnsChangeNetworkCounter; private final String mLogTag; private final LocalLog mLocalLog = new LocalLog(64); Loading @@ -109,12 +109,11 @@ public class AccessNetworksManager extends Handler { private final CarrierConfigManager mCarrierConfigManager; private @Nullable DataConfigManager mDataConfigManager; @Nullable private DataConfigManager mDataConfigManager; private IQualifiedNetworksService mIQualifiedNetworksService; private AccessNetworksManagerDeathRecipient mDeathRecipient; private String mTargetBindingPackageName; private QualifiedNetworksServiceConnection mServiceConnection; Loading @@ -122,7 +121,8 @@ public class AccessNetworksManager extends Handler { // Available networks. Key is the APN type. private final SparseArray<int[]> mAvailableNetworks = new SparseArray<>(); private final @TransportType int[] mAvailableTransports; @TransportType private final int[] mAvailableTransports; private final RegistrantList mQualifiedNetworksChangedRegistrants = new RegistrantList(); Loading @@ -135,7 +135,8 @@ public class AccessNetworksManager extends Handler { /** * Callbacks for passing information to interested clients. */ private final @NonNull Set<AccessNetworksManagerCallback> mAccessNetworksManagerCallbacks = @NonNull private final Set<AccessNetworksManagerCallback> mAccessNetworksManagerCallbacks = new ArraySet<>(); private final FeatureFlags mFeatureFlags; Loading @@ -144,7 +145,8 @@ public class AccessNetworksManager extends Handler { * Represents qualified network types list on a specific APN type. */ public static class QualifiedNetworks { public final @ApnType int apnType; @ApnType public final int apnType; // The qualified networks in preferred order. Each network is a AccessNetworkType. public final @NonNull @RadioAccessNetworkType int[] qualifiedNetworks; public QualifiedNetworks(@ApnType int apnType, @NonNull int[] qualifiedNetworks) { Loading Loading @@ -198,11 +200,12 @@ public class AccessNetworksManager extends Handler { public void onServiceConnected(ComponentName name, IBinder service) { if (DBG) log("onServiceConnected " + name); mIQualifiedNetworksService = IQualifiedNetworksService.Stub.asInterface(service); mDeathRecipient = new AccessNetworksManagerDeathRecipient(); AccessNetworksManagerDeathRecipient deathRecipient = new AccessNetworksManagerDeathRecipient(); mLastBoundPackageName = getQualifiedNetworksServicePackageName(); try { service.linkToDeath(mDeathRecipient, 0 /* flags */); service.linkToDeath(deathRecipient, 0 /* flags */); mIQualifiedNetworksService.createNetworkAvailabilityProvider(mPhone.getPhoneId(), new QualifiedNetworksServiceCallback()); } catch (RemoteException e) { Loading Loading @@ -328,10 +331,7 @@ public class AccessNetworksManager extends Handler { log("onNetworkValidationRequested: networkCapability = [" + DataUtils.networkCapabilityToString(networkCapability) + "]"); dnc.requestNetworkValidation(networkCapability, new Consumer<>() { @Override public void accept(Integer result) { post(() -> { dnc.requestNetworkValidation(networkCapability, result -> post(() -> { try { log("onNetworkValidationRequestDone:" + DataServiceCallback.resultCodeToString(result)); Loading @@ -340,9 +340,7 @@ public class AccessNetworksManager extends Handler { // Ignore if the remote process is no longer available to call back. loge("onNetworkValidationRequestDone RemoteException" + e); } }); } }); })); } @Override Loading
src/java/com/android/internal/telephony/data/AutoDataSwitchController.java +51 −38 Original line number Diff line number Diff line Loading @@ -137,17 +137,26 @@ public class AutoDataSwitchController extends Handler { private static final long RETRY_LONG_DELAY_TIMER_THRESHOLD_MILLIS = TimeUnit .MINUTES.toMillis(1); private final @NonNull LocalLog mLocalLog = new LocalLog(128); private final @NonNull Context mContext; private static @NonNull FeatureFlags sFeatureFlags = new FeatureFlagsImpl(); private final @NonNull SubscriptionManagerService mSubscriptionManagerService; private final @NonNull PhoneSwitcher mPhoneSwitcher; private final @NonNull AutoDataSwitchControllerCallback mPhoneSwitcherCallback; private final @NonNull AlarmManager mAlarmManager; @NonNull private final LocalLog mLocalLog = new LocalLog(128); @NonNull private final Context mContext; @NonNull private static FeatureFlags sFeatureFlags = new FeatureFlagsImpl(); @NonNull private final SubscriptionManagerService mSubscriptionManagerService; @NonNull private final PhoneSwitcher mPhoneSwitcher; @NonNull private final AutoDataSwitchControllerCallback mPhoneSwitcherCallback; @NonNull private final AlarmManager mAlarmManager; /** A map of a scheduled event to its associated extra for action when the event fires off. */ private final @NonNull Map<Integer, Object> mScheduledEventsToExtras; @NonNull private final Map<Integer, Object> mScheduledEventsToExtras; /** A map of an event to its associated alarm listener callback for when the event fires off. */ private final @NonNull Map<Integer, AlarmManager.OnAlarmListener> mEventsToAlarmListener; @NonNull private final Map<Integer, AlarmManager.OnAlarmListener> mEventsToAlarmListener; /** * Event extras for checking environment stability. * @param targetPhoneId The target phone Id to switch to when the stability check pass. Loading Loading @@ -193,7 +202,7 @@ public class AutoDataSwitchController extends Handler { * To indicate whether allow using roaming nDDS if user enabled its roaming when the DDS is not * usable(OOS or disabled roaming) */ private boolean mAllowNddsRoamning = true; private boolean mAllowNddsRoaming = true; /** The count of consecutive auto switch validation failure **/ private int mAutoSwitchValidationFailedCount = 0; /** Loading @@ -202,7 +211,8 @@ public class AutoDataSwitchController extends Handler { private int mAutoDataSwitchValidationMaxRetry; /** The signal status of phones, where index corresponds to phone Id. */ private @NonNull PhoneSignalStatus[] mPhonesSignalStatus; @NonNull private PhoneSignalStatus[] mPhonesSignalStatus; /** * The phone Id of the pending switching phone. Used for pruning frequent switch evaluation. */ Loading Loading @@ -268,23 +278,24 @@ public class AutoDataSwitchController extends Handler { boolean isUsingNonTerrestrialNetwork = sFeatureFlags.carrierEnabledSatelliteFlag() && (serviceState != null) && serviceState.isUsingNonTerrestrialNetwork(); switch (mDataRegState) { case NetworkRegistrationInfo.REGISTRATION_STATE_HOME: return switch (mDataRegState) { case NetworkRegistrationInfo.REGISTRATION_STATE_HOME -> { if (isUsingNonTerrestrialNetwork) { return UsableState.NON_TERRESTRIAL; yield UsableState.NON_TERRESTRIAL; } return UsableState.HOME; case NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING: yield UsableState.HOME; } case NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING -> { if (mPhone.getDataRoamingEnabled()) { if (isUsingNonTerrestrialNetwork) { return UsableState.NON_TERRESTRIAL; yield UsableState.NON_TERRESTRIAL; } return UsableState.ROAMING_ENABLED; yield UsableState.ROAMING_ENABLED; } return UsableState.NOT_USABLE; default: return UsableState.NOT_USABLE; yield UsableState.NOT_USABLE; } default -> UsableState.NOT_USABLE; }; } @Override Loading Loading @@ -450,7 +461,7 @@ public class AutoDataSwitchController extends Handler { DataConfigManager dataConfig = phone.getDataNetworkController().getDataConfigManager(); mScoreTolerance = dataConfig.getAutoDataSwitchScoreTolerance(); mRequirePingTestBeforeSwitch = dataConfig.isPingTestBeforeAutoDataSwitchRequired(); mAllowNddsRoamning = dataConfig.doesAutoDataSwitchAllowRoaming(); mAllowNddsRoaming = dataConfig.doesAutoDataSwitchAllowRoaming(); mAutoDataSwitchAvailabilityStabilityTimeThreshold = dataConfig.getAutoDataSwitchAvailabilityStabilityTimeThreshold(); mAutoDataSwitchPerformanceStabilityTimeThreshold = Loading Loading @@ -929,7 +940,7 @@ public class AutoDataSwitchController extends Handler { * @return {@code true} If the feature of switching to roaming non DDS is enabled. */ private boolean isNddsRoamingEnabled() { return sFeatureFlags.autoDataSwitchAllowRoaming() && mAllowNddsRoamning; return sFeatureFlags.autoDataSwitchAllowRoaming() && mAllowNddsRoaming; } /** Loading Loading @@ -1012,19 +1023,20 @@ public class AutoDataSwitchController extends Handler { } /** Auto data switch evaluation reason to string. */ public static @NonNull String evaluationReasonToString( @NonNull public static String evaluationReasonToString( @AutoDataSwitchEvaluationReason int reason) { switch (reason) { case EVALUATION_REASON_REGISTRATION_STATE_CHANGED: return "REGISTRATION_STATE_CHANGED"; case EVALUATION_REASON_DISPLAY_INFO_CHANGED: return "DISPLAY_INFO_CHANGED"; case EVALUATION_REASON_SIGNAL_STRENGTH_CHANGED: return "SIGNAL_STRENGTH_CHANGED"; case EVALUATION_REASON_DEFAULT_NETWORK_CHANGED: return "DEFAULT_NETWORK_CHANGED"; case EVALUATION_REASON_DATA_SETTINGS_CHANGED: return "DATA_SETTINGS_CHANGED"; case EVALUATION_REASON_RETRY_VALIDATION: return "RETRY_VALIDATION"; case EVALUATION_REASON_SIM_LOADED: return "SIM_LOADED"; case EVALUATION_REASON_VOICE_CALL_END: return "VOICE_CALL_END"; } return "Unknown(" + reason + ")"; return switch (reason) { case EVALUATION_REASON_REGISTRATION_STATE_CHANGED -> "REGISTRATION_STATE_CHANGED"; case EVALUATION_REASON_DISPLAY_INFO_CHANGED -> "DISPLAY_INFO_CHANGED"; case EVALUATION_REASON_SIGNAL_STRENGTH_CHANGED -> "SIGNAL_STRENGTH_CHANGED"; case EVALUATION_REASON_DEFAULT_NETWORK_CHANGED -> "DEFAULT_NETWORK_CHANGED"; case EVALUATION_REASON_DATA_SETTINGS_CHANGED -> "DATA_SETTINGS_CHANGED"; case EVALUATION_REASON_RETRY_VALIDATION -> "RETRY_VALIDATION"; case EVALUATION_REASON_SIM_LOADED -> "SIM_LOADED"; case EVALUATION_REASON_VOICE_CALL_END -> "VOICE_CALL_END"; default -> "Unknown(" + reason + ")"; }; } /** @return {@code true} if the sub is active. */ Loading Loading @@ -1085,8 +1097,9 @@ public class AutoDataSwitchController extends Handler { * @param isDueToAutoSwitch {@code true} if the switch was due to auto data switch feature. */ public void displayAutoDataSwitchNotification(int phoneId, boolean isDueToAutoSwitch) { NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager notificationManager = mContext.getSystemService( NotificationManager.class); if (notificationManager == null) return; if (mDisplayedNotification) { // cancel posted notification if any exist notificationManager.cancel(AUTO_DATA_SWITCH_NOTIFICATION_TAG, Loading
src/java/com/android/internal/telephony/data/CellularDataService.java +15 −11 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telephony.data; import static android.telephony.data.DataServiceCallback.RESULT_SUCCESS; import android.annotation.NonNull; import android.annotation.Nullable; import android.net.LinkProperties; import android.os.AsyncResult; Loading @@ -41,6 +42,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; /** * This class represents cellular data service which handles telephony data requests and response Loading @@ -61,6 +63,7 @@ public class CellularDataService extends DataService { private static final int CANCEL_HANDOVER = 8; private static final int APN_UNTHROTTLED = 9; @SuppressWarnings("unchecked") private class CellularDataServiceProvider extends DataService.DataServiceProvider { private final Map<Message, DataServiceCallback> mCallbackMap = new HashMap<>(); Loading @@ -69,14 +72,15 @@ public class CellularDataService extends DataService { private final Phone mPhone; @SuppressWarnings("unchecked") private CellularDataServiceProvider(int slotId) { super(slotId); mPhone = PhoneFactory.getPhone(getSlotIndex()); mHandler = new Handler(Looper.myLooper()) { mHandler = new Handler(Objects.requireNonNull(Looper.myLooper())) { @Override public void handleMessage(Message message) { public void handleMessage(@NonNull Message message) { DataServiceCallback callback = mCallbackMap.remove(message); AsyncResult ar = (AsyncResult) message.obj; Loading Loading @@ -162,10 +166,10 @@ public class CellularDataService extends DataService { } @Override public void setupDataCall(int accessNetworkType, DataProfile dataProfile, public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties, int pduSessionId, NetworkSliceInfo sliceInfo, TrafficDescriptor trafficDescriptor, boolean matchAllRuleAllowed, DataServiceCallback callback) { boolean matchAllRuleAllowed, @Nullable DataServiceCallback callback) { // TODO: remove isRoaming parameter if (DBG) log("setupDataCall " + getSlotIndex()); Loading Loading @@ -198,8 +202,8 @@ public class CellularDataService extends DataService { } @Override public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, DataServiceCallback callback) { public void setInitialAttachApn(@NonNull DataProfile dataProfile, boolean isRoaming, @Nullable DataServiceCallback callback) { // TODO: remove isRoaming parameter if (DBG) log("setInitialAttachApn " + getSlotIndex()); Loading @@ -215,8 +219,8 @@ public class CellularDataService extends DataService { } @Override public void setDataProfile(List<DataProfile> dps, boolean isRoaming, DataServiceCallback callback) { public void setDataProfile(@NonNull List<DataProfile> dps, boolean isRoaming, @Nullable DataServiceCallback callback) { // TODO: remove isRoaming parameter if (DBG) log("setDataProfile " + getSlotIndex()); Loading @@ -232,7 +236,7 @@ public class CellularDataService extends DataService { } @Override public void requestDataCallList(DataServiceCallback callback) { public void requestDataCallList(@Nullable DataServiceCallback callback) { if (DBG) log("requestDataCallList " + getSlotIndex()); Message message = null; Loading @@ -246,7 +250,7 @@ public class CellularDataService extends DataService { } @Override public void startHandover(int cid, DataServiceCallback callback) { public void startHandover(int cid, @Nullable DataServiceCallback callback) { if (DBG) log("startHandover " + getSlotIndex()); Message message = null; // Only obtain the message when the caller wants a callback. If the caller doesn't care Loading @@ -259,7 +263,7 @@ public class CellularDataService extends DataService { } @Override public void cancelHandover(int cid, DataServiceCallback callback) { public void cancelHandover(int cid, @Nullable DataServiceCallback callback) { Message message = null; // Only obtain the message when the caller wants a callback. If the caller doesn't care // the request completed or results, then no need to pass the message down. Loading