Merge "Adds MSIM config support to PhoneConfigurationManager" into main
diff --git a/flags/telephony.aconfig b/flags/telephony.aconfig
index c6fd2c4..d59b249 100644
--- a/flags/telephony.aconfig
+++ b/flags/telephony.aconfig
@@ -19,4 +19,11 @@
namespace: "telephony"
description: "This flag controls the order of the binder to prevent deadlock in system_server"
bug: "315973270"
+}
+
+flag {
+ name: "prevent_invocation_repeat_of_ril_call_when_device_does_not_support_voice"
+ namespace: "telephony"
+ description: "This flag prevents repeat invocation of call related APIs in RIL when the device is not voice capable"
+ bug: "290833783"
}
\ No newline at end of file
diff --git a/src/java/com/android/internal/telephony/CallTracker.java b/src/java/com/android/internal/telephony/CallTracker.java
index 38c6672..5e617f9 100644
--- a/src/java/com/android/internal/telephony/CallTracker.java
+++ b/src/java/com/android/internal/telephony/CallTracker.java
@@ -16,6 +16,7 @@
package com.android.internal.telephony;
+import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.AsyncResult;
@@ -25,8 +26,11 @@
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.ServiceState;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
+import com.android.internal.telephony.flags.FeatureFlags;
+
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -55,6 +59,9 @@
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
protected boolean mNumberConverted = false;
+
+ protected final @NonNull FeatureFlags mFeatureFlags;
+
private final int VALID_COMPARE_LENGTH = 3;
//***** Events
@@ -77,7 +84,8 @@
protected static final int EVENT_THREE_WAY_DIAL_BLANK_FLASH = 20;
@UnsupportedAppUsage
- public CallTracker() {
+ public CallTracker(FeatureFlags featureFlags) {
+ mFeatureFlags = featureFlags;
}
protected void pollCallsWhenSafe() {
@@ -91,6 +99,14 @@
protected void
pollCallsAfterDelay() {
+ if (mFeatureFlags.preventInvocationRepeatOfRilCallWhenDeviceDoesNotSupportVoice()) {
+ if (!mCi.getHalVersion(TelephonyManager.HAL_SERVICE_VOICE)
+ .greaterOrEqual(RIL.RADIO_HAL_VERSION_1_4)) {
+ log("Skip polling because HAL_SERVICE_VOICE < RADIO_HAL_VERSION_1.4");
+ return;
+ }
+ }
+
Message msg = obtainMessage();
msg.what = EVENT_REPOLL_AFTER_DELAY;
diff --git a/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java b/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java
index d76ee19..5517bc6 100644
--- a/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java
@@ -47,6 +47,7 @@
import com.android.internal.telephony.cdma.CdmaCallWaitingNotification;
import com.android.internal.telephony.domainselection.DomainSelectionResolver;
import com.android.internal.telephony.emergency.EmergencyStateTracker;
+import com.android.internal.telephony.flags.FeatureFlags;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.telephony.Rlog;
@@ -155,7 +156,9 @@
//***** Constructors
- public GsmCdmaCallTracker (GsmCdmaPhone phone) {
+ public GsmCdmaCallTracker(GsmCdmaPhone phone, FeatureFlags featureFlags) {
+ super(featureFlags);
+
this.mPhone = phone;
mCi = phone.mCi;
mCi.registerForCallStateChanged(this, EVENT_CALL_STATE_CHANGE, null);
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
index 7e2143a..18a5262 100644
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
@@ -464,7 +464,7 @@
}
mCT = mTelephonyComponentFactory.inject(GsmCdmaCallTracker.class.getName())
- .makeGsmCdmaCallTracker(this);
+ .makeGsmCdmaCallTracker(this, mFeatureFlags);
mIccPhoneBookIntManager = mTelephonyComponentFactory
.inject(IccPhoneBookInterfaceManager.class.getName())
.makeIccPhoneBookInterfaceManager(this);
@@ -2602,7 +2602,7 @@
Bundle extras = new Bundle();
extras.putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle);
- final TelecomManager telecomManager = TelecomManager.from(mContext);
+ final TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
telecomManager.placeCall(
Uri.fromParts(PhoneAccount.SCHEME_TEL, cfNumber, null), extras);
@@ -2863,7 +2863,7 @@
Bundle extras = new Bundle();
extras.putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle);
- final TelecomManager telecomManager = TelecomManager.from(mContext);
+ final TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
telecomManager.placeCall(
Uri.fromParts(PhoneAccount.SCHEME_TEL, cwPrefix, null), extras);
@@ -5002,7 +5002,7 @@
}
private PhoneAccountHandle subscriptionIdToPhoneAccountHandle(final int subId) {
- final TelecomManager telecomManager = TelecomManager.from(mContext);
+ final TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
final TelephonyManager telephonyManager = TelephonyManager.from(mContext);
final Iterator<PhoneAccountHandle> phoneAccounts =
telecomManager.getCallCapablePhoneAccounts(true).listIterator();
diff --git a/src/java/com/android/internal/telephony/MultiSimSettingController.java b/src/java/com/android/internal/telephony/MultiSimSettingController.java
index d07e731..8488ab0 100644
--- a/src/java/com/android/internal/telephony/MultiSimSettingController.java
+++ b/src/java/com/android/internal/telephony/MultiSimSettingController.java
@@ -420,22 +420,13 @@
return;
}
- // b/153860050 Occasionally we receive carrier config change broadcast without subId
- // being specified in it. So here we do additional check to make sur we don't miss the
- // subId.
- if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
- subId = SubscriptionManager.getSubscriptionId(phoneId);
- if (SubscriptionManager.isValidSubscriptionId(subId)) {
- CarrierConfigManager cm = mContext.getSystemService(CarrierConfigManager.class);
- if (cm != null && cm.getConfigForSubId(subId) != null) {
- loge("onCarrierConfigChanged with invalid subId while subId "
- + subId + " is active and its config is loaded");
- }
+ CarrierConfigManager cm = mContext.getSystemService(CarrierConfigManager.class);
+ if (cm != null) {
+ if (CarrierConfigManager.isConfigForIdentifiedCarrier(cm.getConfigForSubId(subId))) {
+ mCarrierConfigLoadedSubIds[phoneId] = subId;
+ reEvaluateAll();
}
}
-
- mCarrierConfigLoadedSubIds[phoneId] = subId;
- reEvaluateAll();
}
/**
diff --git a/src/java/com/android/internal/telephony/TelephonyComponentFactory.java b/src/java/com/android/internal/telephony/TelephonyComponentFactory.java
index 8b41f6e..2c68457 100644
--- a/src/java/com/android/internal/telephony/TelephonyComponentFactory.java
+++ b/src/java/com/android/internal/telephony/TelephonyComponentFactory.java
@@ -278,8 +278,14 @@
return sInstance;
}
- public GsmCdmaCallTracker makeGsmCdmaCallTracker(GsmCdmaPhone phone) {
- return new GsmCdmaCallTracker(phone);
+ /**
+ * Create a new GsmCdmaCallTracker
+ * @param phone GsmCdmaPhone
+ * @param featureFlags Telephony feature flag
+ */
+ public GsmCdmaCallTracker makeGsmCdmaCallTracker(GsmCdmaPhone phone,
+ @NonNull FeatureFlags featureFlags) {
+ return new GsmCdmaCallTracker(phone, featureFlags);
}
public SmsStorageMonitor makeSmsStorageMonitor(Phone phone) {
diff --git a/src/java/com/android/internal/telephony/data/DataProfileManager.java b/src/java/com/android/internal/telephony/data/DataProfileManager.java
index b4055a3..0aaae30 100644
--- a/src/java/com/android/internal/telephony/data/DataProfileManager.java
+++ b/src/java/com/android/internal/telephony/data/DataProfileManager.java
@@ -34,6 +34,7 @@
import android.telephony.Annotation.NetworkType;
import android.telephony.AnomalyReporter;
import android.telephony.CarrierConfigManager;
+import android.telephony.NetworkRegistrationInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager.SimState;
@@ -818,8 +819,13 @@
})
.collect(Collectors.toList());
if (dataProfiles.size() == 0) {
+ String ntnReason = "";
+ if (mFeatureFlags.carrierEnabledSatelliteFlag()) {
+ ntnReason = " and infrastructure for "
+ + NetworkRegistrationInfo.isNonTerrestrialNetworkToString(isNtn);
+ }
log("Can't find any data profile for network type "
- + TelephonyManager.getNetworkTypeName(networkType));
+ + TelephonyManager.getNetworkTypeName(networkType) + ntnReason);
return null;
}
diff --git a/src/java/com/android/internal/telephony/domainselection/DomainSelectionResolver.java b/src/java/com/android/internal/telephony/domainselection/DomainSelectionResolver.java
index 8a0dcf5..3a109e1 100644
--- a/src/java/com/android/internal/telephony/domainselection/DomainSelectionResolver.java
+++ b/src/java/com/android/internal/telephony/domainselection/DomainSelectionResolver.java
@@ -24,6 +24,7 @@
import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.Context;
+import android.os.SystemProperties;
import android.telephony.DomainSelectionService;
import android.text.TextUtils;
import android.util.IndentingPrintWriter;
@@ -34,6 +35,7 @@
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.flags.Flags;
+import com.android.internal.telephony.util.TelephonyUtils;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -48,6 +50,10 @@
@VisibleForTesting
protected static final String PACKAGE_NAME_NONE = "none";
private static final String TAG = DomainSelectionResolver.class.getSimpleName();
+ private static final boolean DBG = TelephonyUtils.IS_DEBUGGABLE;
+ /** For test purpose only with userdebug release */
+ private static final String PROP_DISABLE_DOMAIN_SELECTION =
+ "telephony.test.disable_domain_selection";
private static DomainSelectionResolver sInstance = null;
/**
@@ -132,6 +138,10 @@
* {@code false} otherwise.
*/
public boolean isDomainSelectionSupported() {
+ if (DBG && SystemProperties.getBoolean(PROP_DISABLE_DOMAIN_SELECTION, false)) {
+ logi("Disabled for test");
+ return false;
+ }
return mDefaultComponentName != null && PhoneFactory.getDefaultPhone()
.getHalVersion(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_1);
}
diff --git a/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java b/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java
index f3c0a6c..85d79ed 100644
--- a/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java
+++ b/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java
@@ -84,7 +84,9 @@
* Timeout before we continue with the emergency call without waiting for DDS switch response
* from the modem.
*/
- private static final int DEFAULT_DATA_SWITCH_TIMEOUT_MS = 1000;
+ private static final int DEFAULT_DATA_SWITCH_TIMEOUT_MS = 1 * 1000;
+ @VisibleForTesting
+ public static final int DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS = 3 * 1000;
/** Default value for if Emergency Callback Mode is supported. */
private static final boolean DEFAULT_EMERGENCY_CALLBACK_MODE_SUPPORTED = true;
/** Default Emergency Callback Mode exit timeout value. */
@@ -1227,6 +1229,11 @@
mRadioOnHelper = new RadioOnHelper(mContext);
}
+ final Phone phoneForEmergency = phone;
+ final String expectedCallId = mOngoingCallId;
+ final int waitForInServiceTimeout =
+ needToTurnOnRadio ? DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS : 0;
+ Rlog.i(TAG, "turnOnRadioAndSwitchDds: timeout=" + waitForInServiceTimeout);
mRadioOnHelper.triggerRadioOnAndListen(new RadioOnStateListener.Callback() {
@Override
public void onComplete(RadioOnStateListener listener, boolean isRadioReady) {
@@ -1241,25 +1248,33 @@
completeEmergencyMode(emergencyType, DisconnectCause.POWER_OFF);
}
} else {
+ if (!Objects.equals(mOngoingCallId, expectedCallId)) {
+ Rlog.i(TAG, "onComplete " + expectedCallId + " canceled.");
+ return;
+ }
switchDdsAndSetEmergencyMode(phone, emergencyType);
}
}
@Override
public boolean isOkToCall(Phone phone, int serviceState, boolean imsVoiceCapable) {
- // We currently only look to make sure that the radio is on before dialing. We
- // should be able to make emergency calls at any time after the radio has been
- // powered on and isn't in the UNAVAILABLE state, even if it is reporting the
- // OUT_OF_SERVICE state.
+ // Wait for normal service state or timeout if required.
+ if (phone == phoneForEmergency
+ && waitForInServiceTimeout > 0
+ && !isNetworkRegistered(phone)) {
+ return false;
+ }
return phone.getServiceStateTracker().isRadioOn()
&& !satelliteController.isSatelliteEnabled();
}
@Override
public boolean onTimeout(Phone phone, int serviceState, boolean imsVoiceCapable) {
- return true;
+ // onTimeout shall be called only with the Phone for emergency
+ return phone.getServiceStateTracker().isRadioOn()
+ && !satelliteController.isSatelliteEnabled();
}
- }, !isTestEmergencyNumber, phone, isTestEmergencyNumber, 0);
+ }, !isTestEmergencyNumber, phone, isTestEmergencyNumber, waitForInServiceTimeout);
} else {
switchDdsAndSetEmergencyMode(phone, emergencyType);
}
@@ -1412,6 +1427,27 @@
|| phone.getServiceState().isEmergencyOnly();
}
+ private static boolean isNetworkRegistered(Phone phone) {
+ ServiceState ss = phone.getServiceStateTracker().getServiceState();
+ if (ss != null) {
+ NetworkRegistrationInfo nri = ss.getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_PS,
+ AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ if (nri != null && nri.isNetworkRegistered()) {
+ // PS is IN_SERVICE state.
+ return true;
+ }
+ nri = ss.getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_CS,
+ AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ if (nri != null && nri.isNetworkRegistered()) {
+ // CS is IN_SERVICE state.
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Checks whether both {@code Phone}s are same or not.
*/
diff --git a/src/java/com/android/internal/telephony/emergency/RadioOnHelper.java b/src/java/com/android/internal/telephony/emergency/RadioOnHelper.java
index 9c4ebfa..384112d 100644
--- a/src/java/com/android/internal/telephony/emergency/RadioOnHelper.java
+++ b/src/java/com/android/internal/telephony/emergency/RadioOnHelper.java
@@ -96,7 +96,7 @@
continue;
}
- int timeoutCallbackInterval = (forEmergencyCall && phone == phoneForEmergencyCall)
+ int timeoutCallbackInterval = (phone == phoneForEmergencyCall)
? emergencyTimeoutIntervalMillis : 0;
mInProgressListeners.add(mListeners.get(i));
mListeners.get(i).waitForRadioOn(phone, this, forEmergencyCall, forEmergencyCall
diff --git a/src/java/com/android/internal/telephony/emergency/RadioOnStateListener.java b/src/java/com/android/internal/telephony/emergency/RadioOnStateListener.java
index 4ba38f0..5949f66 100644
--- a/src/java/com/android/internal/telephony/emergency/RadioOnStateListener.java
+++ b/src/java/com/android/internal/telephony/emergency/RadioOnStateListener.java
@@ -505,7 +505,7 @@
if (mPhone != null) {
subId = mPhone.getSubId();
}
- mSatelliteController.unregisterForSatelliteModemStateChanged(subId, mSatelliteCallback);
+ mSatelliteController.unregisterForModemStateChanged(subId, mSatelliteCallback);
mHandler.removeMessages(MSG_SATELLITE_ENABLED_CHANGED);
}
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsNrSaModeHandler.java b/src/java/com/android/internal/telephony/imsphone/ImsNrSaModeHandler.java
index 6554077..234723f 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsNrSaModeHandler.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsNrSaModeHandler.java
@@ -263,9 +263,10 @@
PersistableBundle bundle = mCarrierConfigManager.getConfigForSubId(mPhone.getSubId(),
KEY_NR_SA_DISABLE_POLICY_INT, KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY);
mNrSaDisablePolicy = bundle.getInt(KEY_NR_SA_DISABLE_POLICY_INT);
- mIsNrSaSupported = Arrays.stream(
- bundle.getIntArray(KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY)).anyMatch(
- value -> value == CARRIER_NR_AVAILABILITY_SA);
+ int[] nrAvailabilities = bundle.getIntArray(KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY);
+ mIsNrSaSupported = nrAvailabilities != null
+ && Arrays.stream(nrAvailabilities).anyMatch(
+ value -> value == CARRIER_NR_AVAILABILITY_SA);
Log.d(TAG, "setNrSaDisablePolicy : NrSaDisablePolicy = "
+ mNrSaDisablePolicy + ", IsNrSaSupported = " + mIsNrSaSupported);
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
index e95433c..85d4fb1 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
@@ -1259,8 +1259,6 @@
}
}
- private @NonNull final FeatureFlags mFeatureFlags;
-
//***** Events
@@ -1273,8 +1271,9 @@
@VisibleForTesting
public ImsPhoneCallTracker(ImsPhone phone, ConnectorFactory factory, Executor executor,
FeatureFlags featureFlags) {
+ super(featureFlags);
+
this.mPhone = phone;
- mFeatureFlags = featureFlags;
mConnectorFactory = factory;
if (executor != null) {
mExecutor = executor;
diff --git a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
index e4d16e7..ae4c1f2 100644
--- a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
+++ b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
@@ -209,7 +209,7 @@
case EVENT_SEND_SATELLITE_DATAGRAM_DONE: {
ar = (AsyncResult) msg.obj;
request = (DatagramDispatcherHandlerRequest) ar.userObj;
- int error = SatelliteServiceUtils.getSatelliteError(ar, "sendSatelliteDatagram");
+ int error = SatelliteServiceUtils.getSatelliteError(ar, "sendDatagram");
SendSatelliteDatagramArgument argument =
(SendSatelliteDatagramArgument) request.argument;
@@ -330,7 +330,7 @@
}
if (mDatagramController.needsWaitingForSatelliteConnected()) {
- logd("sendSatelliteDatagram: wait for satellite connected");
+ logd("sendDatagram: wait for satellite connected");
mDatagramController.updateSendStatus(subId,
SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_WAITING_TO_CONNECT,
getPendingDatagramCount(), SatelliteManager.SATELLITE_RESULT_SUCCESS);
@@ -345,7 +345,7 @@
getPendingDatagramCount(), SatelliteManager.SATELLITE_RESULT_SUCCESS);
sendRequestAsync(CMD_SEND_SATELLITE_DATAGRAM, datagramArgs, phone);
} else {
- logd("sendSatelliteDatagram: mSendingDatagramInProgress="
+ logd("sendDatagram: mSendingDatagramInProgress="
+ mSendingDatagramInProgress + ", isPollingInIdleState="
+ mDatagramController.isPollingInIdleState());
}
diff --git a/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java b/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java
index 3ac1bbd..c267fd7 100644
--- a/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java
+++ b/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java
@@ -588,13 +588,14 @@
@NonNull Consumer<Integer> callback) {
if (!mDatagramController.isSendingInIdleState()) {
// Poll request should be sent to satellite modem only when it is free.
- logd("pollPendingSatelliteDatagrams: satellite modem is busy sending datagrams.");
+ logd("pollPendingSatelliteDatagramsInternal: satellite modem is busy sending "
+ + "datagrams.");
callback.accept(SatelliteManager.SATELLITE_RESULT_MODEM_BUSY);
return;
}
if (mDatagramController.needsWaitingForSatelliteConnected()) {
- logd("pollPendingSatelliteDatagrams: wait for satellite connected");
+ logd("pollPendingSatelliteDatagramsInternal: wait for satellite connected");
synchronized (mLock) {
mPendingPollSatelliteDatagramsRequest = new DatagramReceiverHandlerRequest(
callback, SatelliteServiceUtils.getPhone(), subId);
diff --git a/src/java/com/android/internal/telephony/satellite/NtnCapabilityResolver.java b/src/java/com/android/internal/telephony/satellite/NtnCapabilityResolver.java
index 4d294f4..add01c0 100644
--- a/src/java/com/android/internal/telephony/satellite/NtnCapabilityResolver.java
+++ b/src/java/com/android/internal/telephony/satellite/NtnCapabilityResolver.java
@@ -40,7 +40,7 @@
public static void resolveNtnCapability(
@NonNull NetworkRegistrationInfo networkRegistrationInfo, int subId) {
SatelliteController satelliteController = SatelliteController.getInstance();
- List<String> satellitePlmnList = satelliteController.getAllSatellitePlmnsForCarrier(subId);
+ List<String> satellitePlmnList = satelliteController.getSatellitePlmnsForCarrier(subId);
String registeredPlmn = networkRegistrationInfo.getRegisteredPlmn();
for (String satellitePlmn : satellitePlmnList) {
if (TextUtils.equals(satellitePlmn, registeredPlmn)) {
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteController.java b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
index a39862e..aaabaff 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
@@ -318,10 +318,24 @@
private int mEnforcedEmergencyCallToSatelliteHandoverType =
INVALID_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE;
private int mDelayInSendingEventDisplayEmergencyMessage = 0;
- private boolean mCarrierSatelliteEnabled;
@NonNull private SharedPreferences mSharedPreferences = null;
/**
+ * Key : Subscription ID, Value: {@code true} if the EntitlementStatus is enabled,
+ * {@code false} otherwise.
+ */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ private SparseBooleanArray mSatelliteEntitlementStatusPerCarrier = new SparseBooleanArray();
+ /** Key Subscription ID, value : PLMN allowed list from entitlement. */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ private SparseArray<List<String>> mEntitlementPlmnListPerCarrier = new SparseArray<>();
+ /**
+ * Key : Subscription ID, Value : If there is an entitlementPlmnList, use it. Otherwise, use the
+ * carrierPlmnList. */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ private final SparseArray<List<String>> mMergedPlmnListPerCarrier = new SparseArray<>();
+
+ /**
* @return The singleton instance of SatelliteController.
*/
public static SatelliteController getInstance() {
@@ -1063,7 +1077,7 @@
logd("pollPendingSatelliteDatagram result: " + result);
}
};
- pollPendingSatelliteDatagrams(
+ pollPendingDatagrams(
SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, internalCallback);
break;
@@ -1687,16 +1701,16 @@
* @param callback The callback that was passed to
* {@link #registerForSatelliteModemStateChanged(int, ISatelliteModemStateCallback)}.
*/
- public void unregisterForSatelliteModemStateChanged(int subId,
+ public void unregisterForModemStateChanged(int subId,
@NonNull ISatelliteModemStateCallback callback) {
if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
- logd("unregisterForSatelliteModemStateChanged: oemEnabledSatelliteFlag is disabled");
+ logd("unregisterForModemStateChanged: oemEnabledSatelliteFlag is disabled");
return;
}
if (mSatelliteSessionController != null) {
mSatelliteSessionController.unregisterForSatelliteModemStateChanged(callback);
} else {
- loge("unregisterForSatelliteModemStateChanged: mSatelliteSessionController"
+ loge("unregisterForModemStateChanged: mSatelliteSessionController"
+ " is not initialized yet");
}
}
@@ -1709,16 +1723,16 @@
*
* @return The {@link SatelliteManager.SatelliteResult} result of the operation.
*/
- @SatelliteManager.SatelliteResult public int registerForSatelliteDatagram(int subId,
+ @SatelliteManager.SatelliteResult public int registerForIncomingDatagram(int subId,
@NonNull ISatelliteDatagramCallback callback) {
if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
- logd("registerForSatelliteDatagram: oemEnabledSatelliteFlag is disabled");
+ logd("registerForIncomingDatagram: oemEnabledSatelliteFlag is disabled");
return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED;
}
if (!mSatelliteModemInterface.isSatelliteServiceSupported()) {
return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED;
}
- logd("registerForSatelliteDatagram: callback=" + callback);
+ logd("registerForIncomingDatagram: callback=" + callback);
return mDatagramController.registerForSatelliteDatagram(subId, callback);
}
@@ -1728,18 +1742,18 @@
*
* @param subId The subId of the subscription to unregister for incoming satellite datagrams.
* @param callback The callback that was passed to
- * {@link #registerForSatelliteDatagram(int, ISatelliteDatagramCallback)}.
+ * {@link #registerForIncomingDatagram(int, ISatelliteDatagramCallback)}.
*/
- public void unregisterForSatelliteDatagram(int subId,
+ public void unregisterForIncomingDatagram(int subId,
@NonNull ISatelliteDatagramCallback callback) {
if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
- logd("unregisterForSatelliteDatagram: oemEnabledSatelliteFlag is disabled");
+ logd("unregisterForIncomingDatagram: oemEnabledSatelliteFlag is disabled");
return;
}
if (!mSatelliteModemInterface.isSatelliteServiceSupported()) {
return;
}
- logd("unregisterForSatelliteDatagram: callback=" + callback);
+ logd("unregisterForIncomingDatagram: callback=" + callback);
mDatagramController.unregisterForSatelliteDatagram(subId, callback);
}
@@ -1754,7 +1768,7 @@
* @param subId The subId of the subscription used for receiving datagrams.
* @param callback The callback to get {@link SatelliteManager.SatelliteResult} of the request.
*/
- public void pollPendingSatelliteDatagrams(int subId, @NonNull IIntegerConsumer callback) {
+ public void pollPendingDatagrams(int subId, @NonNull IIntegerConsumer callback) {
Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
int error = evaluateOemSatelliteRequestAllowed(true);
if (error != SATELLITE_RESULT_SUCCESS) {
@@ -1782,7 +1796,7 @@
* full screen mode.
* @param callback The callback to get {@link SatelliteManager.SatelliteResult} of the request.
*/
- public void sendSatelliteDatagram(int subId, @SatelliteManager.DatagramType int datagramType,
+ public void sendDatagram(int subId, @SatelliteManager.DatagramType int datagramType,
SatelliteDatagram datagram, boolean needFullScreenPointingUI,
@NonNull IIntegerConsumer callback) {
logd("sendSatelliteDatagram: subId: " + subId + " datagramType: " + datagramType
@@ -1868,14 +1882,14 @@
* @param reason Reason for disallowing satellite communication for carrier.
* @param callback The callback to get the result of the request.
*/
- public void addSatelliteAttachRestrictionForCarrier(int subId,
+ public void addAttachRestrictionForCarrier(int subId,
@SatelliteManager.SatelliteCommunicationRestrictionReason int reason,
@NonNull IIntegerConsumer callback) {
- if (DBG) logd("addSatelliteAttachRestrictionForCarrier(" + subId + ", " + reason + ")");
+ if (DBG) logd("addAttachRestrictionForCarrier(" + subId + ", " + reason + ")");
Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
result.accept(SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED);
- logd("addSatelliteAttachRestrictionForCarrier: carrierEnabledSatelliteFlag is "
+ logd("addAttachRestrictionForCarrier: carrierEnabledSatelliteFlag is "
+ "disabled");
return;
}
@@ -1907,14 +1921,14 @@
* @param reason Reason for disallowing satellite communication.
* @param callback The callback to get the result of the request.
*/
- public void removeSatelliteAttachRestrictionForCarrier(int subId,
+ public void removeAttachRestrictionForCarrier(int subId,
@SatelliteManager.SatelliteCommunicationRestrictionReason int reason,
@NonNull IIntegerConsumer callback) {
- if (DBG) logd("removeSatelliteAttachRestrictionForCarrier(" + subId + ", " + reason + ")");
+ if (DBG) logd("removeAttachRestrictionForCarrier(" + subId + ", " + reason + ")");
Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
result.accept(SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED);
- logd("removeSatelliteAttachRestrictionForCarrier: carrierEnabledSatelliteFlag is "
+ logd("removeAttachRestrictionForCarrier: carrierEnabledSatelliteFlag is "
+ "disabled");
return;
}
@@ -1937,15 +1951,15 @@
/**
* Get reasons for disallowing satellite communication, as requested by
- * {@link #addSatelliteAttachRestrictionForCarrier(int, int, IIntegerConsumer)}.
+ * {@link #addAttachRestrictionForCarrier(int, int, IIntegerConsumer)}.
*
* @param subId The subId of the subscription to request for.
*
* @return Set of reasons for disallowing satellite attach for carrier.
*/
- @NonNull public Set<Integer> getSatelliteAttachRestrictionReasonsForCarrier(int subId) {
+ @NonNull public Set<Integer> getAttachRestrictionReasonsForCarrier(int subId) {
if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
- logd("getSatelliteAttachRestrictionReasonsForCarrier: carrierEnabledSatelliteFlag is "
+ logd("getAttachRestrictionReasonsForCarrier: carrierEnabledSatelliteFlag is "
+ "disabled");
return new HashSet<>();
}
@@ -2043,9 +2057,9 @@
*
* @return The {@link SatelliteManager.SatelliteResult} result of the operation.
*/
- @SatelliteManager.SatelliteResult public int registerForSatelliteCapabilitiesChanged(
+ @SatelliteManager.SatelliteResult public int registerForCapabilitiesChanged(
int subId, @NonNull ISatelliteCapabilitiesCallback callback) {
- if (DBG) logd("registerForSatelliteCapabilitiesChanged()");
+ if (DBG) logd("registerForCapabilitiesChanged()");
int error = evaluateOemSatelliteRequestAllowed(true);
if (error != SATELLITE_RESULT_SUCCESS) return error;
@@ -2061,11 +2075,11 @@
* @param subId The id of the subscription to unregister for listening satellite capabilities
* changed event.
* @param callback The callback that was passed to
- * {@link #registerForSatelliteCapabilitiesChanged(int, ISatelliteCapabilitiesCallback)}
+ * {@link #registerForCapabilitiesChanged(int, ISatelliteCapabilitiesCallback)}
*/
- public void unregisterForSatelliteCapabilitiesChanged(
+ public void unregisterForCapabilitiesChanged(
int subId, @NonNull ISatelliteCapabilitiesCallback callback) {
- if (DBG) logd("unregisterForSatelliteCapabilitiesChanged()");
+ if (DBG) logd("unregisterForCapabilitiesChanged()");
int error = evaluateOemSatelliteRequestAllowed(true);
if (error == SATELLITE_RESULT_SUCCESS) {
@@ -2328,17 +2342,13 @@
* @return The list of satellite PLMNs used for connecting to satellite networks.
*/
@NonNull
- public List<String> getAllSatellitePlmnsForCarrier(int subId) {
+ public List<String> getSatellitePlmnsForCarrier(int subId) {
if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
- logd("getAllSatellitePlmnsForCarrier: carrierEnabledSatelliteFlag is disabled");
+ logd("getSatellitePlmnsForCarrier: carrierEnabledSatelliteFlag is disabled");
return new ArrayList<>();
}
synchronized (mSupportedSatelliteServicesLock) {
- if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {
- return new ArrayList<>(mSatelliteServicesSupportedByCarriers.get(subId).keySet());
- } else {
- return new ArrayList<>();
- }
+ return mMergedPlmnListPerCarrier.get(subId, new ArrayList<>()).stream().toList();
}
}
@@ -2480,22 +2490,21 @@
}
/**
- * Update the satellite EntitlementStatus and PlmnAllowedList after receiving the HTTP response
- * from the satellite entitlement server.
- * If the satellite service is enabled then trigger internal satellite enabled for carrier,
- * otherwise trigger internal satellite disabled for carrier.
+ * To use the satellite service, update the EntitlementStatus and the PlmnAllowedList after
+ * receiving the satellite configuration from the entitlement server. If satellite
+ * entitlement is enabled, enable satellite for the carrier. Otherwise, disable satellite.
+ *
+ * @param subId subId
+ * @param entitlementEnabled {@code true} Satellite service enabled
+ * @param allowedPlmnList plmn allowed list to use the satellite service
+ * @param callback callback for accept
*/
- public void updateSatelliteEntitlementStatus(int subId, boolean satelliteEnabled,
- List<String> plmnAllowed, IIntegerConsumer callback) {
+ public void onSatelliteEntitlementStatusUpdated(int subId, boolean entitlementEnabled,
+ List<String> allowedPlmnList, @Nullable IIntegerConsumer callback) {
if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
return;
}
- if (mCarrierSatelliteEnabled != satelliteEnabled) {
- logd("update the carrier satellite enabled to " + satelliteEnabled);
- mCarrierSatelliteEnabled = satelliteEnabled;
- }
-
if (callback == null) {
callback = new IIntegerConsumer.Stub() {
@Override
@@ -2505,12 +2514,25 @@
};
}
- if (mCarrierSatelliteEnabled) {
- removeSatelliteAttachRestrictionForCarrier(subId,
- SATELLITE_COMMUNICATION_RESTRICTION_REASON_ENTITLEMENT, callback);
- } else {
- addSatelliteAttachRestrictionForCarrier(subId,
- SATELLITE_COMMUNICATION_RESTRICTION_REASON_ENTITLEMENT, callback);
+ synchronized (mSupportedSatelliteServicesLock) {
+ if (mSatelliteEntitlementStatusPerCarrier.get(subId, false) != entitlementEnabled) {
+ logd("update the carrier satellite enabled to " + entitlementEnabled);
+ mSatelliteEntitlementStatusPerCarrier.put(subId, entitlementEnabled);
+ }
+ mMergedPlmnListPerCarrier.remove(subId);
+
+ mEntitlementPlmnListPerCarrier.put(subId, allowedPlmnList);
+ updatePlmnListPerCarrier(subId);
+ configureSatellitePlmnForCarrier(subId);
+
+ // TODO b/322143408 store entitlement status in telephony db.
+ if (mSatelliteEntitlementStatusPerCarrier.get(subId, false)) {
+ removeAttachRestrictionForCarrier(subId,
+ SATELLITE_COMMUNICATION_RESTRICTION_REASON_ENTITLEMENT, callback);
+ } else {
+ addAttachRestrictionForCarrier(subId,
+ SATELLITE_COMMUNICATION_RESTRICTION_REASON_ENTITLEMENT, callback);
+ }
}
}
@@ -2732,7 +2754,7 @@
registerForPendingDatagramCount();
registerForSatelliteModemStateChanged();
registerForNtnSignalStrengthChanged();
- registerForSatelliteCapabilitiesChanged();
+ registerForCapabilitiesChanged();
requestIsSatelliteProvisioned(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID,
new ResultReceiver(this) {
@@ -2818,9 +2840,9 @@
}
}
- private void registerForSatelliteCapabilitiesChanged() {
+ private void registerForCapabilitiesChanged() {
if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
- logd("registerForSatelliteCapabilitiesChanged: oemEnabledSatelliteFlag is disabled");
+ logd("registerForCapabilitiesChanged: oemEnabledSatelliteFlag is disabled");
return;
}
@@ -3021,13 +3043,8 @@
return;
}
synchronized (mSupportedSatelliteServicesLock) {
- List<String> carrierPlmnList;
- if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {
- carrierPlmnList =
- mSatelliteServicesSupportedByCarriers.get(subId).keySet().stream().toList();
- } else {
- carrierPlmnList = new ArrayList<>();
- }
+ List<String> carrierPlmnList = mMergedPlmnListPerCarrier.get(subId,
+ new ArrayList<>()).stream().toList();
int slotId = SubscriptionManager.getSlotIndex(subId);
mSatelliteModemInterface.setSatellitePlmn(slotId, carrierPlmnList,
SatelliteServiceUtils.mergeStrLists(
@@ -3050,6 +3067,7 @@
synchronized (mSupportedSatelliteServicesLock) {
mSatelliteServicesSupportedByCarriers.clear();
+ mMergedPlmnListPerCarrier.clear();
int[] activeSubIds = mSubscriptionManagerService.getActiveSubIdList(true);
if (activeSubIds != null) {
for (int subId : activeSubIds) {
@@ -3062,10 +3080,37 @@
}
}
+ /**
+ * If the entitlementPlmnList exist then used it.
+ * Otherwise, If the carrierPlmnList exist then used it.
+ */
+ private void updatePlmnListPerCarrier(int subId) {
+ synchronized (mSupportedSatelliteServicesLock) {
+ List<String> carrierPlmnList, entitlementPlmnList;
+ entitlementPlmnList = mEntitlementPlmnListPerCarrier.get(subId,
+ new ArrayList<>()).stream().toList();
+ if (!entitlementPlmnList.isEmpty()) {
+ mMergedPlmnListPerCarrier.put(subId, entitlementPlmnList);
+ logd("update it using entitlementPlmnList=" + entitlementPlmnList);
+ return;
+ }
+
+ if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {
+ carrierPlmnList =
+ mSatelliteServicesSupportedByCarriers.get(subId).keySet().stream().toList();
+ } else {
+ carrierPlmnList = new ArrayList<>();
+ }
+ mMergedPlmnListPerCarrier.put(subId, carrierPlmnList);
+ logd("update it using carrierPlmnList=" + carrierPlmnList);
+ }
+ }
+
private void updateSupportedSatelliteServices(int subId) {
synchronized (mSupportedSatelliteServicesLock) {
mSatelliteServicesSupportedByCarriers.put(
subId, readSupportedSatelliteServicesFromCarrierConfig(subId));
+ updatePlmnListPerCarrier(subId);
}
}
@@ -3116,6 +3161,8 @@
}
updateCarrierConfig(subId);
+ // TODO b/322143408 read the telephony db to get the entitlementStatus and update the
+ // restriction
updateSupportedSatelliteServicesForActiveSubscriptions();
configureSatellitePlmnForCarrier(subId);
@@ -3300,7 +3347,7 @@
* <ul>
* <li>Users want to enable it.</li>
* <li>There is no satellite communication restriction, which is added by
- * {@link #addSatelliteAttachRestrictionForCarrier(int, int, IIntegerConsumer)}</li>
+ * {@link #addAttachRestrictionForCarrier(int, int, IIntegerConsumer)}</li>
* <li>The carrier config {@link
* android.telephony.CarrierConfigManager#KEY_SATELLITE_ATTACH_SUPPORTED_BOOL} is set to
* {@code true}.</li>
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteModemInterface.java b/src/java/com/android/internal/telephony/satellite/SatelliteModemInterface.java
index 2d1a347..900e124 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteModemInterface.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteModemInterface.java
@@ -915,18 +915,18 @@
@Override
public void accept(int result) {
int error = SatelliteServiceUtils.fromSatelliteError(result);
- logd("pollPendingSatelliteDatagrams: " + error);
+ logd("pollPendingDatagrams: " + error);
Binder.withCleanCallingIdentity(() ->
sendMessageWithResult(message, null, error));
}
});
} catch (RemoteException e) {
- loge("pollPendingSatelliteDatagrams: RemoteException " + e);
+ loge("pollPendingDatagrams: RemoteException " + e);
sendMessageWithResult(message, null,
SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR);
}
} else {
- loge("pollPendingSatelliteDatagrams: Satellite service is unavailable.");
+ loge("pollPendingDatagrams: Satellite service is unavailable.");
sendMessageWithResult(message, null,
SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE);
}
@@ -951,18 +951,18 @@
@Override
public void accept(int result) {
int error = SatelliteServiceUtils.fromSatelliteError(result);
- logd("sendSatelliteDatagram: " + error);
+ logd("sendDatagram: " + error);
Binder.withCleanCallingIdentity(() ->
sendMessageWithResult(message, null, error));
}
});
} catch (RemoteException e) {
- loge("sendSatelliteDatagram: RemoteException " + e);
+ loge("sendDatagram: RemoteException " + e);
sendMessageWithResult(message, null,
SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR);
}
} else {
- loge("sendSatelliteDatagram: Satellite service is unavailable.");
+ loge("sendDatagram: Satellite service is unavailable.");
sendMessageWithResult(message, null,
SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE);
}
@@ -1021,7 +1021,7 @@
@Override
public void accept(int result) {
int error = SatelliteServiceUtils.fromSatelliteError(result);
- logd("requestIsSatelliteCommunicationAllowedForCurrentLocation: "
+ logd("requestIsCommunicationAllowedForCurrentLocation: "
+ error);
Binder.withCleanCallingIdentity(() ->
sendMessageWithResult(message, null, error));
@@ -1029,7 +1029,7 @@
}, new IBooleanConsumer.Stub() {
@Override
public void accept(boolean result) {
- logd("requestIsSatelliteCommunicationAllowedForCurrentLocation: "
+ logd("requestIsCommunicationAllowedForCurrentLocation: "
+ result);
Binder.withCleanCallingIdentity(() -> sendMessageWithResult(
message, result,
@@ -1037,13 +1037,13 @@
}
});
} catch (RemoteException e) {
- loge("requestIsSatelliteCommunicationAllowedForCurrentLocation: RemoteException "
+ loge("requestIsCommunicationAllowedForCurrentLocation: RemoteException "
+ e);
sendMessageWithResult(message, null,
SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR);
}
} else {
- loge("requestIsSatelliteCommunicationAllowedForCurrentLocation: "
+ loge("requestIsCommunicationAllowedForCurrentLocation: "
+ "Satellite service is unavailable.");
sendMessageWithResult(message, null,
SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE);
@@ -1236,10 +1236,13 @@
}
}, new INtnSignalStrengthConsumer.Stub() {
@Override
- public void accept(NtnSignalStrength result) {
- logd("requestNtnSignalStrength: " + result);
+ public void accept(
+ android.telephony.satellite.stub.NtnSignalStrength result) {
+ NtnSignalStrength ntnSignalStrength =
+ SatelliteServiceUtils.fromNtnSignalStrength(result);
+ logd("requestNtnSignalStrength: " + ntnSignalStrength);
Binder.withCleanCallingIdentity(() -> sendMessageWithResult(
- message, result,
+ message, ntnSignalStrength,
SatelliteManager.SATELLITE_RESULT_SUCCESS));
}
});
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java b/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
index aabf826..149b054 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
@@ -696,7 +696,7 @@
protected void requestIsSatelliteCommunicationAllowedForCurrentLocation(
@NonNull OutcomeReceiver<Boolean, SatelliteManager.SatelliteException> callback) {
SatelliteManager satelliteManager = mContext.getSystemService(SatelliteManager.class);
- satelliteManager.requestIsSatelliteCommunicationAllowedForCurrentLocation(
+ satelliteManager.requestIsCommunicationAllowedForCurrentLocation(
this::post, callback);
}
diff --git a/src/java/com/android/internal/telephony/subscription/SubscriptionInfoInternal.java b/src/java/com/android/internal/telephony/subscription/SubscriptionInfoInternal.java
index c6fc23d..aa460d5 100644
--- a/src/java/com/android/internal/telephony/subscription/SubscriptionInfoInternal.java
+++ b/src/java/com/android/internal/telephony/subscription/SubscriptionInfoInternal.java
@@ -444,7 +444,7 @@
/**
* Whether satellite attach for carrier is enabled or disabled by user.
- * By default, its disabled. It is intended to use integer to fit the database format.
+ * By default, its enabled. It is intended to use integer to fit the database format.
*/
private final int mIsSatelliteAttachEnabledForCarrier;
@@ -1750,7 +1750,7 @@
/**
* Whether satellite attach for carrier is enabled by user.
*/
- private int mIsSatelliteAttachEnabledForCarrier = 0;
+ private int mIsSatelliteAttachEnabledForCarrier = 1;
/**
* Whether this subscription is used for communicating with non-terrestrial network or not.
diff --git a/tests/telephonytests/src/com/android/internal/telephony/FakeTelephonyProvider.java b/tests/telephonytests/src/com/android/internal/telephony/FakeTelephonyProvider.java
index c4b957e..7dd4093 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/FakeTelephonyProvider.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/FakeTelephonyProvider.java
@@ -130,7 +130,7 @@
+ UserHandle.USER_NULL + ","
+ Telephony.SimInfo.COLUMN_SATELLITE_ENABLED + " INTEGER DEFAULT 0,"
+ Telephony.SimInfo.COLUMN_SATELLITE_ATTACH_ENABLED_FOR_CARRIER
- + " INTEGER DEFAULT 0, "
+ + " INTEGER DEFAULT 1, "
+ Telephony.SimInfo.COLUMN_IS_NTN + " INTEGER DEFAULT 0,"
+ Telephony.SimInfo.COLUMN_SERVICE_CAPABILITIES + " INTEGER DEFAULT 7"
+ ");";
diff --git a/tests/telephonytests/src/com/android/internal/telephony/GsmCdmaCallTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/GsmCdmaCallTrackerTest.java
index c1f0c5f..7de75ae 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/GsmCdmaCallTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/GsmCdmaCallTrackerTest.java
@@ -75,7 +75,7 @@
mSimulatedCommands.setRadioPower(true, null);
mPhone.mCi = this.mSimulatedCommands;
- mCTUT = new GsmCdmaCallTracker(mPhone);
+ mCTUT = new GsmCdmaCallTracker(mPhone, mFeatureFlags);
logd("GsmCdmaCallTracker initiated, waiting for Power on");
/* Make sure radio state is power on before dial.
* When radio state changed from off to on, CallTracker
diff --git a/tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java
index c9a497e..4c68e26 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/MultiSimSettingControllerTest.java
@@ -247,6 +247,10 @@
return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}).when(mPhoneMock2).getSubId();
+ PersistableBundle bundle = new PersistableBundle();
+ bundle.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
+ doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(anyInt());
+
replaceInstance(PhoneFactory.class, "sPhones", null, mPhones);
// Capture listener to emulate the carrier config change notification used later
ArgumentCaptor<CarrierConfigManager.CarrierConfigChangeListener> listenerArgumentCaptor =
@@ -885,6 +889,13 @@
doReturn(true).when(mPhoneMock2).isUserDataEnabled();
mMultiSimSettingControllerUT.notifyAllSubscriptionLoaded();
processAllMessages();
+
+ PersistableBundle bundle = new PersistableBundle();
+ bundle.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
+ doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(eq(1));
+ PersistableBundle bundle2 = new PersistableBundle();
+ doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(eq(2));
+
sendCarrierConfigChanged(0, 1);
// Notify carrier config change on phone1 without specifying subId.
sendCarrierConfigChanged(1, SubscriptionManager.INVALID_SUBSCRIPTION_ID);
@@ -893,13 +904,9 @@
verify(mDataSettingsManagerMock2, never()).setDataEnabled(
TelephonyManager.DATA_ENABLED_REASON_USER, false, PHONE_PACKAGE);
- // Still notify carrier config without specifying subId2, but this time subController
- // and CarrierConfigManager have subId 2 active and ready.
- doReturn(2).when(mSubscriptionManagerService).getSubId(1);
- CarrierConfigManager cm = (CarrierConfigManager) mContext.getSystemService(
- mContext.CARRIER_CONFIG_SERVICE);
- doReturn(new PersistableBundle()).when(cm).getConfigForSubId(2);
- sendCarrierConfigChanged(1, SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+ logd("Sending the correct phone id and sub id");
+ bundle2.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
+ sendCarrierConfigChanged(1, 2);
processAllMessages();
// This time user data should be disabled on phone1.
verify(mDataSettingsManagerMock2).setDataEnabled(
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
index 4fa42c9..1a6557b 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
@@ -260,7 +260,7 @@
mSatelliteController = Mockito.mock(SatelliteController.class);
replaceInstance(SatelliteController.class, "sInstance", null,
mSatelliteController);
- doReturn(new ArrayList<>()).when(mSatelliteController).getAllSatellitePlmnsForCarrier(
+ doReturn(new ArrayList<>()).when(mSatelliteController).getSatellitePlmnsForCarrier(
anyInt());
mContextFixture.putResource(R.string.kg_text_message_separator, " \u2014 ");
@@ -3387,7 +3387,7 @@
CellIdentityGsm cellIdentity =
new CellIdentityGsm(0, 1, 900, 5, "101", "23", "test", "tst",
Collections.emptyList());
- doReturn(Arrays.asList("10123")).when(mSatelliteController).getAllSatellitePlmnsForCarrier(
+ doReturn(Arrays.asList("10123")).when(mSatelliteController).getSatellitePlmnsForCarrier(
anyInt());
doReturn(satelliteSupportedServiceList).when(mSatelliteController)
.getSupportedSatelliteServices(sst.mSubId, "10123");
diff --git a/tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java b/tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java
index b515372..78b5e8c 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java
@@ -635,7 +635,7 @@
nullable(IccCardStatus.class), anyInt(), nullable(UiccCard.class),
nullable(Object.class), any(FeatureFlags.class));
doReturn(mCT).when(mTelephonyComponentFactory)
- .makeGsmCdmaCallTracker(nullable(GsmCdmaPhone.class));
+ .makeGsmCdmaCallTracker(nullable(GsmCdmaPhone.class), any(FeatureFlags.class));
doReturn(mIccPhoneBookIntManager).when(mTelephonyComponentFactory)
.makeIccPhoneBookInterfaceManager(nullable(Phone.class));
doReturn(mDisplayInfoController).when(mTelephonyComponentFactory)
diff --git a/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java
index 27b53ad..7704218 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java
@@ -23,6 +23,7 @@
import static com.android.internal.telephony.emergency.EmergencyConstants.MODE_EMERGENCY_CALLBACK;
import static com.android.internal.telephony.emergency.EmergencyConstants.MODE_EMERGENCY_WLAN;
import static com.android.internal.telephony.emergency.EmergencyConstants.MODE_EMERGENCY_WWAN;
+import static com.android.internal.telephony.emergency.EmergencyStateTracker.DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -52,9 +53,11 @@
import android.os.Message;
import android.os.UserHandle;
import android.provider.Settings;
+import android.telephony.AccessNetworkConstants;
import android.telephony.CarrierConfigManager;
import android.telephony.DisconnectCause;
import android.telephony.EmergencyRegResult;
+import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyCallback;
@@ -151,6 +154,13 @@
false /* isRadioOn */);
setConfigForDdsSwitch(testPhone, null,
CarrierConfigManager.Gps.SUPL_EMERGENCY_MODE_TYPE_DP_ONLY, "150");
+ ServiceState ss = mock(ServiceState.class);
+ doReturn(ss).when(mSST).getServiceState();
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .build();
+ doReturn(nri).when(ss).getNetworkRegistrationInfo(anyInt(), anyInt());
// Spy is used to capture consumer in delayDialForDdsSwitch
EmergencyStateTracker spyEst = spy(emergencyStateTracker);
CompletableFuture<Integer> unused = spyEst.startEmergencyCall(testPhone, TEST_CALL_ID,
@@ -160,13 +170,77 @@
ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
.forClass(RadioOnStateListener.Callback.class);
verify(mRadioOnHelper).triggerRadioOnAndListen(callback.capture(), eq(true), eq(testPhone),
- eq(false), eq(0));
- // isOkToCall() should return true once radio is on
+ eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS));
+ // isOkToCall() should return true when IN_SERVICE state
assertFalse(callback.getValue()
.isOkToCall(testPhone, ServiceState.STATE_OUT_OF_SERVICE, false));
when(mSST.isRadioOn()).thenReturn(true);
- assertTrue(callback.getValue()
+ assertFalse(callback.getValue()
.isOkToCall(testPhone, ServiceState.STATE_OUT_OF_SERVICE, false));
+
+ nri = new NetworkRegistrationInfo.Builder()
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .setRegistrationState(REGISTRATION_STATE_HOME)
+ .build();
+ doReturn(nri).when(ss).getNetworkRegistrationInfo(anyInt(), anyInt());
+
+ assertTrue(callback.getValue()
+ .isOkToCall(testPhone, ServiceState.STATE_IN_SERVICE, false));
+ // Once radio on is complete, trigger delay dial
+ callback.getValue().onComplete(null, true);
+ ArgumentCaptor<Consumer<Boolean>> completeConsumer = ArgumentCaptor
+ .forClass(Consumer.class);
+ verify(spyEst).switchDdsDelayed(eq(testPhone), completeConsumer.capture());
+ verify(mPhoneSwitcher).overrideDefaultDataForEmergency(eq(testPhone.getPhoneId()),
+ eq(150) /* extensionTime */, any());
+ // After dds switch completes successfully, set emergency mode
+ completeConsumer.getValue().accept(true);
+ verify(testPhone).setEmergencyMode(eq(MODE_EMERGENCY_WWAN), any());
+ }
+
+ /**
+ * Test that the EmergencyStateTracker turns on radio, performs a DDS switch and sets emergency
+ * mode switch when we are not roaming and the carrier only supports SUPL over the data plane.
+ */
+ @Test
+ @SmallTest
+ public void startEmergencyCall_radioOff_turnOnRadioTimeoutSwitchDdsAndSetEmergencyMode() {
+ EmergencyStateTracker emergencyStateTracker = setupEmergencyStateTracker(
+ true /* isSuplDdsSwitchRequiredForEmergencyCall */);
+ // Create test Phones and set radio off
+ Phone testPhone = setupTestPhoneForEmergencyCall(false /* isRoaming */,
+ false /* isRadioOn */);
+ setConfigForDdsSwitch(testPhone, null,
+ CarrierConfigManager.Gps.SUPL_EMERGENCY_MODE_TYPE_DP_ONLY, "150");
+ ServiceState ss = mock(ServiceState.class);
+ doReturn(ss).when(mSST).getServiceState();
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .build();
+ doReturn(nri).when(ss).getNetworkRegistrationInfo(anyInt(), anyInt());
+ // Spy is used to capture consumer in delayDialForDdsSwitch
+ EmergencyStateTracker spyEst = spy(emergencyStateTracker);
+ CompletableFuture<Integer> unused = spyEst.startEmergencyCall(testPhone, TEST_CALL_ID,
+ false);
+
+ // startEmergencyCall should trigger radio on
+ ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
+ .forClass(RadioOnStateListener.Callback.class);
+ verify(mRadioOnHelper).triggerRadioOnAndListen(callback.capture(), eq(true), eq(testPhone),
+ eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS));
+ // onTimeout should return true when radion on
+ assertFalse(callback.getValue()
+ .isOkToCall(testPhone, ServiceState.STATE_OUT_OF_SERVICE, false));
+ assertFalse(callback.getValue()
+ .onTimeout(testPhone, ServiceState.STATE_OUT_OF_SERVICE, false));
+ when(mSST.isRadioOn()).thenReturn(true);
+
+ assertFalse(callback.getValue()
+ .isOkToCall(testPhone, ServiceState.STATE_OUT_OF_SERVICE, false));
+ assertTrue(callback.getValue()
+ .onTimeout(testPhone, ServiceState.STATE_OUT_OF_SERVICE, false));
// Once radio on is complete, trigger delay dial
callback.getValue().onComplete(null, true);
ArgumentCaptor<Consumer<Boolean>> completeConsumer = ArgumentCaptor
@@ -199,7 +273,7 @@
ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
.forClass(RadioOnStateListener.Callback.class);
verify(mRadioOnHelper).triggerRadioOnAndListen(callback.capture(), eq(true), eq(testPhone),
- eq(false), eq(0));
+ eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS));
// Verify future completes with DisconnectCause.POWER_OFF if radio not ready
CompletableFuture<Void> unused = future.thenAccept((result) -> {
assertEquals((Integer) result, (Integer) DisconnectCause.POWER_OFF);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/emergency/RadioOnStateListenerTest.java b/tests/telephonytests/src/com/android/internal/telephony/emergency/RadioOnStateListenerTest.java
index 2c5a873..5a6fdc2 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/emergency/RadioOnStateListenerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/emergency/RadioOnStateListenerTest.java
@@ -90,7 +90,7 @@
waitForHandlerAction(mListener.getHandler(), TIMEOUT_MS);
verify(mMockPhone).unregisterForServiceStateChanged(any(Handler.class));
- verify(mSatelliteController).unregisterForSatelliteModemStateChanged(anyInt(), any());
+ verify(mSatelliteController).unregisterForModemStateChanged(anyInt(), any());
verify(mMockPhone).registerForServiceStateChanged(any(Handler.class),
eq(RadioOnStateListener.MSG_SERVICE_STATE_CHANGED), isNull());
verify(mSatelliteController, never()).registerForSatelliteModemStateChanged(
@@ -110,7 +110,7 @@
waitForHandlerAction(mListener.getHandler(), TIMEOUT_MS);
- verify(mSatelliteController).unregisterForSatelliteModemStateChanged(anyInt(), any());
+ verify(mSatelliteController).unregisterForModemStateChanged(anyInt(), any());
verify(mSatelliteController).registerForSatelliteModemStateChanged(anyInt(), any());
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/NtnCapabilityResolverTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/NtnCapabilityResolverTest.java
index 5ee7e8f..f8827be 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/NtnCapabilityResolverTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/NtnCapabilityResolverTest.java
@@ -76,7 +76,7 @@
replaceInstance(SatelliteController.class, "sInstance", null,
mMockSatelliteController);
doReturn(Arrays.asList(SATELLITE_PLMN_ARRAY))
- .when(mMockSatelliteController).getAllSatellitePlmnsForCarrier(anyInt());
+ .when(mMockSatelliteController).getSatellitePlmnsForCarrier(anyInt());
doReturn(mSatelliteSupportedServiceList).when(mMockSatelliteController)
.getSupportedSatelliteServices(SUB_ID, SATELLITE_PLMN);
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
index f23476d..f7483d9 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
@@ -112,6 +112,8 @@
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.util.Pair;
+import android.util.SparseArray;
+import android.util.SparseBooleanArray;
import com.android.internal.R;
import com.android.internal.telephony.IIntegerConsumer;
@@ -1261,13 +1263,13 @@
logd("onSatelliteModemStateChanged: state=" + state);
}
};
- mSatelliteControllerUT.unregisterForSatelliteModemStateChanged(SUB_ID, callback);
+ mSatelliteControllerUT.unregisterForModemStateChanged(SUB_ID, callback);
verify(mMockSatelliteSessionController, never())
.unregisterForSatelliteModemStateChanged(callback);
resetSatelliteControllerUTToSupportedAndProvisionedState();
- mSatelliteControllerUT.unregisterForSatelliteModemStateChanged(SUB_ID, callback);
+ mSatelliteControllerUT.unregisterForModemStateChanged(SUB_ID, callback);
verify(mMockSatelliteSessionController).unregisterForSatelliteModemStateChanged(callback);
}
@@ -1329,7 +1331,7 @@
};
when(mMockDatagramController.registerForSatelliteDatagram(eq(SUB_ID), eq(callback)))
.thenReturn(SATELLITE_RESULT_SUCCESS);
- int errorCode = mSatelliteControllerUT.registerForSatelliteDatagram(SUB_ID, callback);
+ int errorCode = mSatelliteControllerUT.registerForIncomingDatagram(SUB_ID, callback);
assertEquals(SATELLITE_RESULT_SUCCESS, errorCode);
verify(mMockDatagramController).registerForSatelliteDatagram(eq(SUB_ID), eq(callback));
}
@@ -1347,7 +1349,7 @@
};
doNothing().when(mMockDatagramController)
.unregisterForSatelliteDatagram(eq(SUB_ID), eq(callback));
- mSatelliteControllerUT.unregisterForSatelliteDatagram(SUB_ID, callback);
+ mSatelliteControllerUT.unregisterForIncomingDatagram(SUB_ID, callback);
verify(mMockDatagramController).unregisterForSatelliteDatagram(eq(SUB_ID), eq(callback));
}
@@ -1357,7 +1359,7 @@
SatelliteDatagram datagram = new SatelliteDatagram(mText.getBytes());
mIIntegerConsumerResults.clear();
- mSatelliteControllerUT.sendSatelliteDatagram(SUB_ID,
+ mSatelliteControllerUT.sendDatagram(SUB_ID,
SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE, datagram, true, mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -1373,7 +1375,7 @@
sendProvisionedStateChangedEvent(false, null);
processAllMessages();
verifySatelliteProvisioned(false, SATELLITE_RESULT_SUCCESS);
- mSatelliteControllerUT.sendSatelliteDatagram(SUB_ID,
+ mSatelliteControllerUT.sendDatagram(SUB_ID,
SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE, datagram, true, mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -1387,7 +1389,7 @@
sendProvisionedStateChangedEvent(true, null);
processAllMessages();
verifySatelliteProvisioned(true, SATELLITE_RESULT_SUCCESS);
- mSatelliteControllerUT.sendSatelliteDatagram(SUB_ID,
+ mSatelliteControllerUT.sendDatagram(SUB_ID,
SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE, datagram, true, mIIntegerConsumer);
processAllMessages();
assertFalse(waitForIIntegerConsumerResult(1));
@@ -1400,7 +1402,7 @@
@Test
public void testPollPendingSatelliteDatagrams() {
mIIntegerConsumerResults.clear();
- mSatelliteControllerUT.pollPendingSatelliteDatagrams(SUB_ID, mIIntegerConsumer);
+ mSatelliteControllerUT.pollPendingDatagrams(SUB_ID, mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
assertEquals(SATELLITE_RESULT_INVALID_TELEPHONY_STATE,
@@ -1413,7 +1415,7 @@
sendProvisionedStateChangedEvent(false, null);
processAllMessages();
verifySatelliteProvisioned(false, SATELLITE_RESULT_SUCCESS);
- mSatelliteControllerUT.pollPendingSatelliteDatagrams(SUB_ID, mIIntegerConsumer);
+ mSatelliteControllerUT.pollPendingDatagrams(SUB_ID, mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
assertEquals(SATELLITE_RESULT_SERVICE_NOT_PROVISIONED,
@@ -1424,7 +1426,7 @@
sendProvisionedStateChangedEvent(true, null);
processAllMessages();
verifySatelliteProvisioned(true, SATELLITE_RESULT_SUCCESS);
- mSatelliteControllerUT.pollPendingSatelliteDatagrams(SUB_ID, mIIntegerConsumer);
+ mSatelliteControllerUT.pollPendingDatagrams(SUB_ID, mIIntegerConsumer);
processAllMessages();
assertFalse(waitForIIntegerConsumerResult(1));
verify(mMockDatagramController, times(1)).pollPendingSatelliteDatagrams(anyInt(), any());
@@ -1656,7 +1658,7 @@
@Test
public void testSupportedSatelliteServices() {
when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(false);
- List<String> satellitePlmnList = mSatelliteControllerUT.getAllSatellitePlmnsForCarrier(
+ List<String> satellitePlmnList = mSatelliteControllerUT.getSatellitePlmnsForCarrier(
SUB_ID);
assertEquals(EMPTY_STRING_ARRAY.length, satellitePlmnList.size());
List<Integer> supportedSatelliteServices =
@@ -1680,7 +1682,7 @@
TestSatelliteController testSatelliteController =
new TestSatelliteController(mContext, Looper.myLooper(), mFeatureFlags);
- satellitePlmnList = testSatelliteController.getAllSatellitePlmnsForCarrier(SUB_ID);
+ satellitePlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
assertTrue(satellitePlmnList.isEmpty());
supportedSatelliteServices =
testSatelliteController.getSupportedSatelliteServices(SUB_ID, "00101");
@@ -1712,7 +1714,7 @@
}
processAllMessages();
- satellitePlmnList = testSatelliteController.getAllSatellitePlmnsForCarrier(SUB_ID);
+ satellitePlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
assertTrue(Arrays.equals(
expectedSupportedSatellitePlmns, satellitePlmnList.stream().toArray()));
supportedSatelliteServices =
@@ -1739,7 +1741,7 @@
}
processAllMessages();
- satellitePlmnList = testSatelliteController.getAllSatellitePlmnsForCarrier(SUB_ID);
+ satellitePlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
assertTrue(satellitePlmnList.isEmpty());
supportedSatelliteServices =
testSatelliteController.getSupportedSatelliteServices(SUB_ID, "00102");
@@ -1784,7 +1786,7 @@
TestSatelliteController testSatelliteController =
new TestSatelliteController(mContext, Looper.myLooper(), mFeatureFlags);
processAllMessages();
- List<String> carrierPlmnList = testSatelliteController.getAllSatellitePlmnsForCarrier(
+ List<String> carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(
SUB_ID);
verify(mMockSatelliteModemInterface, never()).setSatellitePlmn(
anyInt(), anyList(), anyList(), any(Message.class));
@@ -1812,7 +1814,7 @@
);
}
processAllMessages();
- carrierPlmnList = testSatelliteController.getAllSatellitePlmnsForCarrier(SUB_ID);
+ carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
verify(mMockSatelliteModemInterface, never()).setSatellitePlmn(
anyInt(), anyList(), anyList(), any(Message.class));
assertTrue(carrierPlmnList.isEmpty());
@@ -1838,7 +1840,7 @@
}
processAllMessages();
- carrierPlmnList = testSatelliteController.getAllSatellitePlmnsForCarrier(SUB_ID);
+ carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
assertTrue(carrierPlmnList.isEmpty());
List<String> allSatellitePlmnList = SatelliteServiceUtils.mergeStrLists(
carrierPlmnList, satellitePlmnListFromOverlayConfig);
@@ -1858,7 +1860,7 @@
);
}
processAllMessages();
- carrierPlmnList = testSatelliteController.getAllSatellitePlmnsForCarrier(SUB_ID);
+ carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
allSatellitePlmnList = SatelliteServiceUtils.mergeStrLists(
carrierPlmnList, satellitePlmnListFromOverlayConfig);
assertEquals(expectedCarrierPlmnList, carrierPlmnList);
@@ -1897,7 +1899,7 @@
);
}
processAllMessages();
- carrierPlmnList = testSatelliteController.getAllSatellitePlmnsForCarrier(SUB_ID);
+ carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
assertTrue(carrierPlmnList.isEmpty());
verify(mMockSatelliteModemInterface, times(1)).setSatellitePlmn(anyInt(),
eq(EMPTY_STRING_LIST), eq(EMPTY_STRING_LIST), any(Message.class));
@@ -1923,9 +1925,9 @@
setUpResponseForRequestSetSatelliteEnabledForCarrier(true, SATELLITE_RESULT_SUCCESS);
setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
- mSatelliteControllerUT.removeSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER, mIIntegerConsumer);
- mSatelliteControllerUT.removeSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION, mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(2));
@@ -1934,7 +1936,7 @@
assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(1));
Set<Integer> restrictionSet =
- mSatelliteControllerUT.getSatelliteAttachRestrictionReasonsForCarrier(SUB_ID);
+ mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
assertTrue(!restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
assertTrue(!restrictionSet.contains(
SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION));
@@ -1944,7 +1946,7 @@
reset(mMockSatelliteModemInterface);
setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
- mSatelliteControllerUT.addSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER, mIIntegerConsumer);
processAllMessages();
assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
@@ -1952,7 +1954,7 @@
.requestSetSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));
assertTrue(waitForIIntegerConsumerResult(1));
restrictionSet =
- mSatelliteControllerUT.getSatelliteAttachRestrictionReasonsForCarrier(SUB_ID);
+ mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
assertTrue(restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
// remove satellite restriction reason by user
@@ -1960,13 +1962,13 @@
reset(mMockSatelliteModemInterface);
setUpResponseForRequestSetSatelliteEnabledForCarrier(true, SATELLITE_RESULT_SUCCESS);
doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
- mSatelliteControllerUT.removeSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER, mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
restrictionSet =
- mSatelliteControllerUT.getSatelliteAttachRestrictionReasonsForCarrier(SUB_ID);
+ mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
assertTrue(!restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
verify(mMockSatelliteModemInterface, times(1))
.requestSetSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));
@@ -1976,13 +1978,13 @@
reset(mMockSatelliteModemInterface);
setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
- mSatelliteControllerUT.addSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER, mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
restrictionSet =
- mSatelliteControllerUT.getSatelliteAttachRestrictionReasonsForCarrier(SUB_ID);
+ mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
assertTrue(restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
verify(mMockSatelliteModemInterface, times(1))
.requestSetSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class));
@@ -1991,14 +1993,14 @@
mIIntegerConsumerResults.clear();
reset(mMockSatelliteModemInterface);
setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
- mSatelliteControllerUT.addSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION, mIIntegerConsumer);
doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
restrictionSet =
- mSatelliteControllerUT.getSatelliteAttachRestrictionReasonsForCarrier(SUB_ID);
+ mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
assertTrue(restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION));
verify(mMockSatelliteModemInterface, never())
.requestSetSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));
@@ -2007,14 +2009,14 @@
mIIntegerConsumerResults.clear();
reset(mMockSatelliteModemInterface);
setUpResponseForRequestSetSatelliteEnabledForCarrier(true, SATELLITE_RESULT_SUCCESS);
- mSatelliteControllerUT.removeSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION, mIIntegerConsumer);
doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
restrictionSet =
- mSatelliteControllerUT.getSatelliteAttachRestrictionReasonsForCarrier(SUB_ID);
+ mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
assertTrue(!restrictionSet.contains(
SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION));
verify(mMockSatelliteModemInterface, never())
@@ -2024,14 +2026,14 @@
mIIntegerConsumerResults.clear();
reset(mMockSatelliteModemInterface);
setUpResponseForRequestSetSatelliteEnabledForCarrier(true, SATELLITE_RESULT_SUCCESS);
- mSatelliteControllerUT.removeSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER, mIIntegerConsumer);
doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
restrictionSet =
- mSatelliteControllerUT.getSatelliteAttachRestrictionReasonsForCarrier(SUB_ID);
+ mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
assertTrue(!restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
verify(mMockSatelliteModemInterface, times(1))
.requestSetSatelliteEnabledForCarrier(anyInt(), eq(true), any(Message.class));
@@ -2040,7 +2042,7 @@
when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(false);
mIIntegerConsumerResults.clear();
- mSatelliteControllerUT.removeSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER, mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -2049,7 +2051,7 @@
verifyZeroInteractions(mMockSatelliteModemInterface);
mIIntegerConsumerResults.clear();
- mSatelliteControllerUT.addSatelliteAttachRestrictionForCarrier(SUB_ID,
+ mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID,
SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER, mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -2058,7 +2060,7 @@
verifyZeroInteractions(mMockSatelliteModemInterface);
Set<Integer> satelliteRestrictionReasons =
- mSatelliteControllerUT.getSatelliteAttachRestrictionReasonsForCarrier(SUB_ID);
+ mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
assertTrue(satelliteRestrictionReasons.isEmpty());
}
@@ -2526,20 +2528,20 @@
}
};
- int errorCode = mSatelliteControllerUT.registerForSatelliteCapabilitiesChanged(SUB_ID,
+ int errorCode = mSatelliteControllerUT.registerForCapabilitiesChanged(SUB_ID,
callback);
assertEquals(SATELLITE_RESULT_INVALID_TELEPHONY_STATE, errorCode);
setUpResponseForRequestIsSatelliteSupported(false,
SATELLITE_RESULT_SUCCESS);
verifySatelliteSupported(false, SATELLITE_RESULT_SUCCESS);
- errorCode = mSatelliteControllerUT.registerForSatelliteCapabilitiesChanged(SUB_ID,
+ errorCode = mSatelliteControllerUT.registerForCapabilitiesChanged(SUB_ID,
callback);
assertEquals(SATELLITE_RESULT_NOT_SUPPORTED, errorCode);
resetSatelliteControllerUT();
provisionSatelliteService();
- errorCode = mSatelliteControllerUT.registerForSatelliteCapabilitiesChanged(SUB_ID,
+ errorCode = mSatelliteControllerUT.registerForCapabilitiesChanged(SUB_ID,
callback);
assertEquals(SATELLITE_RESULT_SUCCESS, errorCode);
SatelliteCapabilities expectedCapabilities = mSatelliteCapabilities;
@@ -2556,7 +2558,7 @@
semaphore, 1, "testRegisterForSatelliteCapabilitiesChanged"));
assertTrue(expectedCapabilities.equals(satelliteCapabilities[0]));
- mSatelliteControllerUT.unregisterForSatelliteCapabilitiesChanged(SUB_ID, callback);
+ mSatelliteControllerUT.unregisterForCapabilitiesChanged(SUB_ID, callback);
expectedCapabilities = mSatelliteCapabilities;
sendSatelliteCapabilitiesChangedEvent(expectedCapabilities, null);
processAllMessages();
@@ -2585,21 +2587,21 @@
}
};
- int errorCode = mSatelliteControllerUT.registerForSatelliteCapabilitiesChanged(SUB_ID,
+ int errorCode = mSatelliteControllerUT.registerForCapabilitiesChanged(SUB_ID,
callback);
assertEquals(SATELLITE_RESULT_REQUEST_NOT_SUPPORTED, errorCode);
setUpResponseForRequestIsSatelliteSupported(false,
SATELLITE_RESULT_SUCCESS);
verifySatelliteSupported(false, SATELLITE_RESULT_NOT_SUPPORTED);
- errorCode = mSatelliteControllerUT.registerForSatelliteCapabilitiesChanged(SUB_ID,
+ errorCode = mSatelliteControllerUT.registerForCapabilitiesChanged(SUB_ID,
callback);
assertEquals(SATELLITE_RESULT_REQUEST_NOT_SUPPORTED, errorCode);
resetSatelliteControllerUT();
setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS);
verifySatelliteSupported(false, SATELLITE_RESULT_NOT_SUPPORTED);
- errorCode = mSatelliteControllerUT.registerForSatelliteCapabilitiesChanged(SUB_ID,
+ errorCode = mSatelliteControllerUT.registerForCapabilitiesChanged(SUB_ID,
callback);
assertEquals(SATELLITE_RESULT_REQUEST_NOT_SUPPORTED, errorCode);
@@ -2612,12 +2614,14 @@
@Test
public void testSatelliteCommunicationRestrictionForEntitlement() throws Exception {
+ logd("testSatelliteCommunicationRestrictionForEntitlement");
when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
true);
- replaceInstance(SatelliteController.class, "mCarrierSatelliteEnabled",
- mSatelliteControllerUT, false);
+ SparseBooleanArray satelliteEnabledPerCarrier = new SparseBooleanArray();
+ replaceInstance(SatelliteController.class, "mSatelliteEntitlementStatusPerCarrier",
+ mSatelliteControllerUT, satelliteEnabledPerCarrier);
mIIntegerConsumerResults.clear();
reset(mMockSatelliteModemInterface);
@@ -2632,7 +2636,7 @@
// Verify call the requestSetSatelliteEnabledForCarrier to enable the satellite when
// satellite service is enabled by entitlement server.
- mSatelliteControllerUT.updateSatelliteEntitlementStatus(SUB_ID, true, new ArrayList<>(),
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, true, new ArrayList<>(),
mIIntegerConsumer);
processAllMessages();
@@ -2652,7 +2656,7 @@
doReturn(mIsSatelliteServiceSupported)
.when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
- mSatelliteControllerUT.updateSatelliteEntitlementStatus(SUB_ID, false, new ArrayList<>(),
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false, new ArrayList<>(),
mIIntegerConsumer);
processAllMessages();
@@ -2662,6 +2666,209 @@
.requestSetSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class));
}
+ @Test
+ public void testPassSatellitePlmnToModemAfterUpdateSatelliteEntitlementStatus()
+ throws Exception {
+ logd("testPassSatellitePlmnToModemAfterUpdateSatelliteEntitlementStatus");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+
+ // If the PlmnListPerCarrier and the overlay config plmn list are empty verify passing to
+ // the modem.
+ List<String> entitlementPlmnList = new ArrayList<>();
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, mIIntegerConsumer);
+
+ List<String> plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(
+ SUB_ID);
+ List<String> allSatellitePlmnList = SatelliteServiceUtils.mergeStrLists(
+ plmnListPerCarrier, overlayConfigPlmnList);
+
+ assertEquals(new ArrayList<>(), plmnListPerCarrier);
+ assertEquals(new ArrayList<>(), allSatellitePlmnList);
+ verify(mMockSatelliteModemInterface, times(1)).setSatellitePlmn(anyInt(),
+ eq(plmnListPerCarrier), eq(allSatellitePlmnList), any(Message.class));
+
+ // If the PlmnListPerCarrier and the overlay config plmn list are exist verify passing
+ // the modem.
+ entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "00103"}).toList();
+ overlayConfigPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00104"}).toList();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, true,
+ entitlementPlmnList, mIIntegerConsumer);
+
+ plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(SUB_ID);
+ allSatellitePlmnList = SatelliteServiceUtils.mergeStrLists(
+ plmnListPerCarrier, overlayConfigPlmnList);
+
+ assertEquals(entitlementPlmnList, plmnListPerCarrier);
+ verify(mMockSatelliteModemInterface, times(1)).setSatellitePlmn(anyInt(),
+ eq(plmnListPerCarrier), eq(allSatellitePlmnList), any(Message.class));
+
+ // If the PlmnListPerCarrier and the overlay config plmn list are exist verify passing
+ // the modem.
+ reset(mMockSatelliteModemInterface);
+ entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "00103"}).toList();
+ Map<Integer, Map<String, Set<Integer>>>
+ satelliteServicesSupportedByCarriers = new HashMap<>();
+ List<String> carrierConfigPlmnList = Arrays.stream(new String[]{"00105", "00106"}).toList();
+ Map<String, Set<Integer>> plmnAndService = new HashMap<>();
+ plmnAndService.put(carrierConfigPlmnList.get(0), new HashSet<>(Arrays.asList(3, 5)));
+ plmnAndService.put(carrierConfigPlmnList.get(1), new HashSet<>(Arrays.asList(3)));
+ satelliteServicesSupportedByCarriers.put(SUB_ID, plmnAndService);
+ replaceInstance(SatelliteController.class, "mSatelliteServicesSupportedByCarriers",
+ mSatelliteControllerUT, satelliteServicesSupportedByCarriers);
+ overlayConfigPlmnList = Arrays.stream(new String[]{"00101", "00102", "00104"}).toList();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ List<String> mergedPlmnList = entitlementPlmnList;
+
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, true,
+ entitlementPlmnList, mIIntegerConsumer);
+
+ plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(SUB_ID);
+ allSatellitePlmnList = SatelliteServiceUtils.mergeStrLists(
+ plmnListPerCarrier, overlayConfigPlmnList);
+
+ assertEquals(mergedPlmnList, plmnListPerCarrier);
+ verify(mMockSatelliteModemInterface, times(1)).setSatellitePlmn(anyInt(),
+ eq(plmnListPerCarrier), eq(allSatellitePlmnList), any(Message.class));
+ }
+
+ @Test
+ public void testUpdatePlmnListPerCarrier() throws Exception {
+ logd("testUpdatePlmnListPerCarrier");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ replaceInstance(SatelliteController.class, "mSatelliteServicesSupportedByCarriers",
+ mSatelliteControllerUT, new HashMap<>());
+ SparseArray<List<String>> entitlementPlmnListPerCarrier = new SparseArray<>();
+ replaceInstance(SatelliteController.class, "mEntitlementPlmnListPerCarrier",
+ mSatelliteControllerUT, entitlementPlmnListPerCarrier);
+
+ // If the carrier config and the entitlement plmn list are empty, verify whether an empty
+ // list is returned.
+ mCarrierConfigBundle.putPersistableBundle(CarrierConfigManager
+ .KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE,
+ new PersistableBundle());
+ for (Pair<Executor, CarrierConfigManager.CarrierConfigChangeListener> pair
+ : mCarrierConfigChangedListenerList) {
+ pair.first.execute(() -> pair.second.onCarrierConfigChanged(
+ /*slotIndex*/ 0, /*subId*/ SUB_ID, /*carrierId*/ 0, /*specificCarrierId*/ 0)
+ );
+ }
+ processAllMessages();
+
+ List<String> plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(
+ SUB_ID);
+ assertEquals(new ArrayList<>(), plmnListPerCarrier);
+
+ // If the carrier config list is empty and the entitlement plmn list is exists, verify
+ // whether the entitlement list is returned.
+ entitlementPlmnListPerCarrier.clear();
+ List<String> entitlementPlmnList = Arrays.asList("00101", "00102", "00104");
+ entitlementPlmnListPerCarrier.put(SUB_ID, entitlementPlmnList);
+ List<String> expectedPlmnListPerCarrier = entitlementPlmnList;
+ for (Pair<Executor, CarrierConfigManager.CarrierConfigChangeListener> pair
+ : mCarrierConfigChangedListenerList) {
+ pair.first.execute(() -> pair.second.onCarrierConfigChanged(
+ /*slotIndex*/ 0, /*subId*/ SUB_ID, /*carrierId*/ 0, /*specificCarrierId*/ 0)
+ );
+ }
+ processAllMessages();
+
+ plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(SUB_ID);
+ assertEquals(expectedPlmnListPerCarrier, plmnListPerCarrier);
+
+ // If the carrier config list is exists and the entitlement plmn list is empty, verify
+ // whether the carrier config list is returned.
+ entitlementPlmnListPerCarrier.clear();
+ entitlementPlmnList = new ArrayList<>();
+ entitlementPlmnListPerCarrier.put(SUB_ID, entitlementPlmnList);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+ PersistableBundle carrierSupportedSatelliteServicesPerProvider = new PersistableBundle();
+ List<String> carrierConfigPlmnList = Arrays.asList("00102", "00103", "00105");
+ carrierSupportedSatelliteServicesPerProvider.putIntArray(
+ carrierConfigPlmnList.get(0), new int[]{2});
+ carrierSupportedSatelliteServicesPerProvider.putIntArray(
+ carrierConfigPlmnList.get(1), new int[]{1, 3});
+ carrierSupportedSatelliteServicesPerProvider.putIntArray(
+ carrierConfigPlmnList.get(2), new int[]{2});
+ mCarrierConfigBundle.putPersistableBundle(CarrierConfigManager
+ .KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE,
+ carrierSupportedSatelliteServicesPerProvider);
+ for (Pair<Executor, CarrierConfigManager.CarrierConfigChangeListener> pair
+ : mCarrierConfigChangedListenerList) {
+ pair.first.execute(() -> pair.second.onCarrierConfigChanged(
+ /*slotIndex*/ 0, /*subId*/ SUB_ID, /*carrierId*/ 0, /*specificCarrierId*/ 0)
+ );
+ }
+ processAllMessages();
+
+ expectedPlmnListPerCarrier = carrierConfigPlmnList;
+ plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(SUB_ID);
+ assertEquals(expectedPlmnListPerCarrier.stream().sorted().toList(),
+ plmnListPerCarrier.stream().sorted().toList());
+
+
+ // If the carrier config and the entitlement plmn list are exist, verify whether the
+ // entitlement list is returned.
+ entitlementPlmnList = Arrays.asList("00101", "00102", "00104");
+ entitlementPlmnListPerCarrier.put(SUB_ID, entitlementPlmnList);
+ for (Pair<Executor, CarrierConfigManager.CarrierConfigChangeListener> pair
+ : mCarrierConfigChangedListenerList) {
+ pair.first.execute(() -> pair.second.onCarrierConfigChanged(
+ /*slotIndex*/ 0, /*subId*/ SUB_ID, /*carrierId*/ 0, /*specificCarrierId*/ 0)
+ );
+ }
+ processAllMessages();
+
+ expectedPlmnListPerCarrier = entitlementPlmnList;
+ plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(
+ SUB_ID);
+ assertEquals(expectedPlmnListPerCarrier.stream().sorted().toList(),
+ plmnListPerCarrier.stream().sorted().toList());
+ }
+
+ @Test
+ public void testEntitlementStatus() throws Exception {
+ logd("testEntitlementStatus");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+ SparseBooleanArray satelliteEnabledPerCarrier = new SparseBooleanArray();
+ replaceInstance(SatelliteController.class, "mSatelliteEntitlementStatusPerCarrier",
+ mSatelliteControllerUT, satelliteEnabledPerCarrier);
+
+ // Change SUB_ID's EntitlementStatus to true
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, true, new ArrayList<>(),
+ mIIntegerConsumer);
+
+ assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID));
+ assertEquals(false, satelliteEnabledPerCarrier.get(SUB_ID1));
+
+ // Change SUB_ID1's EntitlementStatus to true
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID1, true, new ArrayList<>(),
+ mIIntegerConsumer);
+
+ assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID));
+ assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID1));
+
+ // Change SUB_ID's EntitlementStatus to false
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false, new ArrayList<>(),
+ mIIntegerConsumer);
+
+ assertEquals(false, satelliteEnabledPerCarrier.get(SUB_ID));
+ assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID1));
+ }
+
private void resetSatelliteControllerUTEnabledState() {
logd("resetSatelliteControllerUTEnabledState");
setUpResponseForRequestIsSatelliteSupported(false, SATELLITE_RESULT_RADIO_NOT_AVAILABLE);
@@ -3001,7 +3208,7 @@
try {
if (!mSatelliteAllowedSemaphore.tryAcquire(TIMEOUT, TimeUnit.MILLISECONDS)) {
loge("Timeout to receive "
- + "requestIsSatelliteCommunicationAllowedForCurrentLocation()"
+ + "requestIsCommunicationAllowedForCurrentLocation()"
+ " callback");
return false;
}