Merge "Unit test code for onCallStates change crash issue" into main
diff --git a/flags/calling.aconfig b/flags/calling.aconfig
index 3bd994f..27d3518 100644
--- a/flags/calling.aconfig
+++ b/flags/calling.aconfig
@@ -69,6 +69,7 @@
namespace: "telephony"
description: "Used to notify the emergency callback mode for call/SMS to other applications."
bug:"359064059"
+ is_exported: true
}
# OWNER=sewookseo TARGET=25Q2
diff --git a/flags/data.aconfig b/flags/data.aconfig
index ba1be88..4a90c10 100644
--- a/flags/data.aconfig
+++ b/flags/data.aconfig
@@ -121,10 +121,11 @@
}
}
-# OWNER=TBD TARGET=TBD
+# OWNER=jackyu TARGET=25Q2
flag {
name: "oem_paid_private"
namespace: "telephony"
description: "Support OEM_PAID and OEM_PRIVATE networks"
bug: "366194627"
+ is_exported: true
}
diff --git a/flags/ims.aconfig b/flags/ims.aconfig
index 4ce7508..703440f 100644
--- a/flags/ims.aconfig
+++ b/flags/ims.aconfig
@@ -155,6 +155,7 @@
namespace: "telephony"
description: "Used to expose SMS related hidden APIs for SMS over IMS to public API."
bug:"359721349"
+ is_exported: true
}
# OWNER=jhyoon TARGET=25Q2
@@ -163,4 +164,5 @@
namespace: "telephony"
description: "This flag controls the type of API regarding MmTelFeature, either hidden or system type."
bug:"359721349"
+ is_exported: true
}
diff --git a/flags/misc.aconfig b/flags/misc.aconfig
index 03d1f4e..ec7b8fa 100644
--- a/flags/misc.aconfig
+++ b/flags/misc.aconfig
@@ -230,3 +230,19 @@
purpose: PURPOSE_BUGFIX
}
}
+
+# OWNER=jackyu TARGET=25Q2
+flag {
+ name: "deprecate_cdma"
+ namespace: "telephony"
+ description: "Deprecate CDMA and NV APIS"
+ bug: "379356026"
+}
+
+# OWNER=jackyu TARGET=25Q2
+flag {
+ name: "cleanup_cdma"
+ namespace: "telephony"
+ description: "Disable CDMA and NV backing code"
+ bug: "379356026"
+}
diff --git a/flags/satellite.aconfig b/flags/satellite.aconfig
index 8662572..ee4570e 100644
--- a/flags/satellite.aconfig
+++ b/flags/satellite.aconfig
@@ -41,6 +41,7 @@
namespace: "telephony"
description: "This flag enables satellite carrier roaming to nb iot ntn."
bug:"348253735"
+ is_exported: true
}
# OWNER=tnd TARGET=24Q4
@@ -78,4 +79,5 @@
namespace: "telephony"
description: "Introduce SatelliteManager APIs for carrier apps to monitor satellite state change"
bug: "357638490"
+ is_exported: true
}
diff --git a/flags/subscription.aconfig b/flags/subscription.aconfig
index aea9bd0..0522a3c 100644
--- a/flags/subscription.aconfig
+++ b/flags/subscription.aconfig
@@ -88,4 +88,5 @@
namespace: "telephony"
description: "Provide APIs to retrieve the status and recurrence rule info on a subscription plan"
bug: "357272015"
+ is_exported: true
}
diff --git a/flags/uicc.aconfig b/flags/uicc.aconfig
index aed4bff..8561dac 100644
--- a/flags/uicc.aconfig
+++ b/flags/uicc.aconfig
@@ -49,6 +49,7 @@
namespace: "telephony"
description: "This flag controls the visibility of the setCarrierRestrictionStatus API in carrierRestrictionRules class."
bug:"342411308"
+ is_exported: true
}
# OWNER=arunvoddu TARGET=24Q4
@@ -87,6 +88,7 @@
namespace: "telephony"
description: "This flag controls the type of API that retrieves ISIM records, either hidden or system type."
bug:"359721349"
+ is_exported: true
}
# OWNER=jinjeong TARGET=25Q2
@@ -95,6 +97,7 @@
namespace: "telephony"
description: "This flag controls to get a carrier id using a carrier identifier."
bug:"378778278"
+ is_exported: true
}
# OWNER=arunvoddu TARGET=25Q2
@@ -107,3 +110,19 @@
purpose: PURPOSE_BUGFIX
}
}
+
+# OWNER=jinjeong TARGET=25Q2
+flag {
+ name: "get_group_id_level2"
+ namespace: "telephony"
+ description: "This flag controls to get a group id level2."
+ bug:"381171540"
+}
+
+# OWNER=jinjeong TARGET=25Q2
+flag {
+ name: "action_sim_preference_settings"
+ namespace: "telephony"
+ description: "This flag controls to launch sim preference page in Setting"
+ bug:"381319469"
+}
diff --git a/src/java/com/android/internal/telephony/CommandsInterface.java b/src/java/com/android/internal/telephony/CommandsInterface.java
index ee7447c..1b19c99 100644
--- a/src/java/com/android/internal/telephony/CommandsInterface.java
+++ b/src/java/com/android/internal/telephony/CommandsInterface.java
@@ -2952,4 +2952,39 @@
* @param h Handler to be removed from the registrant list.
*/
default void unregisterForSecurityAlgorithmUpdates(Handler h) {}
+
+ /**
+ * Set the non-terrestrial PLMN with lower priority than terrestrial networks.
+ *
+ * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
+ * this information to determine the relevant carrier.
+ * @param carrierPlmnList The list of roaming PLMN used for connecting to satellite networks
+ * supported by user subscription.
+ * @param allSatellitePlmnList Modem should use the allSatellitePlmnList to identify satellite
+ * PLMNs that are not supported by the carrier and make sure not to
+ * attach to them.
+ * @param result Callback message to receive the result.
+ */
+ default void setSatellitePlmn(int simSlot,
+ @NonNull List<String> carrierPlmnList, @NonNull List<String> allSatellitePlmnList,
+ Message result) {}
+
+ /**
+ * Enable or disable satellite in the cellular modem associated with a carrier.
+ *
+ * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
+ * this information to determine the relevant carrier.
+ * @param satelliteEnabled {@code true} to enable satellite, {@code false} to disable satellite.
+ * @param result Callback message to receive the result.
+ */
+ default void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
+ Message result) {}
+
+ /**
+ * Check whether satellite is enabled in the cellular modem associated with a carrier.
+ *
+ * @param simSlot Indicates the SIM slot to which this API will be applied.
+ * @param result Callback message to receive the result.
+ */
+ default void isSatelliteEnabledForCarrier(int simSlot, Message result) {}
}
diff --git a/src/java/com/android/internal/telephony/DisplayInfoController.java b/src/java/com/android/internal/telephony/DisplayInfoController.java
index d3f0264..bb19a31 100644
--- a/src/java/com/android/internal/telephony/DisplayInfoController.java
+++ b/src/java/com/android/internal/telephony/DisplayInfoController.java
@@ -110,7 +110,7 @@
mTelephonyDisplayInfo = new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_UNKNOWN,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
- false);
+ false, false, false);
mNetworkTypeController = new NetworkTypeController(phone, this, featureFlags);
// EVENT_UPDATE will transition from DefaultState to the current state
// and update the TelephonyDisplayInfo based on the current state.
@@ -132,7 +132,9 @@
TelephonyDisplayInfo newDisplayInfo = new TelephonyDisplayInfo(
mNetworkTypeController.getDataNetworkType(),
mNetworkTypeController.getOverrideNetworkType(),
- isRoaming());
+ isRoaming(),
+ mPhone.getServiceStateTracker().getServiceState().isUsingNonTerrestrialNetwork(),
+ mNetworkTypeController.getSatelliteConstrainedData());
if (!newDisplayInfo.equals(mTelephonyDisplayInfo)) {
logl("TelephonyDisplayInfo changed from " + mTelephonyDisplayInfo + " to "
+ newDisplayInfo);
diff --git a/src/java/com/android/internal/telephony/EventLogTags.logtags b/src/java/com/android/internal/telephony/EventLogTags.logtags
index b5e458b..2f30c33 100644
--- a/src/java/com/android/internal/telephony/EventLogTags.logtags
+++ b/src/java/com/android/internal/telephony/EventLogTags.logtags
@@ -1,4 +1,4 @@
-# See system/core/logcat/event.logtags for a description of the format of this file.
+# See system/logging/logcat/event.logtags for a description of the format of this file.
option java_package com.android.internal.telephony;
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
index 175bbb5..5a73cae 100644
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
@@ -3775,6 +3775,13 @@
&& disclosure != null) {
mIdentifierDisclosureNotifier.addDisclosure(mContext, getSubId(), disclosure);
}
+ if (mFeatureFlags.cellularIdentifierDisclosureIndications()
+ && mIdentifierDisclosureNotifier != null
+ && disclosure != null) {
+ logd("EVENT_CELL_IDENTIFIER_DISCLOSURE for non-Safety Center listeners "
+ + "phoneId = " + getPhoneId());
+ mNotifier.notifyCellularIdentifierDisclosedChanged(this, disclosure);
+ }
break;
case EVENT_SET_IDENTIFIER_DISCLOSURE_ENABLED_DONE:
@@ -3785,13 +3792,21 @@
case EVENT_SECURITY_ALGORITHM_UPDATE:
logd("EVENT_SECURITY_ALGORITHM_UPDATE phoneId = " + getPhoneId());
+
+ ar = (AsyncResult) msg.obj;
+ SecurityAlgorithmUpdate update = (SecurityAlgorithmUpdate) ar.result;
+
if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()
&& mNullCipherNotifier != null) {
- ar = (AsyncResult) msg.obj;
- SecurityAlgorithmUpdate update = (SecurityAlgorithmUpdate) ar.result;
mNullCipherNotifier.onSecurityAlgorithmUpdate(mContext, getPhoneId(),
getSubId(), update);
}
+ if (mFeatureFlags.securityAlgorithmsUpdateIndications()
+ && mNullCipherNotifier != null) {
+ logd("EVENT_SECURITY_ALGORITHM_UPDATE for non-Safety Center listeners "
+ + "phoneId = " + getPhoneId());
+ mNotifier.notifySecurityAlgorithmsChanged(this, update);
+ }
break;
case EVENT_SET_SECURITY_ALGORITHMS_UPDATED_ENABLED_DONE:
diff --git a/src/java/com/android/internal/telephony/NetworkResponse.java b/src/java/com/android/internal/telephony/NetworkResponse.java
index b4a37b3..ccf066f 100644
--- a/src/java/com/android/internal/telephony/NetworkResponse.java
+++ b/src/java/com/android/internal/telephony/NetworkResponse.java
@@ -551,6 +551,36 @@
}
}
+ /**
+ * @param responseInfo Response info struct containing response type, serial no. and error
+ */
+ public void setSatellitePlmnResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_NETWORK, mRil, responseInfo);
+ }
+
+ /**
+ * @param responseInfo Response info struct containing response type, serial no. and error
+ */
+ public void setSatelliteEnabledForCarrierResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_NETWORK, mRil, responseInfo);
+ }
+
+ /**
+ * @param responseInfo Response info struct containing response type, serial no. and error.
+ * @param isEnabled Indicates whether satellite is enabled for carrier or not.
+ */
+ public void isSatelliteEnabledForCarrierResponse(RadioResponseInfo responseInfo,
+ boolean isEnabled) {
+ RILRequest rr = mRil.processResponse(HAL_SERVICE_NETWORK, responseInfo);
+
+ if (rr != null) {
+ if (responseInfo.error == RadioError.NONE) {
+ RadioResponse.sendMessageResponse(rr.mResult, isEnabled);
+ }
+ mRil.processResponseDone(rr, responseInfo, isEnabled);
+ }
+ }
+
@Override
public String getInterfaceHash() {
return IRadioNetworkResponse.HASH;
diff --git a/src/java/com/android/internal/telephony/NetworkTypeController.java b/src/java/com/android/internal/telephony/NetworkTypeController.java
index 081a5c8..b12a3df 100644
--- a/src/java/com/android/internal/telephony/NetworkTypeController.java
+++ b/src/java/com/android/internal/telephony/NetworkTypeController.java
@@ -22,7 +22,13 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.net.Network;
+import android.net.NetworkCapabilities;
+import android.net.NetworkRequest;
import android.os.AsyncResult;
+import android.os.Handler;
+import android.os.HandlerThread;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.PowerManager;
@@ -233,6 +239,72 @@
private boolean mDoesPccListIndicateIdle = false;
private boolean mInVoiceCall = false;
+ private boolean mIsSatelliteConstrainedData = false;
+ private boolean mIsSatelliteNetworkCallbackRegistered = false;
+ private ConnectivityManager mConnectivityManager;
+
+ private final ConnectivityManager.NetworkCallback mNetworkCallback =
+ new ConnectivityManager.NetworkCallback() {
+ @Override
+ public void onAvailable(Network network) {
+ log("On Available: " + network);
+ if (network != null) {
+ if (mConnectivityManager != null) {
+ NetworkCapabilities capabilities =
+ mConnectivityManager.getNetworkCapabilities(network);
+ updateBandwidthConstrainedStatus(capabilities);
+ } else {
+ log("network is null");
+ }
+ }
+ }
+
+ @Override
+ public void onCapabilitiesChanged(Network network,
+ NetworkCapabilities networkCapabilities) {
+ log("onCapabilitiesChanged: " + network);
+ if (network != null) {
+ updateBandwidthConstrainedStatus(networkCapabilities);
+ } else {
+ log("network is null");
+ }
+ }
+
+ @Override
+ public void onLost(Network network) {
+ log("Network Lost");
+ if (mIsSatelliteConstrainedData) {
+ mIsSatelliteConstrainedData = false;
+ mDisplayInfoController.updateTelephonyDisplayInfo();
+ }
+ }
+ };
+
+ private boolean isBandwidthConstrainedCapabilitySupported(NetworkCapabilities
+ capabilities) {
+ // TODO (b/382002908: Remove try catch exception for
+ // NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED & replace datautils with
+ // NetworkCapabilities on api availability at mainline module)
+ try {
+ return capabilities.hasTransport(
+ NetworkCapabilities.TRANSPORT_SATELLITE) &&
+ !capabilities.hasCapability(DataUtils.NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED);
+ } catch (Exception ignored) {
+ log("NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED not supported ");
+ return false;
+ }
+ }
+
+ private void updateBandwidthConstrainedStatus(NetworkCapabilities capabilities) {
+ if (capabilities != null) {
+ mIsSatelliteConstrainedData
+ = isBandwidthConstrainedCapabilitySupported(capabilities);
+ log("satellite constrained data status : " + mIsSatelliteConstrainedData);
+ mDisplayInfoController.updateTelephonyDisplayInfo();
+ } else {
+ log("capabilities is null");
+ }
+ }
/**
* NetworkTypeController constructor.
@@ -266,9 +338,42 @@
mServiceState = mPhone.getServiceStateTracker().getServiceState();
mPhysicalChannelConfigs = mPhone.getServiceStateTracker().getPhysicalChannelConfigList();
+ if(mFeatureFlags.carrierEnabledSatelliteFlag()) {
+ registerForSatelliteNetwork();
+ }
+
sendMessage(EVENT_INITIALIZE);
}
+ public synchronized void registerForSatelliteNetwork() {
+ if (!mIsSatelliteNetworkCallbackRegistered) {
+ mIsSatelliteNetworkCallbackRegistered = true;
+ HandlerThread handlerThread = new HandlerThread("SatelliteDataUsageThread");
+ handlerThread.start();
+ Handler handler = new Handler(handlerThread.getLooper());
+
+ NetworkRequest.Builder builder = new NetworkRequest.Builder();
+ builder.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
+ // TODO (b/382002908: Remove try catch exception for
+ // NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED & replace datautils with
+ // NetworkCapabilities on api availability at mainline module)
+ try {
+ builder.removeCapability(DataUtils.NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED);
+ } catch (Exception ignored) {
+ log("NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED not supported ");
+ }
+ mConnectivityManager =
+ (ConnectivityManager) mPhone.getContext()
+ .getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (mConnectivityManager != null) {
+ mConnectivityManager.registerBestMatchingNetworkCallback(
+ builder.build(), mNetworkCallback, handler);
+ } else {
+ loge("network callback not registered");
+ }
+ }
+ }
+
/**
* @return The current override network type, used to create TelephonyDisplayInfo in
* DisplayInfoController.
@@ -289,6 +394,15 @@
}
/**
+ * @return satellite bandwidth constrained connection status, used to create
+ * TelephonyDisplayInfo in DisplayInfoController.
+ *
+ */
+ public boolean getSatelliteConstrainedData() {
+ return mIsSatelliteConstrainedData;
+ }
+
+ /**
* @return {@code true} if either the primary or secondary 5G icon timers are active,
* and {@code false} if neither are.
*/
diff --git a/src/java/com/android/internal/telephony/PhoneSubInfoController.java b/src/java/com/android/internal/telephony/PhoneSubInfoController.java
index c40193e..9801542 100644
--- a/src/java/com/android/internal/telephony/PhoneSubInfoController.java
+++ b/src/java/com/android/internal/telephony/PhoneSubInfoController.java
@@ -659,6 +659,20 @@
});
}
+ /**
+ * Return GroupIdLevel2 for the subscriber
+ */
+ public String getGroupIdLevel2ForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
+ return callPhoneMethodForSubIdWithPrivilegedCheck(subId,
+ "getGroupIdLevel2", (phone)-> {
+ enforceTelephonyFeatureWithException(callingPackage,
+ PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION,
+ "getGroupIdLevel2ForSubscriber");
+ return phone.getGroupIdLevel2();
+ });
+ }
+
/** Below are utility methods that abstracts the flow that many public methods use:
* 1. Check permission: pass, throw exception, or fails (returns false).
* 2. clearCallingIdentity.
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index 34ac832..1bb9984 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -181,6 +181,9 @@
/** @hide */
public static final HalVersion RADIO_HAL_VERSION_2_3 = new HalVersion(2, 3);
+ /** @hide */
+ public static final HalVersion RADIO_HAL_VERSION_2_4 = new HalVersion(2, 4);
+
// Hal version
private final Map<Integer, HalVersion> mHalVersion = new HashMap<>();
@@ -5352,6 +5355,102 @@
});
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setSatellitePlmn(int simSlot, @NonNull List<String> carrierPlmnList,
+ @NonNull List<String> allSatellitePlmnList, Message result) {
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (!canMakeRequest(
+ "setSatellitePlmn",
+ networkProxy,
+ result,
+ RADIO_HAL_VERSION_2_4)) {
+ return;
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SATELLITE_PLMN, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " simSlot=" + simSlot + " carrierPlmnList=" + carrierPlmnList
+ + " allSatellitePlmnList=" + allSatellitePlmnList);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK,
+ rr,
+ "setSatellitePlmn",
+ () -> {
+ networkProxy.setSatellitePlmn(rr.mSerial, simSlot, carrierPlmnList,
+ allSatellitePlmnList);
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
+ Message result) {
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (!canMakeRequest(
+ "setSatelliteEnabledForCarrier",
+ networkProxy,
+ result,
+ RADIO_HAL_VERSION_2_4)) {
+ return;
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SATELLITE_ENABLED_FOR_CARRIER, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " simSlot=" + simSlot + " satelliteEnabled=" + satelliteEnabled);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK,
+ rr,
+ "setSatelliteEnabledForCarrier",
+ () -> {
+ networkProxy.setSatelliteEnabledForCarrier(rr.mSerial, simSlot,
+ satelliteEnabled);
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void isSatelliteEnabledForCarrier(int simSlot, Message result) {
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (!canMakeRequest(
+ "isSatelliteEnabledForCarrier",
+ networkProxy,
+ result,
+ RADIO_HAL_VERSION_2_4)) {
+ return;
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_IS_SATELLITE_ENABLED_FOR_CARRIER, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " simSlot=" + simSlot);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK, rr, "isSatelliteEnabledForCarrier", () -> {
+ networkProxy.isSatelliteEnabledForCarrier(rr.mSerial, simSlot);
+ });
+ }
+
+
//***** Private Methods
/**
* This is a helper function to be called when an indication callback is called for any radio
@@ -6216,6 +6315,7 @@
case 2: return RADIO_HAL_VERSION_2_1;
case 3: return RADIO_HAL_VERSION_2_2;
case 4: return RADIO_HAL_VERSION_2_3;
+ case 5: return RADIO_HAL_VERSION_2_4;
default: return RADIO_HAL_VERSION_UNKNOWN;
}
}
diff --git a/src/java/com/android/internal/telephony/RILUtils.java b/src/java/com/android/internal/telephony/RILUtils.java
index cbf2330..a6d9803 100644
--- a/src/java/com/android/internal/telephony/RILUtils.java
+++ b/src/java/com/android/internal/telephony/RILUtils.java
@@ -121,6 +121,7 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_N1_MODE_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_NR_DUAL_CONNECTIVITY_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_NULL_CIPHER_AND_INTEGRITY_ENABLED;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_SATELLITE_ENABLED_FOR_CARRIER;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_SECURITY_ALGORITHMS_UPDATED_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_VONR_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_LAST_CALL_FAIL_CAUSE;
@@ -180,6 +181,8 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_DATA_MODEM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_RADIO_CAPABILITY;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_ENABLED_FOR_CARRIER;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_PLMN;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SECURITY_ALGORITHMS_UPDATED_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIM_CARD_POWER;
@@ -394,6 +397,7 @@
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.telephony.uicc.PortUtils;
import com.android.internal.telephony.uicc.SimPhonebookRecord;
+import com.android.internal.telephony.uicc.SimTypeInfo;
import com.android.telephony.Rlog;
import java.io.ByteArrayInputStream;
@@ -1685,6 +1689,9 @@
if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_NR) != 0) {
raf |= android.hardware.radio.RadioAccessFamily.NR;
}
+ if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_NB_IOT_NTN) != 0) {
+ raf |= android.hardware.radio.RadioAccessFamily.NB_IOT_NTN;
+ }
return (raf == 0) ? android.hardware.radio.RadioAccessFamily.UNKNOWN : raf;
}
@@ -5288,6 +5295,12 @@
return "IS_SECURITY_ALGORITHMS_UPDATED_ENABLED";
case RIL_REQUEST_GET_SIMULTANEOUS_CALLING_SUPPORT:
return "GET_SIMULTANEOUS_CALLING_SUPPORT";
+ case RIL_REQUEST_SET_SATELLITE_PLMN:
+ return "SET_SATELLITE_PLMN";
+ case RIL_REQUEST_SET_SATELLITE_ENABLED_FOR_CARRIER:
+ return "SET_SATELLITE_ENABLED_FOR_CARRIER";
+ case RIL_REQUEST_IS_SATELLITE_ENABLED_FOR_CARRIER:
+ return "IS_SATELLITE_ENABLED_FOR_CARRIER";
default:
return "<unknown request " + request + ">";
}
@@ -5870,6 +5883,23 @@
securityAlgorithmUpdate.isUnprotectedEmergency);
}
+ /** Convert an AIDL-based SimTypeInfo to its Java wrapper. */
+ public static ArrayList<SimTypeInfo> convertAidlSimTypeInfo(
+ android.hardware.radio.config.SimTypeInfo[] simTypeInfos) {
+ ArrayList<SimTypeInfo> response = new ArrayList<>();
+ if (simTypeInfos == null) {
+ loge("convertAidlSimTypeInfo received NULL simTypeInfos");
+ return response;
+ }
+ for (android.hardware.radio.config.SimTypeInfo simTypeInfo : simTypeInfos) {
+ SimTypeInfo info = new SimTypeInfo();
+ info.mSupportedSimTypes = simTypeInfo.supportedSimTypes;
+ info.setCurrentSimType(simTypeInfo.currentSimType);
+ response.add(info);
+ }
+ return response;
+ }
+
private static void logd(String log) {
Rlog.d("RILUtils", log);
}
diff --git a/src/java/com/android/internal/telephony/RadioConfigResponseAidl.java b/src/java/com/android/internal/telephony/RadioConfigResponseAidl.java
index 0a41b11..6142fc2 100644
--- a/src/java/com/android/internal/telephony/RadioConfigResponseAidl.java
+++ b/src/java/com/android/internal/telephony/RadioConfigResponseAidl.java
@@ -21,10 +21,10 @@
import android.telephony.PhoneCapability;
import com.android.internal.telephony.uicc.IccSlotStatus;
+import com.android.internal.telephony.uicc.SimTypeInfo;
import com.android.telephony.Rlog;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Set;
/**
@@ -47,8 +47,7 @@
*/
@Override
public void getHalDeviceCapabilitiesResponse(
- android.hardware.radio.RadioResponseInfo info,
- boolean modemReducedFeatureSet1) throws RemoteException {
+ RadioResponseInfo info, boolean modemReducedFeatureSet1) throws RemoteException {
// convert hal device capabilities to RadioInterfaceCapabilities
RILRequest rr = mRadioConfig.processResponse(info);
if (rr != null) {
@@ -71,8 +70,7 @@
*/
@Override
public void getNumOfLiveModemsResponse(
- android.hardware.radio.RadioResponseInfo info, byte numOfLiveModems)
- throws RemoteException {
+ RadioResponseInfo info, byte numOfLiveModems) throws RemoteException {
RILRequest rr = mRadioConfig.processResponse(info);
if (rr != null) {
if (info.error == android.hardware.radio.RadioError.NONE) {
@@ -93,9 +91,8 @@
*/
@Override
public void getPhoneCapabilityResponse(
- android.hardware.radio.RadioResponseInfo info,
- android.hardware.radio.config.PhoneCapability phoneCapability)
- throws RemoteException {
+ RadioResponseInfo info,
+ android.hardware.radio.config.PhoneCapability phoneCapability) throws RemoteException {
RILRequest rr = mRadioConfig.processResponse(info);
if (rr != null) {
PhoneCapability ret = RILUtils.convertHalPhoneCapability(
@@ -118,9 +115,7 @@
*/
@Override
public void getSimultaneousCallingSupportResponse(
- android.hardware.radio.RadioResponseInfo info,
- int[] enabledLogicalSlots)
- throws RemoteException {
+ RadioResponseInfo info, int[] enabledLogicalSlots) throws RemoteException {
RILRequest rr = mRadioConfig.processResponse(info);
if (rr != null) {
ArrayList<Integer> ret = RILUtils.primitiveArrayToArrayList(enabledLogicalSlots);
@@ -142,7 +137,7 @@
*/
@Override
public void getSimSlotsStatusResponse(
- android.hardware.radio.RadioResponseInfo info,
+ RadioResponseInfo info,
android.hardware.radio.config.SimSlotStatus[] slotStatus)
throws RemoteException {
RILRequest rr = mRadioConfig.processResponse(info);
@@ -166,8 +161,7 @@
* Currently this is being used as the callback for RadioConfig.setNumOfLiveModems() method
*/
@Override
- public void setNumOfLiveModemsResponse(
- android.hardware.radio.RadioResponseInfo info) throws RemoteException {
+ public void setNumOfLiveModemsResponse(RadioResponseInfo info) throws RemoteException {
RILRequest rr = mRadioConfig.processResponse(info);
if (rr != null) {
if (info.error == android.hardware.radio.RadioError.NONE) {
@@ -187,8 +181,7 @@
* Response function for IRadioConfig.setPreferredDataModem().
*/
@Override
- public void setPreferredDataModemResponse(
- android.hardware.radio.RadioResponseInfo info) throws RemoteException {
+ public void setPreferredDataModemResponse(RadioResponseInfo info) throws RemoteException {
RILRequest rr = mRadioConfig.processResponse(info);
if (rr != null) {
if (info.error == android.hardware.radio.RadioError.NONE) {
@@ -208,8 +201,7 @@
* Response function for IRadioConfig.setSimSlotsMapping().
*/
@Override
- public void setSimSlotsMappingResponse(
- android.hardware.radio.RadioResponseInfo info) throws RemoteException {
+ public void setSimSlotsMappingResponse(RadioResponseInfo info) throws RemoteException {
RILRequest rr = mRadioConfig.processResponse(info);
if (rr != null) {
if (info.error == android.hardware.radio.RadioError.NONE) {
@@ -225,6 +217,48 @@
}
}
+ /**
+ * Response function for IRadioConfig.getSimTypeInfo().
+ */
+ @Override
+ public void getSimTypeInfoResponse(
+ RadioResponseInfo info,
+ android.hardware.radio.config.SimTypeInfo[] simTypeInfo) throws RemoteException {
+ RILRequest rr = mRadioConfig.processResponse(info);
+ if (rr != null) {
+ ArrayList<SimTypeInfo> ret = RILUtils.convertAidlSimTypeInfo(simTypeInfo);
+ if (info.error == android.hardware.radio.RadioError.NONE) {
+ // send response
+ RadioResponse.sendMessageResponse(rr.mResult, ret);
+ logd(rr, RILUtils.requestToString(rr.mRequest) + " " + ret.toString());
+ } else {
+ rr.onError(info.error, null);
+ loge(rr, RILUtils.requestToString(rr.mRequest) + " error " + info.error);
+ }
+ } else {
+ loge("getSimTypeInfoResponse: Error " + info.toString());
+ }
+ }
+
+ /**
+ * Response function for IRadioConfig.setSimTypeResponse().
+ */
+ @Override
+ public void setSimTypeResponse(RadioResponseInfo info) throws RemoteException {
+ RILRequest rr = mRadioConfig.processResponse(info);
+ if (rr != null) {
+ if (info.error == android.hardware.radio.RadioError.NONE) {
+ // send response
+ RadioResponse.sendMessageResponse(rr.mResult, null);
+ logd(rr, RILUtils.requestToString(rr.mRequest));
+ } else {
+ rr.onError(info.error, null);
+ loge(rr, RILUtils.requestToString(rr.mRequest) + " error " + info.error);
+ }
+ } else {
+ loge("setSimTypeResponse: Error " + info.toString());
+ }
+ }
private static void logd(String log) {
Rlog.d(TAG, log);
}
diff --git a/src/java/com/android/internal/telephony/RadioNetworkProxy.java b/src/java/com/android/internal/telephony/RadioNetworkProxy.java
index 4acc71a..12e6c90 100644
--- a/src/java/com/android/internal/telephony/RadioNetworkProxy.java
+++ b/src/java/com/android/internal/telephony/RadioNetworkProxy.java
@@ -979,4 +979,60 @@
}
// Only supported on AIDL.
}
+
+ /**
+ * Set the non-terrestrial PLMN with lower priority than terrestrial networks.
+ *
+ * @param serial Serial number of request.
+ * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
+ * this information to determine the relevant carrier.
+ * @param carrierPlmnList The list of roaming PLMN used for connecting to satellite networks
+ * supported by user subscription.
+ * @param allSatellitePlmnList Modem should use the allSatellitePlmnList to identify satellite
+ * PLMNs that are not supported by the carrier and make sure not to
+ * attach to them.
+ */
+ public void setSatellitePlmn(int serial, int simSlot, List<String> carrierPlmnList,
+ List<String> allSatellitePlmnList) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ String[] carrierPlmnArray = carrierPlmnList.toArray(new String[0]);
+ String[] allSatellitePlmnArray = allSatellitePlmnList.toArray(new String[0]);
+ mNetworkProxy.setSatellitePlmn(serial, simSlot, carrierPlmnArray,
+ allSatellitePlmnArray);
+ }
+ // Only supported on AIDL.
+ }
+
+ /**
+ * Enable or disable satellite in the cellular modem associated with a carrier.
+ *
+ * @param serial Serial number of request.
+ * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
+ * this information to determine the relevant carrier.
+ * @param satelliteEnabled {@code true} to enable satellite, {@code false} to disable satellite.
+ */
+ public void setSatelliteEnabledForCarrier(int serial, int simSlot,
+ boolean satelliteEnabled) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mNetworkProxy.setSatelliteEnabledForCarrier(serial, simSlot, satelliteEnabled);
+ }
+ // Only supported on AIDL.
+ }
+
+ /**
+ * Check whether satellite is enabled in the cellular modem associated with a carrier.
+ *
+ * @param serial Serial number of request.
+ * @param simSlot Indicates the SIM slot to which this API will be applied.
+ */
+ public void isSatelliteEnabledForCarrier(int serial, int simSlot)
+ throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mNetworkProxy.isSatelliteEnabledForCarrier(serial, simSlot);
+ }
+ // Only supported on AIDL.
+ }
}
diff --git a/src/java/com/android/internal/telephony/SmsDispatchersController.java b/src/java/com/android/internal/telephony/SmsDispatchersController.java
index dd738c0..91aac26 100644
--- a/src/java/com/android/internal/telephony/SmsDispatchersController.java
+++ b/src/java/com/android/internal/telephony/SmsDispatchersController.java
@@ -1235,7 +1235,7 @@
notifySmsSentToEmergencyStateTracker(tracker.mDestAddress,
tracker.mMessageId, isOverIms, isLastSmsPart, success);
notifySmsSentToDatagramDispatcher(tracker.mUniqueMessageId,
- tracker.isSinglePartOrLastPart(), !tracker.isAnyPartFailed());
+ tracker.isSinglePartOrLastPart(), success && !tracker.isAnyPartFailed());
}
/**
diff --git a/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java b/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java
index 9f74890..fdd0c0a 100644
--- a/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java
+++ b/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java
@@ -177,7 +177,6 @@
/** Maximum number of Satellite relevant stats to store between pulls. */
private final int mMaxNumSatelliteStats;
- private final int mMaxNumSatelliteControllerStats = 1;
private final int mMaxNumCarrierRoamingSatelliteSessionStats = 1;
/** Maximum number of data network validation to store during pulls. */
@@ -710,76 +709,75 @@
/** Adds a new {@link SatelliteController} to the storage. */
public synchronized void addSatelliteControllerStats(SatelliteController stats) {
- // SatelliteController is a single data point
- SatelliteController[] atomArray = mAtoms.satelliteController;
- if (atomArray == null || atomArray.length == 0) {
- atomArray = new SatelliteController[] {new SatelliteController()};
+ // find existing satellite controller atom with same carrier ID.
+ SatelliteController existingStats = find(stats);
+ if (existingStats != null) {
+ existingStats.countOfSatelliteServiceEnablementsSuccess
+ += stats.countOfSatelliteServiceEnablementsSuccess;
+ existingStats.countOfSatelliteServiceEnablementsFail
+ += stats.countOfSatelliteServiceEnablementsFail;
+ existingStats.countOfOutgoingDatagramSuccess
+ += stats.countOfOutgoingDatagramSuccess;
+ existingStats.countOfOutgoingDatagramFail
+ += stats.countOfOutgoingDatagramFail;
+ existingStats.countOfIncomingDatagramSuccess
+ += stats.countOfIncomingDatagramSuccess;
+ existingStats.countOfIncomingDatagramFail
+ += stats.countOfIncomingDatagramFail;
+ existingStats.countOfDatagramTypeSosSmsSuccess
+ += stats.countOfDatagramTypeSosSmsSuccess;
+ existingStats.countOfDatagramTypeSosSmsFail
+ += stats.countOfDatagramTypeSosSmsFail;
+ existingStats.countOfDatagramTypeLocationSharingSuccess
+ += stats.countOfDatagramTypeLocationSharingSuccess;
+ existingStats.countOfDatagramTypeLocationSharingFail
+ += stats.countOfDatagramTypeLocationSharingFail;
+ existingStats.countOfProvisionSuccess
+ += stats.countOfProvisionSuccess;
+ existingStats.countOfProvisionFail
+ += stats.countOfProvisionFail;
+ existingStats.countOfDeprovisionSuccess
+ += stats.countOfDeprovisionSuccess;
+ existingStats.countOfDeprovisionFail
+ += stats.countOfDeprovisionFail;
+ existingStats.totalServiceUptimeSec
+ += stats.totalServiceUptimeSec;
+ existingStats.totalBatteryConsumptionPercent
+ += stats.totalBatteryConsumptionPercent;
+ existingStats.totalBatteryChargedTimeSec
+ += stats.totalBatteryChargedTimeSec;
+ existingStats.countOfDemoModeSatelliteServiceEnablementsSuccess
+ += stats.countOfDemoModeSatelliteServiceEnablementsSuccess;
+ existingStats.countOfDemoModeSatelliteServiceEnablementsFail
+ += stats.countOfDemoModeSatelliteServiceEnablementsFail;
+ existingStats.countOfDemoModeOutgoingDatagramSuccess
+ += stats.countOfDemoModeOutgoingDatagramSuccess;
+ existingStats.countOfDemoModeOutgoingDatagramFail
+ += stats.countOfDemoModeOutgoingDatagramFail;
+ existingStats.countOfDemoModeIncomingDatagramSuccess
+ += stats.countOfDemoModeIncomingDatagramSuccess;
+ existingStats.countOfDemoModeIncomingDatagramFail
+ += stats.countOfDemoModeIncomingDatagramFail;
+ existingStats.countOfDatagramTypeKeepAliveSuccess
+ += stats.countOfDatagramTypeKeepAliveSuccess;
+ existingStats.countOfDatagramTypeKeepAliveFail
+ += stats.countOfDatagramTypeKeepAliveFail;
+ existingStats.countOfAllowedSatelliteAccess += stats.countOfAllowedSatelliteAccess;
+ existingStats.countOfDisallowedSatelliteAccess
+ += stats.countOfDisallowedSatelliteAccess;
+ existingStats.countOfSatelliteAccessCheckFail += stats.countOfSatelliteAccessCheckFail;
+
+ existingStats.isProvisioned = stats.isProvisioned;
+
+ existingStats.countOfSatelliteAllowedStateChangedEvents
+ += stats.countOfSatelliteAllowedStateChangedEvents;
+ existingStats.countOfSuccessfulLocationQueries +=
+ stats.countOfSuccessfulLocationQueries;
+ existingStats.countOfFailedLocationQueries += stats.countOfFailedLocationQueries;
+ } else {
+ mAtoms.satelliteController = insertAtRandomPlace(mAtoms.satelliteController, stats,
+ mMaxNumSatelliteStats);
}
-
- SatelliteController atom = atomArray[0];
- atom.countOfSatelliteServiceEnablementsSuccess
- += stats.countOfSatelliteServiceEnablementsSuccess;
- atom.countOfSatelliteServiceEnablementsFail
- += stats.countOfSatelliteServiceEnablementsFail;
- atom.countOfOutgoingDatagramSuccess
- += stats.countOfOutgoingDatagramSuccess;
- atom.countOfOutgoingDatagramFail
- += stats.countOfOutgoingDatagramFail;
- atom.countOfIncomingDatagramSuccess
- += stats.countOfIncomingDatagramSuccess;
- atom.countOfIncomingDatagramFail
- += stats.countOfIncomingDatagramFail;
- atom.countOfDatagramTypeSosSmsSuccess
- += stats.countOfDatagramTypeSosSmsSuccess;
- atom.countOfDatagramTypeSosSmsFail
- += stats.countOfDatagramTypeSosSmsFail;
- atom.countOfDatagramTypeLocationSharingSuccess
- += stats.countOfDatagramTypeLocationSharingSuccess;
- atom.countOfDatagramTypeLocationSharingFail
- += stats.countOfDatagramTypeLocationSharingFail;
- atom.countOfProvisionSuccess
- += stats.countOfProvisionSuccess;
- atom.countOfProvisionFail
- += stats.countOfProvisionFail;
- atom.countOfDeprovisionSuccess
- += stats.countOfDeprovisionSuccess;
- atom.countOfDeprovisionFail
- += stats.countOfDeprovisionFail;
- atom.totalServiceUptimeSec
- += stats.totalServiceUptimeSec;
- atom.totalBatteryConsumptionPercent
- += stats.totalBatteryConsumptionPercent;
- atom.totalBatteryChargedTimeSec
- += stats.totalBatteryChargedTimeSec;
- atom.countOfDemoModeSatelliteServiceEnablementsSuccess
- += stats.countOfDemoModeSatelliteServiceEnablementsSuccess;
- atom.countOfDemoModeSatelliteServiceEnablementsFail
- += stats.countOfDemoModeSatelliteServiceEnablementsFail;
- atom.countOfDemoModeOutgoingDatagramSuccess
- += stats.countOfDemoModeOutgoingDatagramSuccess;
- atom.countOfDemoModeOutgoingDatagramFail
- += stats.countOfDemoModeOutgoingDatagramFail;
- atom.countOfDemoModeIncomingDatagramSuccess
- += stats.countOfDemoModeIncomingDatagramSuccess;
- atom.countOfDemoModeIncomingDatagramFail
- += stats.countOfDemoModeIncomingDatagramFail;
- atom.countOfDatagramTypeKeepAliveSuccess
- += stats.countOfDatagramTypeKeepAliveSuccess;
- atom.countOfDatagramTypeKeepAliveFail
- += stats.countOfDatagramTypeKeepAliveFail;
- atom.countOfAllowedSatelliteAccess += stats.countOfAllowedSatelliteAccess;
- atom.countOfDisallowedSatelliteAccess += stats.countOfDisallowedSatelliteAccess;
- atom.countOfSatelliteAccessCheckFail += stats.countOfSatelliteAccessCheckFail;
-
- atom.isProvisioned = stats.isProvisioned;
- atom.carrierId = stats.carrierId;
-
- atom.countOfSatelliteAllowedStateChangedEvents
- += stats.countOfSatelliteAllowedStateChangedEvents;
- atom.countOfSuccessfulLocationQueries += stats.countOfSuccessfulLocationQueries;
- atom.countOfFailedLocationQueries += stats.countOfFailedLocationQueries;
-
- mAtoms.satelliteController = atomArray;
saveAtomsToFile(SAVE_TO_FILE_DELAY_FOR_UPDATE_MILLIS);
}
@@ -1825,7 +1823,7 @@
atoms.outgoingShortCodeSms = sanitizeAtoms(atoms.outgoingShortCodeSms,
OutgoingShortCodeSms.class, mMaxOutgoingShortCodeSms);
atoms.satelliteController = sanitizeAtoms(atoms.satelliteController,
- SatelliteController.class, mMaxNumSatelliteControllerStats);
+ SatelliteController.class, mMaxNumSatelliteStats);
atoms.satelliteSession = sanitizeAtoms(atoms.satelliteSession,
SatelliteSession.class, mMaxNumSatelliteStats);
atoms.satelliteIncomingDatagram = sanitizeAtoms(atoms.satelliteIncomingDatagram,
@@ -1848,7 +1846,7 @@
mMaxNumSatelliteStats);
atoms.carrierRoamingSatelliteControllerStats = sanitizeAtoms(
atoms.carrierRoamingSatelliteControllerStats,
- CarrierRoamingSatelliteControllerStats.class, mMaxNumSatelliteControllerStats);
+ CarrierRoamingSatelliteControllerStats.class, mMaxNumSatelliteStats);
atoms.satelliteEntitlement = sanitizeAtoms(atoms.satelliteEntitlement,
SatelliteEntitlement.class, mMaxNumSatelliteStats);
atoms.satelliteConfigUpdater = sanitizeAtoms(atoms.satelliteConfigUpdater,
@@ -2390,6 +2388,19 @@
}
/**
+ * Returns SatelliteController atom that has same carrier_id value or
+ * {@code null} if does not exist.
+ */
+ private @Nullable SatelliteController find(SatelliteController key) {
+ for (SatelliteController stats : mAtoms.satelliteController) {
+ if (stats.carrierId == key.carrierId) {
+ return stats;
+ }
+ }
+ return null;
+ }
+
+ /**
* Returns CarrierRoamingSatelliteControllerStats atom that has same carrier_id value or
* {@code null} if does not exist.
*/
diff --git a/src/java/com/android/internal/telephony/satellite/DatagramController.java b/src/java/com/android/internal/telephony/satellite/DatagramController.java
index 9f6edf2..acd3fd1 100644
--- a/src/java/com/android/internal/telephony/satellite/DatagramController.java
+++ b/src/java/com/android/internal/telephony/satellite/DatagramController.java
@@ -16,6 +16,7 @@
package com.android.internal.telephony.satellite;
+import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_KEEP_ALIVE;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_UNKNOWN;
import static android.telephony.satellite.SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE;
@@ -419,6 +420,15 @@
&& mSatelltieModemState == SATELLITE_MODEM_STATE_NOT_CONNECTED) {
return false;
}
+ boolean allowCheckMessageInNotConnected =
+ mContext.getResources().getBoolean(
+ R.bool.config_satellite_allow_check_message_in_not_connected);
+ if (datagramType == DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS
+ && mSatelltieModemState == SATELLITE_MODEM_STATE_NOT_CONNECTED
+ && allowCheckMessageInNotConnected
+ && mFeatureFlags.carrierRoamingNbIotNtn()) {
+ return false;
+ }
if (mSatelltieModemState != SATELLITE_MODEM_STATE_CONNECTED
&& mSatelltieModemState != SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING) {
return true;
diff --git a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
index e62fa1d..113c3ee 100644
--- a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
+++ b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
@@ -753,6 +753,8 @@
private void reportSendDatagramCompleted(@NonNull SendSatelliteDatagramArgument argument,
@NonNull @SatelliteManager.SatelliteResult int resultCode) {
+ long datagramTransmissionTime = argument.datagramStartTime > 0
+ ? (System.currentTimeMillis() - argument.datagramStartTime) : 0;
SatelliteStats.getInstance().onSatelliteOutgoingDatagramMetrics(
new SatelliteStats.SatelliteOutgoingDatagramParams.Builder()
.setDatagramType(argument.datagramType)
@@ -760,15 +762,15 @@
.setDatagramSizeBytes(argument.getDatagramRoundedSizeBytes())
/* In case pending datagram has not been attempted to send to modem
interface. transfer time will be 0. */
- .setDatagramTransferTimeMillis(argument.datagramStartTime > 0
- ? (System.currentTimeMillis() - argument.datagramStartTime) : 0)
+ .setDatagramTransferTimeMillis(datagramTransmissionTime)
.setIsDemoMode(mIsDemoMode)
.setCarrierId(SatelliteController.getInstance().getSatelliteCarrierId())
.build());
if (resultCode == SatelliteManager.SATELLITE_RESULT_SUCCESS) {
mControllerMetricsStats.reportOutgoingDatagramSuccessCount(argument.datagramType,
mIsDemoMode);
- mSessionMetricsStats.addCountOfSuccessfulOutgoingDatagram(argument.datagramType);
+ mSessionMetricsStats.addCountOfSuccessfulOutgoingDatagram(argument.datagramType,
+ datagramTransmissionTime);
} else {
mControllerMetricsStats.reportOutgoingDatagramFailCount(argument.datagramType,
mIsDemoMode);
diff --git a/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java b/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java
index a921b89..75771d0 100644
--- a/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java
+++ b/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java
@@ -376,6 +376,10 @@
});
}
+ // Send the captured data about incoming datagram to metric
+ sInstance.reportMetrics(satelliteDatagram,
+ SatelliteManager.SATELLITE_RESULT_SUCCESS);
+
if (pendingCount <= 0) {
sInstance.mDatagramController.updateReceiveStatus(mSubId,
SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE,
@@ -393,10 +397,6 @@
internalCallback::accept);
sInstance.pollPendingSatelliteDatagramsInternal(mSubId, callback);
}
-
- // Send the captured data about incoming datagram to metric
- sInstance.reportMetrics(satelliteDatagram,
- SatelliteManager.SATELLITE_RESULT_SUCCESS);
break;
}
@@ -748,8 +748,8 @@
(int) (Math.round((double) sizeBytes / ROUNDING_UNIT) * ROUNDING_UNIT);
}
datagramTransferTime = (System.currentTimeMillis() - mDatagramTransferStartTime);
- mDatagramTransferStartTime = 0;
}
+ mDatagramTransferStartTime = 0;
SatelliteStats.getInstance().onSatelliteIncomingDatagramMetrics(
new SatelliteStats.SatelliteIncomingDatagramParams.Builder()
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteController.java b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
index 0f10c87..c1f03bb 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
@@ -33,6 +33,8 @@
import static android.telephony.CarrierConfigManager.KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT;
+import static android.telephony.CarrierConfigManager.KEY_SATELLITE_DATA_SUPPORT_MODE_INT;
+import static android.telephony.CarrierConfigManager.KEY_SATELLITE_DISPLAY_NAME_STRING;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ESOS_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_NIDD_APN_NAME_STRING;
@@ -41,7 +43,7 @@
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ROAMING_P2P_SMS_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ROAMING_SCREEN_OFF_INACTIVITY_TIMEOUT_SEC_INT;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ROAMING_TURN_OFF_SESSION_FOR_EMERGENCY_CALL_BOOL;
-import static android.telephony.CarrierConfigManager.KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE;
+import static android.telephony.CarrierConfigManager.KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE_BYTES_INT;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_SUPPORTED_MSG_APPS_STRING_ARRAY;
import static android.telephony.SubscriptionManager.SATELLITE_ATTACH_ENABLED_FOR_CARRIER;
import static android.telephony.SubscriptionManager.SATELLITE_ENTITLEMENT_STATUS;
@@ -436,9 +438,9 @@
private final ConcurrentHashMap<IBinder, ISelectedNbIotSatelliteSubscriptionCallback>
mSelectedNbIotSatelliteSubscriptionChangedListeners = new ConcurrentHashMap<>();
- private final Object mIsSatelliteSupportedLock = new Object();
+ protected final Object mIsSatelliteSupportedLock = new Object();
@GuardedBy("mIsSatelliteSupportedLock")
- private Boolean mIsSatelliteSupported = null;
+ protected Boolean mIsSatelliteSupported = null;
private boolean mIsDemoModeEnabled = false;
private boolean mIsEmergency = false;
private final Object mIsSatelliteEnabledLock = new Object();
@@ -577,6 +579,21 @@
* carrierPlmnList. */
@GuardedBy("mSupportedSatelliteServicesLock")
private final SparseArray<List<String>> mMergedPlmnListPerCarrier = new SparseArray<>();
+ /** Key Subscription ID, value : map to plmn info with related data plan. */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ SparseArray<Map<String, Integer>> mEntitlementDataPlanMapPerCarrier = new SparseArray<>();
+ /** Key Subscription ID, value : map to plmn info with related service type. */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ SparseArray<Map<String, List<Integer>>> mEntitlementServiceTypeMapPerCarrier =
+ new SparseArray<>();
+ /** Key Subscription ID, value : map to plmn info with related service policy for data service */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ SparseArray<Map<String, Integer>> mEntitlementDataServicePolicyMapPerCarrier =
+ new SparseArray<>();
+ /** Key Subscription ID, value : map to plmn info with related service policy for voice service */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ SparseArray<Map<String, Integer>> mEntitlementVoiceServicePolicyMapPerCarrier =
+ new SparseArray<>();
private static AtomicLong sNextSatelliteEnableRequestId = new AtomicLong(0);
// key : subscriberId, value : provisioned or not.
@GuardedBy("mSatelliteTokenProvisionedLock")
@@ -657,6 +674,15 @@
private final Object mNtnSmsSupportedByMessagesAppLock = new Object();
@GuardedBy("mNtnSmsSupportedByMessagesAppLock")
private Boolean mNtnSmsSupportedByMessagesApp = null;
+
+ private final Object mSatelliteModemStateLock = new Object();
+ @GuardedBy("mSatelliteModemStateLock")
+ @SatelliteManager.SatelliteModemState
+ private int mSatelliteModemState = SatelliteManager.SATELLITE_MODEM_STATE_UNKNOWN;
+
+ // Data Plan types at entitlement for the plmn allowed
+ public static final int SATELLITE_DATA_PLAN_METERED = 0;
+ public static final int SATELLITE_DATA_PLAN_UNMETERED = 1;
private BroadcastReceiver
mDefaultSmsSubscriptionChangedBroadcastReceiver = new BroadcastReceiver() {
@Override
@@ -726,12 +752,13 @@
* (e.g., class name and method name)
*/
public void incrementResultReceiverCount(String caller) {
- if (mFeatureFlags.geofenceEnhancementForBetterUx()) {
+ if (mFeatureFlags.carrierRoamingNbIotNtn()) {
synchronized (mResultReceiverTotalCountLock) {
mResultReceiverTotalCount++;
logd("[incrementResultReceiverCount] : " + caller
+ " | ResultReceiver total count= " + mResultReceiverTotalCount);
- mResultReceiverCountPerMethodMap.compute(caller, (k, v) -> v == null ? 1 : v + 1);
+ mResultReceiverCountPerMethodMap.compute(caller,
+ (k, v) -> v == null ? 1 : v + 1);
if (mResultReceiverTotalCount > RESULT_RECEIVER_COUNT_ANOMALY_THRESHOLD) {
loge("[mResultReceiverTotalCount] is exceeds limits : "
@@ -745,7 +772,7 @@
}
}
} else {
- logd("[incrementResultReceiverCount]: geofenceEnhancementForBetterUx is not enabled");
+ logd("[incrementResultReceiverCount]: carrierRoamingNbIotNtn is not enabled");
}
}
@@ -757,7 +784,7 @@
* (e.g., class name and method name)
*/
public void decrementResultReceiverCount(String caller) {
- if (mFeatureFlags.geofenceEnhancementForBetterUx()) {
+ if (mFeatureFlags.carrierRoamingNbIotNtn()) {
synchronized (mResultReceiverTotalCountLock) {
if (mResultReceiverTotalCount > 0) {
mResultReceiverTotalCount--;
@@ -768,7 +795,7 @@
(k, v) -> v > 0 ? v - 1 : v);
}
} else {
- logd("[decrementResultReceiverCount]: geofenceEnhancementForBetterUx is not enabled");
+ logd("[decrementResultReceiverCount]: carrierRoamingNbIotNtn is not enabled");
}
}
@@ -3808,6 +3835,14 @@
return new ArrayList<>();
}
synchronized (mSupportedSatelliteServicesLock) {
+ Map<String, List<Integer>> allowedServicesList
+ = mEntitlementServiceTypeMapPerCarrier.get(subId);
+ if (allowedServicesList != null && allowedServicesList.containsKey(plmn)) {
+ List<Integer> allowedServiceValues = allowedServicesList.get(plmn);
+ if (allowedServiceValues != null && !allowedServiceValues.isEmpty()) {
+ return allowedServiceValues;
+ }
+ }
if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {
Map<String, Set<Integer>> supportedServices =
mSatelliteServicesSupportedByCarriers.get(subId);
@@ -4192,10 +4227,18 @@
* @param entitlementEnabled {@code true} Satellite service enabled
* @param allowedPlmnList plmn allowed list to use the satellite service
* @param barredPlmnList plmn barred list to pass the modem
+ * @param plmnDataPlanMap data plan map for the plmn
+ * @param plmnServiceTypeMap available services map for the plmn
+ * @param plmnDataServicePolicyMap data service policy map for the plmn
+ * @param plmnVoiceServicePolicyMap voice service policy map for the plmn
* @param callback callback for accept
*/
public void onSatelliteEntitlementStatusUpdated(int subId, boolean entitlementEnabled,
@Nullable List<String> allowedPlmnList, @Nullable List<String> barredPlmnList,
+ @Nullable Map<String,Integer> plmnDataPlanMap,
+ @Nullable Map<String,List<Integer>> plmnServiceTypeMap,
+ @Nullable Map<String,Integer> plmnDataServicePolicyMap,
+ @Nullable Map<String,Integer> plmnVoiceServicePolicyMap,
@Nullable IIntegerConsumer callback) {
if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
logd("onSatelliteEntitlementStatusUpdated: carrierEnabledSatelliteFlag is not enabled");
@@ -4216,10 +4259,26 @@
if (barredPlmnList == null) {
barredPlmnList = new ArrayList<>();
}
+ if (plmnDataPlanMap == null) {
+ plmnDataPlanMap = new HashMap<>();
+ }
+ if (plmnServiceTypeMap == null) {
+ plmnServiceTypeMap = new HashMap<>();
+ }
+ if (plmnDataServicePolicyMap == null) {
+ plmnDataServicePolicyMap = new HashMap<>();
+ }
+ if (plmnVoiceServicePolicyMap == null) {
+ plmnVoiceServicePolicyMap = new HashMap<>();
+ }
logd("onSatelliteEntitlementStatusUpdated subId=" + subId + ", entitlementEnabled="
+ entitlementEnabled + ", allowedPlmnList=["
+ String.join(",", allowedPlmnList) + "]" + ", barredPlmnList=["
- + String.join(",", barredPlmnList) + "]");
+ + String.join(",", barredPlmnList) + "]"
+ + ", plmnDataPlanMap =" + plmnDataPlanMap.toString()
+ + ", plmnServiceTypeMap =" + plmnServiceTypeMap.toString()
+ + ", plmnDataServicePolicyMap=" + plmnDataServicePolicyMap.toString()
+ + ", plmnVoiceServicePolicyMap=" + plmnVoiceServicePolicyMap.toString());
synchronized (mSupportedSatelliteServicesLock) {
if (mSatelliteEntitlementStatusPerCarrier.get(subId, false) != entitlementEnabled) {
@@ -4244,6 +4303,10 @@
mMergedPlmnListPerCarrier.remove(subId);
mEntitlementPlmnListPerCarrier.put(subId, allowedPlmnList);
mEntitlementBarredPlmnListPerCarrier.put(subId, barredPlmnList);
+ mEntitlementDataPlanMapPerCarrier.put(subId, plmnDataPlanMap);
+ mEntitlementServiceTypeMapPerCarrier.put(subId, plmnServiceTypeMap);
+ mEntitlementDataServicePolicyMapPerCarrier.put(subId, plmnDataServicePolicyMap);
+ mEntitlementVoiceServicePolicyMapPerCarrier.put(subId, plmnVoiceServicePolicyMap);
updatePlmnListPerCarrier(subId);
configureSatellitePlmnForCarrier(subId);
mSubscriptionManagerService.setSatelliteEntitlementPlmnList(subId, allowedPlmnList);
@@ -4771,6 +4834,11 @@
private void handleEventSatelliteModemStateChanged(
@SatelliteManager.SatelliteModemState int state) {
plogd("handleEventSatelliteModemStateChanged: state=" + state);
+
+ synchronized (mSatelliteModemStateLock) {
+ mSatelliteModemState = state;
+ }
+
if (state == SatelliteManager.SATELLITE_MODEM_STATE_UNAVAILABLE
|| state == SatelliteManager.SATELLITE_MODEM_STATE_OFF) {
if (!isWaitingForDisableSatelliteModemResponse()) {
@@ -5341,6 +5409,7 @@
config = mCarrierConfigManager.getConfigForSubId(subId,
KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE,
KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ KEY_SATELLITE_DISPLAY_NAME_STRING,
KEY_SATELLITE_ROAMING_TURN_OFF_SESSION_FOR_EMERGENCY_CALL_BOOL,
KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT,
KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL,
@@ -5356,9 +5425,10 @@
KEY_SATELLITE_ROAMING_SCREEN_OFF_INACTIVITY_TIMEOUT_SEC_INT,
KEY_SATELLITE_ROAMING_P2P_SMS_INACTIVITY_TIMEOUT_SEC_INT,
KEY_SATELLITE_ROAMING_ESOS_INACTIVITY_TIMEOUT_SEC_INT,
- KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE,
+ KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE_BYTES_INT,
KEY_SATELLITE_SUPPORTED_MSG_APPS_STRING_ARRAY,
- KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE
+ KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE,
+ KEY_SATELLITE_DATA_SUPPORT_MODE_INT
);
} catch (Exception e) {
logw("getConfigForSubId: " + e);
@@ -5477,7 +5547,7 @@
/** If the provision state per subscriberId for the cached is not exist, check the database for
* the corresponding value and use it. */
- private void updateSatelliteProvisionedStatePerSubscriberId() {
+ protected void updateSatelliteProvisionedStatePerSubscriberId() {
if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
return;
}
@@ -5555,7 +5625,7 @@
KEY_SATELLITE_ROAMING_TURN_OFF_SESSION_FOR_EMERGENCY_CALL_BOOL);
}
- private int getCarrierRoamingNtnConnectType(int subId) {
+ public int getCarrierRoamingNtnConnectType(int subId) {
return getConfigForSubId(subId).getInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT);
}
@@ -5564,6 +5634,11 @@
KEY_CARRIER_ROAMING_NTN_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_INT);
}
+ @CarrierConfigManager.SATELLITE_DATA_SUPPORT_MODE
+ private int getCarrierSatelliteDataSupportedMode(int subId) {
+ return getConfigForSubId(subId).getInt(KEY_SATELLITE_DATA_SUPPORT_MODE_INT);
+ }
+
/**
* Check if satellite attach is enabled by user for the carrier associated with the
* {@code subId}.
@@ -6468,6 +6543,23 @@
updateSatelliteSystemNotification(-1, -1,/*visible*/ false);
}
+ public boolean isSatelliteSystemNotificationsEnabled(int carrierRoamingNtnConnectType) {
+ if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
+ return false;
+ }
+ if (carrierRoamingNtnConnectType
+ != CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_MANUAL) {
+ return true;
+ }
+ boolean notifySatelliteAvailabilityEnabled =
+ mContext.getResources().getBoolean(R.bool.config_satellite_should_notify_availability);
+ Boolean isSatelliteSupported = getIsSatelliteSupported();
+ if(isSatelliteSupported == null) {
+ return false;
+ }
+ return notifySatelliteAvailabilityEnabled && isSatelliteSupported;
+ }
+
/**
* Update the system notification to reflect the current satellite status, that's either already
* connected OR needs to be manually enabled. The device should only display one notification
@@ -6481,9 +6573,7 @@
*/
private void updateSatelliteSystemNotification(int subId,
@CARRIER_ROAMING_NTN_CONNECT_TYPE int carrierRoamingNtnConnectType, boolean visible) {
- boolean notifySatelliteAvailabilityEnabled =
- mContext.getResources().getBoolean(R.bool.config_satellite_should_notify_availability);
- if (!mFeatureFlags.carrierRoamingNbIotNtn() || !notifySatelliteAvailabilityEnabled) {
+ if (!isSatelliteSystemNotificationsEnabled(carrierRoamingNtnConnectType)) {
plogd("updateSatelliteSystemNotification: satellite notifications are not enabled.");
return;
}
@@ -7139,6 +7229,29 @@
}
/**
+ * Request to get the name to display for Satellite.
+ *
+ * @param result The result receiver that returns the name to display for the satellite
+ * or an error code if the request failed.
+ */
+ public void requestSatelliteDisplayName(@NonNull ResultReceiver result) {
+ if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
+ plogd("requestSatelliteDisplayName: carrierRoamingNbIotNtn flag is disabled");
+ result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null);
+ return;
+ }
+
+ int subId = getSelectedSatelliteSubId();
+ String displayName = getConfigForSubId(subId).getString(
+ KEY_SATELLITE_DISPLAY_NAME_STRING, "Satellite");
+
+ plogd("requestSatelliteDisplayName: " + displayName);
+ Bundle bundle = new Bundle();
+ bundle.putString(SatelliteManager.KEY_SATELLITE_DISPLAY_NAME, displayName);
+ result.send(SATELLITE_RESULT_SUCCESS, bundle);
+ }
+
+ /**
* Request to get list of prioritized satellite tokens to be used for provision.
*
* @param result The result receiver, which returns the list of prioritized satellite tokens
@@ -7202,7 +7315,7 @@
+ ", provisioned=" + provisioned);
list.add(new SatelliteSubscriberProvisionStatus.Builder()
.setSatelliteSubscriberInfo(satelliteSubscriberInfo)
- .setProvisionStatus(provisioned).build());
+ .setProvisioned(provisioned).build());
mSubscriberIdPerSub.put(subscriberId, info.getSubscriptionId());
}
}
@@ -7258,7 +7371,7 @@
// TODO: need to check if satellite is allowed at current location for the subscription
int subId = getSubIdFromSubscriberId(
status.getSatelliteSubscriberInfo().getSubscriberId());
- if (status.getProvisionStatus() && isActiveSubId(subId)) {
+ if (status.isProvisioned() && isActiveSubId(subId)) {
selectedSubId = subId;
break;
}
@@ -7885,8 +7998,8 @@
private void overrideSatelliteCapabilitiesIfApplicable() {
int subId = getSelectedSatelliteSubId();
PersistableBundle config = getPersistableBundle(subId);
- if (config.containsKey(KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE)) {
- int datagramSize = config.getInt(KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE);
+ if (config.containsKey(KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE_BYTES_INT)) {
+ int datagramSize = config.getInt(KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE_BYTES_INT);
SubscriptionInfo subInfo = mSubscriptionManagerService.getSubscriptionInfo(subId);
if (!(subInfo == null || subInfo.isOnlyNonTerrestrialNetwork())) {
synchronized (mSatelliteCapabilitiesLock) {
@@ -8093,7 +8206,7 @@
NTN_SIGNAL_STRENGTH_NONE);
if (isInCarrierRoamingNbIotNtn(phone)) {
- if (mSatelliteSessionController.isInConnectedState()) {
+ if (isInConnectedState()) {
synchronized (mNtnSignalsStrengthLock) {
carrierRoamingNtnSignalStrength = mNtnSignalStrength;
}
@@ -8113,6 +8226,20 @@
return carrierRoamingNtnSignalStrength;
}
+ private boolean isInConnectedState() {
+ synchronized (mSatelliteModemStateLock) {
+ switch (mSatelliteModemState) {
+ case SatelliteManager.SATELLITE_MODEM_STATE_CONNECTED:
+ case SatelliteManager.SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING:
+ plogd("isInConnectedState: return true");
+ return true;
+ default:
+ plogd("isInConnectedState: return false");
+ return false;
+ }
+ }
+ }
+
protected void updateLastNotifiedCarrierRoamingNtnSignalStrengthAndNotify(
@Nullable Phone phone) {
if (!mFeatureFlags.carrierRoamingNbIotNtn()) return;
@@ -8238,4 +8365,80 @@
return mWifiStateEnabled;
}
}
+
+ /**
+ * Method to return the current data plan for the registered plmn based on entitlement
+ * provisioning information. Note: If no information at
+ * provisioning is supported this is overridden with operator carrier config information.
+ *
+ * @param subId current subscription id
+ * @param plmn current registered plmn information
+ *
+ * @return Data supported modes {@link SatelliteController#SATELLITE_DATA_PLAN_METERED}
+ */
+ public int getSatelliteDataPlanForPlmn(int subId, String plmn) {
+ if (plmn != null) {
+ synchronized (mSupportedSatelliteServicesLock) {
+ Map<String, Integer> dataplanMap = mEntitlementDataPlanMapPerCarrier.get(subId);
+ logd("data plan available for sub id:" + dataplanMap);
+ if (dataplanMap != null && dataplanMap.containsKey(plmn)) {
+ return dataplanMap.get(plmn);
+ }
+ }
+ }
+ // TODO (Override with carrier config value when configuration defined)
+ return SATELLITE_DATA_PLAN_METERED;
+ }
+
+ /**
+ * Method to return the current satellite data service policy supported mode for the registered
+ * plmn based on entitlement provisioning information. Note: If no information at
+ * provisioning is supported this is overridden with operator carrier config information.
+ *
+ * @param subId current subscription id
+ * @param plmn current registered plmn information
+ *
+ * @return Supported modes {@link CarrierConfigManager.SATELLITE_DATA_SUPPORT_MODE}
+ */
+ public int getSatelliteDataServicePolicyForPlmn(int subId, String plmn) {
+ if (plmn != null) {
+ synchronized (mSupportedSatelliteServicesLock) {
+ Map<String, Integer> dataServicePolicy =
+ mEntitlementDataServicePolicyMapPerCarrier.get(
+ subId);
+ logd("data policy available for sub id:" + dataServicePolicy);
+ if (dataServicePolicy != null && dataServicePolicy.containsKey(plmn)) {
+ return dataServicePolicy.get(plmn);
+ }
+ }
+ }
+ return getCarrierSatelliteDataSupportedMode(subId);
+ }
+
+ /**
+ * Method to return the current satellite voice service policy supported mode for the registered
+ * plmn based on entitlement provisioning information. Note: If no information at
+ * provisioning is supported this is overridden with operator carrier config information.
+ *
+ * @param subId current subscription id
+ * @param plmn current registered plmn information
+ *
+ * @return Supported modes {@link CarrierConfigManager.SATELLITE_DATA_SUPPORT_MODE}
+ */
+ public int getSatelliteVoiceServicePolicyForPlmn(int subId, String plmn) {
+ if (plmn != null) {
+ synchronized (mSupportedSatelliteServicesLock) {
+ Map<String, Integer> voiceServicePolicy =
+ mEntitlementVoiceServicePolicyMapPerCarrier.get(
+ subId);
+ logd("voice policy available for sub id:" + voiceServicePolicy);
+ if (voiceServicePolicy != null && voiceServicePolicy.containsKey(plmn)) {
+ return voiceServicePolicy.get(plmn);
+ }
+ }
+ }
+ // TODO (Replace below code with related enum value, when voice service policy support mode
+ // is added)
+ return 0; // Restricted
+ }
}
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteNetworkInfo.java b/src/java/com/android/internal/telephony/satellite/SatelliteNetworkInfo.java
index 7db9195..f101f18 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteNetworkInfo.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteNetworkInfo.java
@@ -16,6 +16,9 @@
package com.android.internal.telephony.satellite;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* Data class of the satellite configuration received from the entitlement server.
*/
@@ -28,9 +31,21 @@
* 2. "metered"
* 3. empty string. */
public String mDataPlanType;
+ /** Stored the Allowed Services Info. with key as service type and value as service
+ * policy for the plmn
+ * Possible Service Type values: "data" and "voice".
+ * Possible Service Policy values: "constrained" and "unconstrained".
+ */
+ public Map<String,String> mAllowedServicesInfo;
- public SatelliteNetworkInfo(String plmn, String dataPlanType) {
+ public SatelliteNetworkInfo(String plmn, String dataPlanType,
+ Map<String,String> allowedServicesInfo) {
mPlmn = plmn;
mDataPlanType = dataPlanType;
+ if (allowedServicesInfo != null) {
+ mAllowedServicesInfo = new HashMap<>(allowedServicesInfo);
+ } else {
+ mAllowedServicesInfo = new HashMap<>();
+ }
}
}
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java b/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
index 182f667..e924878 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
@@ -24,6 +24,9 @@
import static android.telephony.TelephonyManager.EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT;
import static android.telephony.satellite.SatelliteManager.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS;
import static android.telephony.satellite.SatelliteManager.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_NOT_PROVISIONED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_NOT_SUPPORTED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_UNSUPPORTED_DEFAULT_MSG_APP;
import static com.android.internal.telephony.flags.Flags.satellitePersistentLogging;
import static com.android.internal.telephony.satellite.SatelliteController.INVALID_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE;
@@ -73,6 +76,7 @@
import com.android.internal.telephony.flags.Flags;
import com.android.internal.telephony.metrics.SatelliteStats;
+import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -262,6 +266,27 @@
return SmsApplication.getDefaultSendToApplication(mContext, false);
}
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
+ protected boolean updateAndGetProvisionState() {
+ mSatelliteController.updateSatelliteProvisionedStatePerSubscriberId();
+ return isDeviceProvisioned();
+ }
+
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
+ protected boolean isSatelliteAllowedByReasons() {
+ SatelliteManager satelliteManager = mContext.getSystemService(SatelliteManager.class);
+ int[] disallowedReasons = satelliteManager.getSatelliteDisallowedReasons();
+ if (Arrays.stream(disallowedReasons).anyMatch(r ->
+ (r == SATELLITE_DISALLOWED_REASON_UNSUPPORTED_DEFAULT_MSG_APP
+ || r == SATELLITE_DISALLOWED_REASON_NOT_PROVISIONED
+ || r == SATELLITE_DISALLOWED_REASON_NOT_SUPPORTED))) {
+ plogd("isAllowedForDefaultMessageApp:false, disallowedReasons="
+ + Arrays.toString(disallowedReasons));
+ return false;
+ }
+ return true;
+ }
+
private void handleEmergencyCallStartedEvent(@NonNull Connection connection) {
plogd("handleEmergencyCallStartedEvent: connection=" + connection);
mSatelliteController.setLastEmergencyCallTime();
@@ -284,7 +309,8 @@
}
private void handleSatelliteProvisionStateChangedEvent(boolean provisioned) {
- if (!provisioned) {
+ if (!provisioned
+ && !isSatelliteConnectedViaCarrierWithinHysteresisTime()) {
cleanUpResources(false);
}
}
@@ -310,6 +336,8 @@
return;
}
+ updateAndGetProvisionState();
+
/*
* The device might be connected to satellite after the emergency call started. Thus, we
* need to do this check again so that we will have higher chance of sending the event
@@ -321,7 +349,7 @@
boolean isCellularAvailable = SatelliteServiceUtils.isCellularAvailable();
if (!isCellularAvailable
&& isSatelliteAllowed()
- && (isDeviceProvisioned()
+ && ((isDeviceProvisioned() && isSatelliteAllowedByReasons())
|| isSatelliteConnectedViaCarrierWithinHysteresisTime())
&& shouldTrackCall(mEmergencyConnection.getState())) {
plogd("handleTimeoutEvent: Sent EVENT_DISPLAY_EMERGENCY_MESSAGE to Dialer");
@@ -645,7 +673,7 @@
@NonNull private Bundle createExtraBundleForEventDisplayEmergencyMessage(
boolean isTestEmergencyNumber) {
- int handoverType = EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS;
+ int handoverType = getEmergencyCallToSatelliteHandoverType();
Pair<String, String> oemSatelliteMessagingApp =
getOemEnabledSatelliteHandoverAppFromOverlayConfig(mContext);
String packageName = oemSatelliteMessagingApp.first;
@@ -653,10 +681,8 @@
String action = getSatelliteEmergencyHandoverIntentActionFromOverlayConfig(mContext,
isTestEmergencyNumber);
- if (isSatelliteConnectedViaCarrierWithinHysteresisTime()
- || isEmergencyCallToSatelliteHandoverTypeT911Enforced()) {
+ if (handoverType == EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911) {
ComponentName defaultSmsAppComponent = getDefaultSmsApp();
- handoverType = EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911;
packageName = defaultSmsAppComponent.getPackageName();
className = defaultSmsAppComponent.getClassName();
}
@@ -737,7 +763,9 @@
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
public int getEmergencyCallToSatelliteHandoverType() {
- if (Flags.carrierRoamingNbIotNtn() && isDeviceProvisioned()
+ if (Flags.carrierRoamingNbIotNtn()
+ && isDeviceProvisioned()
+ && isSatelliteAllowedByReasons()
&& isSatelliteConnectedViaCarrierWithinHysteresisTime()) {
int satelliteSubId = mSatelliteController.getSelectedSatelliteSubId();
return mSatelliteController.getCarrierRoamingNtnEmergencyCallToSatelliteHandoverType(
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java b/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java
index 1e467e8..b55c622 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java
@@ -553,34 +553,45 @@
new android.telephony.satellite.stub.SystemSelectionSpecifier();
convertedSpecifier.mMccMnc = systemSelectionSpecifier.getMccMnc();
- convertedSpecifier.mBands = systemSelectionSpecifier.getBands().toArray();
- convertedSpecifier.mEarfcs = systemSelectionSpecifier.getEarfcns().toArray();
- SatelliteInfo[] satelliteInfos = systemSelectionSpecifier.getSatelliteInfos();
+ convertedSpecifier.mBands = systemSelectionSpecifier.getBands();
+ convertedSpecifier.mEarfcs = systemSelectionSpecifier.getEarfcns();
+ SatelliteInfo[] satelliteInfos = systemSelectionSpecifier.getSatelliteInfos()
+ .toArray(new SatelliteInfo[0]);
android.telephony.satellite.stub.SatelliteInfo[] halSatelliteInfos =
new android.telephony.satellite.stub.SatelliteInfo[satelliteInfos.length];
for (int i = 0; i < satelliteInfos.length; i++) {
+ halSatelliteInfos[i] = new android.telephony.satellite.stub.SatelliteInfo();
+
+ halSatelliteInfos[i].id = new android.telephony.satellite.stub.UUID();
halSatelliteInfos[i].id.mostSigBits =
satelliteInfos[i].getSatelliteId().getMostSignificantBits();
halSatelliteInfos[i].id.leastSigBits =
satelliteInfos[i].getSatelliteId().getLeastSignificantBits();
+
+ halSatelliteInfos[i].position =
+ new android.telephony.satellite.stub.SatellitePosition();
halSatelliteInfos[i].position.longitudeDegree =
satelliteInfos[i].getSatellitePosition().getLongitudeDegrees();
halSatelliteInfos[i].position.altitudeKm =
satelliteInfos[i].getSatellitePosition().getAltitudeKm();
+
halSatelliteInfos[i].bands = satelliteInfos[i].getBands().stream().mapToInt(
Integer::intValue).toArray();
+
List<EarfcnRange> earfcnRangeList = satelliteInfos[i].getEarfcnRanges();
halSatelliteInfos[i].earfcnRanges =
new android.telephony.satellite.stub.EarfcnRange[earfcnRangeList.size()];
for (int j = 0; j < earfcnRangeList.size(); j++) {
+ halSatelliteInfos[i].earfcnRanges[j] =
+ new android.telephony.satellite.stub.EarfcnRange();
halSatelliteInfos[i].earfcnRanges[j].startEarfcn = earfcnRangeList.get(
j).getStartEarfcn();
halSatelliteInfos[i].earfcnRanges[j].endEarfcn = earfcnRangeList.get(
- j).getStartEarfcn();
+ j).getEndEarfcn();
}
}
convertedSpecifier.satelliteInfos = halSatelliteInfos;
- convertedSpecifier.tagIds = systemSelectionSpecifier.getTagIds().toArray();
+ convertedSpecifier.tagIds = systemSelectionSpecifier.getTagIds();
return convertedSpecifier;
}
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java b/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
index d1d03a0..f2f4cac 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
@@ -68,7 +68,6 @@
import android.util.Log;
import com.android.internal.R;
-import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.DeviceStateMonitor;
import com.android.internal.telephony.ExponentialBackoff;
@@ -586,17 +585,6 @@
}
/**
- * Get whether state machine is in connected state.
- *
- * @return {@code true} if state machine is in connected state and {@code false} otherwise.
- */
- public boolean isInConnectedState() {
- if (DBG) plogd("isInConnectedState: getCurrentState=" + getCurrentState());
- return getCurrentState() == mConnectedState;
- }
-
-
- /**
* Release all resource.
*/
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
@@ -886,10 +874,19 @@
stopNbIotInactivityTimer();
//Enable Cellular Modem scanning
- Message onCompleted =
+ boolean configSatelliteAllowTnScanningDuringSatelliteSession =
+ mContext.getResources().getBoolean(
+ R.bool.config_satellite_allow_tn_scanning_during_satellite_session);
+ if (configSatelliteAllowTnScanningDuringSatelliteSession) {
+ Message onCompleted =
obtainMessage(EVENT_ENABLE_CELLULAR_MODEM_WHILE_SATELLITE_MODE_IS_ON_DONE);
- mSatelliteModemInterface.enableCellularModemWhileSatelliteModeIsOn(true, onCompleted);
- if (isConcurrentTnScanningSupported()) {
+ mSatelliteModemInterface
+ .enableCellularModemWhileSatelliteModeIsOn(true, onCompleted);
+ } else {
+ plogd("Device does not allow cellular modem scanning");
+ }
+ if (isConcurrentTnScanningSupported()
+ || !configSatelliteAllowTnScanningDuringSatelliteSession) {
plogd("IDLE state is hidden from clients");
} else {
notifyStateChangedEvent(SatelliteManager.SATELLITE_MODEM_STATE_IDLE);
diff --git a/src/java/com/android/internal/telephony/satellite/metrics/SessionMetricsStats.java b/src/java/com/android/internal/telephony/satellite/metrics/SessionMetricsStats.java
index 2ae8f9d..0a82b99 100644
--- a/src/java/com/android/internal/telephony/satellite/metrics/SessionMetricsStats.java
+++ b/src/java/com/android/internal/telephony/satellite/metrics/SessionMetricsStats.java
@@ -18,6 +18,7 @@
import static android.telephony.TelephonyManager.UNKNOWN_CARRIER_ID;
import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_NONE;
+import static android.telephony.satellite.SatelliteManager.KEY_SESSION_STATS_V2;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS;
import android.annotation.NonNull;
@@ -61,9 +62,11 @@
private int mCountOfSatelliteNotificationDisplayed;
private int mCountOfAutoExitDueToScreenOff;
private int mCountOfAutoExitDueToTnNetwork;
+ private SatelliteSessionStats datagramStats;
private SessionMetricsStats() {
initializeSessionMetricsParam();
+ datagramStats = new SatelliteSessionStats();
}
/**
@@ -128,7 +131,9 @@
/** Increase the count of successful outgoing datagram transmission. */
public SessionMetricsStats addCountOfSuccessfulOutgoingDatagram(
- @NonNull @SatelliteManager.DatagramType int datagramType) {
+ @NonNull @SatelliteManager.DatagramType int datagramType,
+ long datagramTransmissionTime) {
+ datagramStats.recordSuccessfulOutgoingDatagramStats(datagramType, datagramTransmissionTime);
if (datagramType == SatelliteManager.DATAGRAM_TYPE_KEEP_ALIVE) {
// Ignore KEEP_ALIVE messages
return this;
@@ -145,6 +150,7 @@
public SessionMetricsStats addCountOfFailedOutgoingDatagram(
@NonNull @SatelliteManager.DatagramType int datagramType,
@NonNull @SatelliteManager.SatelliteResult int resultCode) {
+ datagramStats.addCountOfUnsuccessfulUserMessages(datagramType, resultCode);
if (datagramType == SatelliteManager.DATAGRAM_TYPE_KEEP_ALIVE) {
// Ignore KEEP_ALIVE messages
return this;
@@ -284,6 +290,7 @@
/** Returns {@link SatelliteSessionStats} of the satellite service. */
public void requestSatelliteSessionStats(int subId, @NonNull ResultReceiver result) {
+ Log.i(TAG, "requestSatelliteSessionStats called");
Bundle bundle = new Bundle();
SatelliteSessionStats sessionStats = new SatelliteSessionStats.Builder()
.setCountOfSuccessfulUserMessages(mShadowCountOfSuccessfulOutgoingDatagram)
@@ -296,6 +303,10 @@
DatagramDispatcher.getInstance().getPendingUserMessagesCount())
.build();
bundle.putParcelable(SatelliteManager.KEY_SESSION_STATS, sessionStats);
+
+ // TODO b/381007377 should retrieve MessagesInQueueToBeSent count per messageType and add
+ // to datagramStats
+ bundle.putParcelable(KEY_SESSION_STATS_V2, datagramStats);
result.send(SATELLITE_RESULT_SUCCESS, bundle);
}
@@ -310,9 +321,9 @@
}
private void initializeSessionMetricsParam() {
- mInitializationResult = SatelliteManager.SATELLITE_RESULT_SUCCESS;
+ mInitializationResult = SATELLITE_RESULT_SUCCESS;
mRadioTechnology = SatelliteManager.NT_RADIO_TECHNOLOGY_UNKNOWN;
- mTerminationResult = SatelliteManager.SATELLITE_RESULT_SUCCESS;
+ mTerminationResult = SATELLITE_RESULT_SUCCESS;
mInitializationProcessingTimeMillis = 0;
mTerminationProcessingTimeMillis = 0;
mSessionDurationSec = 0;
@@ -336,6 +347,7 @@
mShadowCountOfFailedOutgoingDatagram = 0;
mShadowCountOfTimedOutUserMessagesWaitingForConnection = 0;
mShadowCountOfTimedOutUserMessagesWaitingForAck = 0;
+ datagramStats.clear();
}
private static void logd(@NonNull String log) {
diff --git a/src/java/com/android/internal/telephony/uicc/SimTypeInfo.java b/src/java/com/android/internal/telephony/uicc/SimTypeInfo.java
new file mode 100644
index 0000000..b19e42a
--- /dev/null
+++ b/src/java/com/android/internal/telephony/uicc/SimTypeInfo.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony.uicc;
+
+import android.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * This class contains the sim type information of active physical slot ids.
+ */
+public class SimTypeInfo {
+
+ /**
+ * SimType (bit mask)
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({
+ SimType.SIM_TYPE_UNKNOWN,
+ SimType.SIM_TYPE_PHYSICAL,
+ SimType.SIM_TYPE_ESIM,
+ })
+ public @interface SimType {
+ /** Unknown SIM */
+ int SIM_TYPE_UNKNOWN = 0;
+ /** Physical SIM (Can have eUICC capabilities) */
+ int SIM_TYPE_PHYSICAL = 1 << 0;
+ /** Embedded SIM*/
+ int SIM_TYPE_ESIM = 1 << 1;
+ }
+
+ public @SimType int mCurrentSimType = SimType.SIM_TYPE_UNKNOWN;
+ // Bitmask of the supported {@code SimType}s
+ public int mSupportedSimTypes;
+
+ /**
+ * Set the current SimType according to the input type.
+ */
+ public void setCurrentSimType(int simType) {
+ switch(simType) {
+ case android.hardware.radio.config.SimType.UNKNOWN:
+ mCurrentSimType = SimType.SIM_TYPE_UNKNOWN;
+ break;
+ case android.hardware.radio.config.SimType.PHYSICAL:
+ mCurrentSimType = SimType.SIM_TYPE_PHYSICAL;
+ break;
+ case android.hardware.radio.config.SimType.ESIM:
+ mCurrentSimType = SimType.SIM_TYPE_ESIM;
+ break;
+ default:
+ throw new RuntimeException("Unrecognized RIL_SimType: " + simType);
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("SimTypeInfo {activeSimType=").append(mCurrentSimType).append(",")
+ .append("supportedSimType=").append(mSupportedSimTypes);
+ sb.append("}");
+ return sb.toString();
+ }
+}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java
index f92643a..a7923cf 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java
@@ -1044,7 +1044,8 @@
doReturn(new TelephonyDisplayInfo(
mNetworkTypeController.getDataNetworkType(),
mNetworkTypeController.getOverrideNetworkType(),
- false)).when(mDisplayInfoController).getTelephonyDisplayInfo();
+ false, false, false))
+ .when(mDisplayInfoController).getTelephonyDisplayInfo();
return null;
}).when(mDisplayInfoController).updateTelephonyDisplayInfo();
mNetworkRegistrationInfo = new NetworkRegistrationInfo.Builder()
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTest.java b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTest.java
index 4c42e2e..05107df 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTest.java
@@ -173,6 +173,7 @@
rats.add(new Pair<Integer, Boolean>(ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA, false));
rats.add(new Pair<Integer, Boolean>(ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN, false));
rats.add(new Pair<Integer, Boolean>(ServiceState.RIL_RADIO_TECHNOLOGY_NR, false));
+ rats.add(new Pair<Integer, Boolean>(ServiceState.RIL_RADIO_TECHNOLOGY_NB_IOT_NTN, false));
for (Pair<Integer, Boolean> rat : rats) {
boolean isCdma = rat.second;
diff --git a/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java b/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
index 5a8cdd8..e5aa541 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
@@ -139,7 +139,7 @@
private long mCallbackModeDurationMillis;
private boolean mCarrierRoamingNtnMode;
private boolean mCarrierRoamingNtnEligible;
- private List<Integer> mCarrierRoamingNtnAvailableServices;
+ private int[] mCarrierRoamingNtnAvailableServices;
private NtnSignalStrength mCarrierRoamingNtnSignalStrength;
private boolean mIsSatelliteEnabled;
private final List<List<CallState>> mCallStateList = new ArrayList<>();
@@ -357,7 +357,7 @@
}
@Override
- public void onCarrierRoamingNtnAvailableServicesChanged(List<Integer> services) {
+ public void onCarrierRoamingNtnAvailableServicesChanged(int[] services) {
invocationCount.incrementAndGet();
mCarrierRoamingNtnAvailableServices = services;
}
@@ -1354,7 +1354,7 @@
TelephonyDisplayInfo displayInfo = new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_LTE,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED,
- false);
+ false, false, false);
// Notify with invalid subId on default phone. Should NOT trigger callback.
mTelephonyRegistry.notifyDisplayInfoChanged(0, INVALID_SUBSCRIPTION_ID, displayInfo);
@@ -1381,11 +1381,11 @@
TelephonyDisplayInfo displayInfo = new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_LTE,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED,
- false);
+ false, false, false);
TelephonyDisplayInfo expectDisplayInfo = new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_LTE,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE,
- false);
+ false, false, false);
// Notify with invalid subId on default phone. Should NOT trigger callback.
mTelephonyRegistry.notifyDisplayInfoChanged(0, INVALID_SUBSCRIPTION_ID, displayInfo);
@@ -1408,11 +1408,11 @@
TelephonyDisplayInfo displayInfo = new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_LTE,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED,
- false);
+ false, false, false);
TelephonyDisplayInfo expectDisplayInfo = new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_LTE,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE,
- false);
+ false, false, false);
TelephonyCallback telephonyCallback2 = new TelephonyCallbackWrapper() {
@Override
public void onDisplayInfoChanged(TelephonyDisplayInfo displayInfoNotify) {
@@ -1778,9 +1778,7 @@
int[] services = {3, 6};
mTelephonyRegistry.notifyCarrierRoamingNtnAvailableServicesChanged(subId, services);
processAllMessages();
- int[] carrierServices = mCarrierRoamingNtnAvailableServices.stream()
- .mapToInt(Integer::intValue).toArray();
- assertTrue(Arrays.equals(carrierServices, services));
+ assertTrue(Arrays.equals(mCarrierRoamingNtnAvailableServices, services));
}
@Test
diff --git a/tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java b/tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java
index 88eea32..0db881c 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java
@@ -811,7 +811,7 @@
doReturn(ServiceState.RIL_RADIO_TECHNOLOGY_LTE).when(mServiceState)
.getRilDataRadioTechnology();
doReturn(new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_LTE,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false))
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false, false, false))
.when(mDisplayInfoController).getTelephonyDisplayInfo();
doReturn(mPhone).when(mCT).getPhone();
doReturn(mImsEcbm).when(mImsManager).getEcbmInterface();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/AutoDataSwitchControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/AutoDataSwitchControllerTest.java
index 0e2676e..d3f3050 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/AutoDataSwitchControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/AutoDataSwitchControllerTest.java
@@ -101,9 +101,11 @@
public void setUp() throws Exception {
super.setUp(getClass().getSimpleName());
mGoodTelephonyDisplayInfo = new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_NR,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED, false /*roaming*/);
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED, false /*roaming*/,
+ false/*isNtn*/, false/*isSatelliteConstrainedDataStatus*/);
mBadTelephonyDisplayInfo = new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_UMTS,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false /*roaming*/);
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false /*roaming*/,
+ false/*isNtn*/, false/*isSatelliteConstrainedDataStatus*/);
mMockedPhoneSwitcherCallback =
mock(AutoDataSwitchController.AutoDataSwitchControllerCallback.class);
mMockedAlarmManager = mock(AlarmManager.class);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/DataConfigManagerTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/DataConfigManagerTest.java
index 95cefd8..88dce51 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/DataConfigManagerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/DataConfigManagerTest.java
@@ -126,20 +126,23 @@
doReturn(SignalStrength.SIGNAL_STRENGTH_POOR).when(signalStrength).getLevel();
assertThat(mDataConfigManagerUT.getAutoDataSwitchScore(new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_LTE,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED, false/*isRoaming*/),
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED, false/*isRoaming*/,
+ false/*isNtn*/, false/*isSatelliteConstrainedDataStatus*/),
signalStrength)).isEqualTo(10227);
// Verify if entry contains any invalid negative scores, should yield 0.
doReturn(SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN).when(signalStrength).getLevel();
assertThat(mDataConfigManagerUT.getAutoDataSwitchScore(new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_LTE,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false/*isRoaming*/),
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false/*isRoaming*/,
+ false/*isNtn*/, false/*isSatelliteConstrainedDataStatus*/),
signalStrength))
.isEqualTo(0/*OUT_OF_SERVICE_AUTO_DATA_SWITCH_SCORE*/);
// Verify non-existent entry should yield -1
doReturn(SignalStrength.SIGNAL_STRENGTH_POOR).when(signalStrength).getLevel();
assertThat(mDataConfigManagerUT.getAutoDataSwitchScore(new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_EDGE,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false/*isRoaming*/),
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false/*isRoaming*/,
+ false/*isNtn*/, false/*isSatelliteConstrainedDataStatus*/),
signalStrength))
.isEqualTo(0/*OUT_OF_SERVICE_AUTO_DATA_SWITCH_SCORE*/);
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java
index 4cc10d9..3f2d6f2 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java
@@ -2478,7 +2478,7 @@
// Change data network type to NR
doReturn(new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_NR,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false))
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false, false, false))
.when(mDisplayInfoController).getTelephonyDisplayInfo();
dataNetwork.sendMessage(13/*EVENT_DISPLAY_INFO_CHANGED*/);
processAllMessages();
@@ -2521,7 +2521,7 @@
// Change data network type to NR
doReturn(new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_NR,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false))
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false, false, false))
.when(mDisplayInfoController).getTelephonyDisplayInfo();
dataNetwork.sendMessage(13/*EVENT_DISPLAY_INFO_CHANGED*/);
processAllMessages();
@@ -2577,7 +2577,7 @@
// Change data network type to NR
doReturn(new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_NR,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false))
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false, false, false))
.when(mDisplayInfoController).getTelephonyDisplayInfo();
dataNetwork.sendMessage(13/*EVENT_DISPLAY_INFO_CHANGED*/);
processAllMessages();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/PhoneSwitcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/PhoneSwitcherTest.java
index f7990b9..6e41448 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/PhoneSwitcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/PhoneSwitcherTest.java
@@ -146,7 +146,7 @@
private AutoDataSwitchController.AutoDataSwitchControllerCallback mAutoDataSwitchCallback;
private TelephonyDisplayInfo mTelephonyDisplayInfo = new TelephonyDisplayInfo(
TelephonyManager.NETWORK_TYPE_NR,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false);
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, false, false, false);
private SubscriptionManagerServiceCallback mSubscriptionManagerServiceCallback;
@Before
diff --git a/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java b/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java
index 110dade..e6e4c30 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java
@@ -4370,94 +4370,95 @@
public void addSatelliteControllerStats_withExistingEntries() throws Exception {
createEmptyTestFile();
mPersistAtomsStorage = new TestablePersistAtomsStorage(mContext);
- mPersistAtomsStorage.addSatelliteControllerStats(mSatelliteController1);
- mPersistAtomsStorage.addSatelliteControllerStats(mSatelliteController2);
+ mPersistAtomsStorage.addSatelliteControllerStats(copyOf(mSatelliteController1));
+ mPersistAtomsStorage.addSatelliteControllerStats(copyOf(mSatelliteController1));
mPersistAtomsStorage.incTimeMillis(100L);
SatelliteController expected = new SatelliteController();
expected.countOfSatelliteServiceEnablementsSuccess =
- mSatelliteController1.countOfSatelliteServiceEnablementsSuccess
- + mSatelliteController2.countOfSatelliteServiceEnablementsSuccess;
+ mSatelliteController1.countOfSatelliteServiceEnablementsSuccess * 2;
expected.countOfSatelliteServiceEnablementsFail =
- mSatelliteController1.countOfSatelliteServiceEnablementsFail
- + mSatelliteController2.countOfSatelliteServiceEnablementsFail;
+ mSatelliteController1.countOfSatelliteServiceEnablementsFail * 2;
expected.countOfOutgoingDatagramSuccess =
- mSatelliteController1.countOfOutgoingDatagramSuccess
- + mSatelliteController2.countOfOutgoingDatagramSuccess;
+ mSatelliteController1.countOfOutgoingDatagramSuccess * 2;
expected.countOfOutgoingDatagramFail =
- mSatelliteController1.countOfOutgoingDatagramFail
- + mSatelliteController2.countOfOutgoingDatagramFail;
+ mSatelliteController1.countOfOutgoingDatagramFail * 2;
expected.countOfIncomingDatagramSuccess =
- mSatelliteController1.countOfIncomingDatagramSuccess
- + mSatelliteController2.countOfIncomingDatagramSuccess;
+ mSatelliteController1.countOfIncomingDatagramSuccess * 2;
expected.countOfIncomingDatagramFail =
- mSatelliteController1.countOfIncomingDatagramFail
- + mSatelliteController2.countOfIncomingDatagramFail;
+ mSatelliteController1.countOfIncomingDatagramFail * 2;
expected.countOfDatagramTypeSosSmsSuccess =
- mSatelliteController1.countOfDatagramTypeSosSmsSuccess
- + mSatelliteController2.countOfDatagramTypeSosSmsSuccess;
+ mSatelliteController1.countOfDatagramTypeSosSmsSuccess * 2;
expected.countOfDatagramTypeSosSmsFail =
- mSatelliteController1.countOfDatagramTypeSosSmsFail
- + mSatelliteController2.countOfDatagramTypeSosSmsFail;
+ mSatelliteController1.countOfDatagramTypeSosSmsFail * 2;
expected.countOfDatagramTypeLocationSharingSuccess =
- mSatelliteController1.countOfDatagramTypeLocationSharingSuccess
- + mSatelliteController2.countOfDatagramTypeLocationSharingSuccess;
+ mSatelliteController1.countOfDatagramTypeLocationSharingSuccess * 2;
expected.countOfDatagramTypeLocationSharingFail =
- mSatelliteController1.countOfDatagramTypeLocationSharingFail
- + mSatelliteController2.countOfDatagramTypeLocationSharingFail;
+ mSatelliteController1.countOfDatagramTypeLocationSharingFail * 2;
expected.countOfProvisionSuccess =
- mSatelliteController1.countOfProvisionSuccess
- + mSatelliteController2.countOfProvisionSuccess;
+ mSatelliteController1.countOfProvisionSuccess * 2;
expected.countOfProvisionFail =
- mSatelliteController1.countOfProvisionFail
- + mSatelliteController2.countOfProvisionFail;
+ mSatelliteController1.countOfProvisionFail * 2;
expected.countOfDeprovisionSuccess =
- mSatelliteController1.countOfDeprovisionSuccess
- + mSatelliteController2.countOfDeprovisionSuccess;
+ mSatelliteController1.countOfDeprovisionSuccess * 2;
expected.countOfDeprovisionFail =
- mSatelliteController1.countOfDeprovisionFail
- + mSatelliteController2.countOfDeprovisionFail;
+ mSatelliteController1.countOfDeprovisionFail * 2;
expected.totalServiceUptimeSec =
- mSatelliteController1.totalServiceUptimeSec
- + mSatelliteController2.totalServiceUptimeSec;
+ mSatelliteController1.totalServiceUptimeSec * 2;
expected.totalBatteryConsumptionPercent =
- mSatelliteController1.totalBatteryConsumptionPercent
- + mSatelliteController2.totalBatteryConsumptionPercent;
+ mSatelliteController1.totalBatteryConsumptionPercent * 2;
expected.totalBatteryChargedTimeSec =
- mSatelliteController1.totalBatteryChargedTimeSec
- + mSatelliteController2.totalBatteryChargedTimeSec;
+ mSatelliteController1.totalBatteryChargedTimeSec * 2;
expected.countOfDemoModeSatelliteServiceEnablementsSuccess =
- mSatelliteController1.countOfDemoModeSatelliteServiceEnablementsSuccess
- + mSatelliteController2.countOfDemoModeSatelliteServiceEnablementsSuccess;
+ mSatelliteController1.countOfDemoModeSatelliteServiceEnablementsSuccess * 2;
expected.countOfDemoModeSatelliteServiceEnablementsFail =
- mSatelliteController1.countOfDemoModeSatelliteServiceEnablementsFail
- + mSatelliteController2.countOfDemoModeSatelliteServiceEnablementsFail;
+ mSatelliteController1.countOfDemoModeSatelliteServiceEnablementsFail * 2;
expected.countOfDemoModeOutgoingDatagramSuccess =
- mSatelliteController1.countOfDemoModeOutgoingDatagramSuccess
- + mSatelliteController2.countOfDemoModeOutgoingDatagramSuccess;
+ mSatelliteController1.countOfDemoModeOutgoingDatagramSuccess * 2;
expected.countOfDemoModeOutgoingDatagramFail =
- mSatelliteController1.countOfDemoModeOutgoingDatagramFail
- + mSatelliteController2.countOfDemoModeOutgoingDatagramFail;
+ mSatelliteController1.countOfDemoModeOutgoingDatagramFail * 2;
expected.countOfDemoModeIncomingDatagramSuccess =
- mSatelliteController1.countOfDemoModeIncomingDatagramSuccess
- + mSatelliteController2.countOfDemoModeIncomingDatagramSuccess;
+ mSatelliteController1.countOfDemoModeIncomingDatagramSuccess * 2;
expected.countOfDemoModeIncomingDatagramFail =
- mSatelliteController1.countOfDemoModeIncomingDatagramFail
- + mSatelliteController2.countOfDemoModeIncomingDatagramFail;
+ mSatelliteController1.countOfDemoModeIncomingDatagramFail * 2;
expected.countOfDatagramTypeKeepAliveSuccess =
- mSatelliteController1.countOfDatagramTypeKeepAliveSuccess
- + mSatelliteController2.countOfDatagramTypeKeepAliveSuccess;
+ mSatelliteController1.countOfDatagramTypeKeepAliveSuccess * 2;
expected.countOfDatagramTypeKeepAliveFail =
- mSatelliteController1.countOfDatagramTypeKeepAliveFail
- + mSatelliteController2.countOfDatagramTypeKeepAliveFail;
- expected.isProvisioned = mSatelliteController2.isProvisioned;
- expected.carrierId = mSatelliteController2.carrierId;
+ mSatelliteController1.countOfDatagramTypeKeepAliveFail * 2;
+ expected.isProvisioned = mSatelliteController1.isProvisioned;
+ expected.carrierId = mSatelliteController1.carrierId;
+ expected.countOfSatelliteAllowedStateChangedEvents =
+ mSatelliteController1.countOfSatelliteAllowedStateChangedEvents * 2;
+ expected.countOfSuccessfulLocationQueries =
+ mSatelliteController1.countOfSuccessfulLocationQueries * 2;
+ expected.countOfFailedLocationQueries =
+ mSatelliteController1.countOfFailedLocationQueries * 2;
// Service state and service switch should be added successfully
verifyCurrentStateSavedToFileOnce();
SatelliteController[] output =
mPersistAtomsStorage.getSatelliteControllerStats(0L);
- assertHasStats(output, expected);
+ assertHasStats(output, expected, 1);
+ }
+
+ @Test
+ public void addSatelliteControllerStats_addNewCarrierId() throws Exception {
+ createEmptyTestFile();
+ mPersistAtomsStorage = new TestablePersistAtomsStorage(mContext);
+ mPersistAtomsStorage.addSatelliteControllerStats(mSatelliteController1);
+ mPersistAtomsStorage.addSatelliteControllerStats(mSatelliteController2);
+ mPersistAtomsStorage.incTimeMillis(100L);
+
+ SatelliteController expected1 = mSatelliteController1;
+ SatelliteController expected2 = mSatelliteController2;
+
+ // Service state and service switch should be added successfully
+ verifyCurrentStateSavedToFileOnce();
+ SatelliteController[] output =
+ mPersistAtomsStorage.getSatelliteControllerStats(0L);
+
+ assertHasStats(output, expected1, 1);
+ assertHasStats(output, expected2, 1);
}
@Test
@@ -5829,60 +5830,71 @@
assertEquals(expectedCount, actualCount);
}
- private static void assertHasStats(
- SatelliteController[] tested,
- @Nullable SatelliteController expectedStats) {
+ private static void assertHasStats(SatelliteController[] tested,
+ @Nullable SatelliteController expectedStats, int expectedCount) {
assertNotNull(tested);
- assertEquals(tested[0].countOfSatelliteServiceEnablementsSuccess,
- expectedStats.countOfSatelliteServiceEnablementsSuccess);
- assertEquals(tested[0].countOfSatelliteServiceEnablementsFail,
- expectedStats.countOfSatelliteServiceEnablementsFail);
- assertEquals(tested[0].countOfOutgoingDatagramSuccess,
- expectedStats.countOfOutgoingDatagramSuccess);
- assertEquals(tested[0].countOfOutgoingDatagramFail,
- expectedStats.countOfOutgoingDatagramFail);
- assertEquals(tested[0].countOfIncomingDatagramSuccess,
- expectedStats.countOfIncomingDatagramSuccess);
- assertEquals(tested[0].countOfIncomingDatagramFail,
- expectedStats.countOfIncomingDatagramFail);
- assertEquals(tested[0].countOfDatagramTypeSosSmsSuccess,
- expectedStats.countOfDatagramTypeSosSmsSuccess);
- assertEquals(tested[0].countOfDatagramTypeSosSmsFail,
- expectedStats.countOfDatagramTypeSosSmsFail);
- assertEquals(tested[0].countOfDatagramTypeLocationSharingSuccess,
- expectedStats.countOfDatagramTypeLocationSharingSuccess);
- assertEquals(tested[0].countOfDatagramTypeLocationSharingFail,
- expectedStats.countOfDatagramTypeLocationSharingFail);
- assertEquals(tested[0].totalServiceUptimeSec,
- expectedStats.totalServiceUptimeSec);
- assertEquals(tested[0].totalBatteryConsumptionPercent,
- expectedStats.totalBatteryConsumptionPercent);
- assertEquals(tested[0].totalBatteryChargedTimeSec,
- expectedStats.totalBatteryChargedTimeSec);
- assertEquals(tested[0].countOfDemoModeSatelliteServiceEnablementsSuccess,
- expectedStats.countOfDemoModeSatelliteServiceEnablementsSuccess);
- assertEquals(tested[0].countOfDemoModeSatelliteServiceEnablementsFail,
- expectedStats.countOfDemoModeSatelliteServiceEnablementsFail);
- assertEquals(tested[0].countOfDemoModeOutgoingDatagramSuccess,
- expectedStats.countOfDemoModeOutgoingDatagramSuccess);
- assertEquals(tested[0].countOfDemoModeOutgoingDatagramFail,
- expectedStats.countOfDemoModeOutgoingDatagramFail);
- assertEquals(tested[0].countOfDemoModeIncomingDatagramSuccess,
- expectedStats.countOfDemoModeIncomingDatagramSuccess);
- assertEquals(tested[0].countOfDemoModeIncomingDatagramFail,
- expectedStats.countOfDemoModeIncomingDatagramFail);
- assertEquals(tested[0].countOfDatagramTypeKeepAliveSuccess,
- expectedStats.countOfDatagramTypeKeepAliveSuccess);
- assertEquals(tested[0].countOfDatagramTypeKeepAliveFail,
- expectedStats.countOfDatagramTypeKeepAliveFail);
- assertEquals(tested[0].countOfAllowedSatelliteAccess,
- expectedStats.countOfAllowedSatelliteAccess);
- assertEquals(tested[0].countOfDisallowedSatelliteAccess,
- expectedStats.countOfDisallowedSatelliteAccess);
- assertEquals(tested[0].countOfSatelliteAccessCheckFail,
- expectedStats.countOfSatelliteAccessCheckFail);
- assertEquals(tested[0].isProvisioned, expectedStats.isProvisioned);
- assertEquals(tested[0].carrierId, expectedStats.carrierId);
+ int actualCount = 0;
+ int i = 0;
+ for (SatelliteController stats : tested) {
+ if (expectedStats.carrierId == stats.carrierId) {
+ assertEquals(expectedStats.countOfSatelliteServiceEnablementsSuccess,
+ stats.countOfSatelliteServiceEnablementsSuccess);
+ assertEquals(expectedStats.countOfSatelliteServiceEnablementsFail,
+ stats.countOfSatelliteServiceEnablementsFail);
+ assertEquals(expectedStats.countOfOutgoingDatagramSuccess,
+ stats.countOfOutgoingDatagramSuccess);
+ assertEquals(expectedStats.countOfOutgoingDatagramFail,
+ stats.countOfOutgoingDatagramFail);
+ assertEquals(expectedStats.countOfIncomingDatagramSuccess,
+ stats.countOfIncomingDatagramSuccess);
+ assertEquals(expectedStats.countOfIncomingDatagramFail,
+ stats.countOfIncomingDatagramFail);
+ assertEquals(expectedStats.countOfDatagramTypeSosSmsSuccess,
+ stats.countOfDatagramTypeSosSmsSuccess);
+ assertEquals(expectedStats.countOfDatagramTypeSosSmsFail,
+ stats.countOfDatagramTypeSosSmsFail);
+ assertEquals(expectedStats.countOfDatagramTypeLocationSharingSuccess,
+ stats.countOfDatagramTypeLocationSharingSuccess);
+ assertEquals(expectedStats.countOfDatagramTypeLocationSharingFail,
+ stats.countOfDatagramTypeLocationSharingFail);
+ assertEquals(expectedStats.totalServiceUptimeSec, stats.totalServiceUptimeSec);
+ assertEquals(expectedStats.totalBatteryConsumptionPercent,
+ stats.totalBatteryConsumptionPercent);
+ assertEquals(expectedStats.totalBatteryChargedTimeSec,
+ stats.totalBatteryChargedTimeSec);
+ assertEquals(expectedStats.countOfDemoModeSatelliteServiceEnablementsSuccess,
+ stats.countOfDemoModeSatelliteServiceEnablementsSuccess);
+ assertEquals(expectedStats.countOfDemoModeSatelliteServiceEnablementsFail,
+ stats.countOfDemoModeSatelliteServiceEnablementsFail);
+ assertEquals(expectedStats.countOfDemoModeOutgoingDatagramSuccess,
+ stats.countOfDemoModeOutgoingDatagramSuccess);
+ assertEquals(expectedStats.countOfDemoModeOutgoingDatagramFail,
+ stats.countOfDemoModeOutgoingDatagramFail);
+ assertEquals(expectedStats.countOfDemoModeIncomingDatagramSuccess,
+ stats.countOfDemoModeIncomingDatagramSuccess);
+ assertEquals(expectedStats.countOfDemoModeIncomingDatagramFail,
+ stats.countOfDemoModeIncomingDatagramFail);
+ assertEquals(expectedStats.countOfDatagramTypeKeepAliveSuccess,
+ stats.countOfDatagramTypeKeepAliveSuccess);
+ assertEquals(expectedStats.countOfDatagramTypeKeepAliveFail,
+ stats.countOfDatagramTypeKeepAliveFail);
+ assertEquals(expectedStats.countOfAllowedSatelliteAccess,
+ stats.countOfAllowedSatelliteAccess);
+ assertEquals(expectedStats.countOfDisallowedSatelliteAccess,
+ stats.countOfDisallowedSatelliteAccess);
+ assertEquals(expectedStats.countOfSatelliteAccessCheckFail,
+ stats.countOfSatelliteAccessCheckFail);
+ assertEquals(expectedStats.isProvisioned, stats.isProvisioned);
+ assertEquals(expectedStats.countOfSatelliteAllowedStateChangedEvents,
+ stats.countOfSatelliteAllowedStateChangedEvents);
+ assertEquals(expectedStats.countOfSuccessfulLocationQueries,
+ stats.countOfSuccessfulLocationQueries);
+ assertEquals(expectedStats.countOfFailedLocationQueries,
+ stats.countOfFailedLocationQueries);
+ actualCount++;
+ }
+ }
+ assertEquals(expectedCount, actualCount);
}
private static void assertHasStatsAndCount(
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramControllerTest.java
index 21731f0..271e0ad 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramControllerTest.java
@@ -16,10 +16,12 @@
package com.android.internal.telephony.satellite;
+import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_KEEP_ALIVE;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_LAST_SOS_MESSAGE_NO_HELP_NEEDED;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_LAST_SOS_MESSAGE_STILL_NEED_HELP;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_LOCATION_SHARING;
+import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_SMS;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_UNKNOWN;
import static android.telephony.satellite.SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE;
@@ -44,6 +46,7 @@
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
+import com.android.internal.R;
import com.android.internal.telephony.TelephonyTest;
import org.junit.After;
@@ -187,6 +190,76 @@
}
}
+ @Test
+ public void testNeedsWaitingForSatelliteConnected_checkMessageInNotConnected_returnsFalse()
+ throws Exception {
+ when(mMockSatelliteController.isSatelliteAttachRequired()).thenReturn(true);
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_allow_check_message_in_not_connected, true);
+ mDatagramControllerUT.onSatelliteModemStateChanged(
+ SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED);
+
+ boolean result =
+ mDatagramControllerUT.needsWaitingForSatelliteConnected(
+ DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS);
+
+ assertFalse(result);
+ }
+
+ @Test
+ public void testNeedsWaitingForSatelliteConnected_regularSmsInNotConnected_returnsTrue()
+ throws Exception {
+ when(mMockSatelliteController.isSatelliteAttachRequired()).thenReturn(true);
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_allow_check_message_in_not_connected, true);
+ mDatagramControllerUT.onSatelliteModemStateChanged(
+ SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED);
+
+ boolean result =
+ mDatagramControllerUT.needsWaitingForSatelliteConnected(
+ DATAGRAM_TYPE_SMS);
+
+ assertTrue(result);
+ }
+
+ @Test
+ public void
+ testNeedsWaitingForSatelliteConnected_checkMessageInNotConnected_allowCheckMessageFalse_returnsTrue()
+ throws Exception {
+ when(mMockSatelliteController.isSatelliteAttachRequired()).thenReturn(true);
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_allow_check_message_in_not_connected, false);
+ mDatagramControllerUT.onSatelliteModemStateChanged(
+ SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED);
+
+ boolean result =
+ mDatagramControllerUT.needsWaitingForSatelliteConnected(
+ DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS);
+
+ assertTrue(result);
+ }
+
+ @Test
+ public void
+ testNeedsWaitingForSatelliteConnected_checkMessageInNotConnected_carrierRoamingNbIotNtnFalse_returnsTrue()
+ throws Exception {
+ when(mMockSatelliteController.isSatelliteAttachRequired()).thenReturn(true);
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(false);
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_allow_check_message_in_not_connected, true);
+ mDatagramControllerUT.onSatelliteModemStateChanged(
+ SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED);
+
+ boolean result =
+ mDatagramControllerUT.needsWaitingForSatelliteConnected(
+ DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS);
+
+ assertTrue(result);
+ }
+
private void testUpdateSendStatus(boolean isDemoMode, int datagramType, int sendState) {
mDatagramControllerUT.setDemoMode(isDemoMode);
clearAllInvocations();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
index d964d88..dc973af 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
@@ -31,6 +31,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doAnswer;
@@ -257,7 +258,7 @@
eq(SATELLITE_RESULT_SUCCESS));
verifyNoMoreInteractions(mMockDatagramController);
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(datagramType));
+ .addCountOfSuccessfulOutgoingDatagram(eq(datagramType), anyLong());
verify(mMockSatelliteModemInterface, times(1)).sendSatelliteDatagram(
any(SatelliteDatagram.class), anyBoolean(), anyBoolean(), any(Message.class));
assertFalse(mDatagramDispatcherUT.isDatagramWaitForConnectedStateTimerStarted());
@@ -398,7 +399,7 @@
any(SatelliteDatagram.class), anyBoolean(), anyBoolean(), any(Message.class));
assertThat(mResultListener.peek()).isEqualTo(SATELLITE_RESULT_SUCCESS);
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(anyInt());
+ .addCountOfSuccessfulOutgoingDatagram(anyInt(), anyLong());
clearInvocations(mMockSatelliteModemInterface);
clearInvocations(mMockDatagramController);
clearInvocations(mMockSessionMetricsStats);
@@ -523,7 +524,7 @@
eq(SATELLITE_RESULT_SUCCESS));
assertThat(mResultListener.peek()).isEqualTo(SATELLITE_RESULT_SUCCESS);
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(datagramType));
+ .addCountOfSuccessfulOutgoingDatagram(eq(datagramType), anyLong());
mDatagramDispatcherUT.setDemoMode(false);
mDatagramDispatcherUT.setDeviceAlignedWithSatellite(false);
}
@@ -618,7 +619,7 @@
eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE), eq(0),
eq(SATELLITE_RESULT_SUCCESS));
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(DATAGRAM_TYPE2));
+ .addCountOfSuccessfulOutgoingDatagram(eq(DATAGRAM_TYPE2), anyLong());
mDatagramDispatcherUT.setDemoMode(false);
mDatagramDispatcherUT.setDeviceAlignedWithSatellite(false);
@@ -731,7 +732,7 @@
anyInt(), any(SatelliteDatagram.class));
verify(mMockDatagramController).pollPendingSatelliteDatagrams(anyInt(), any());
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(anyInt());
+ .addCountOfSuccessfulOutgoingDatagram(anyInt(), anyLong());
// Test when overlay config config_send_satellite_datagram_to_modem_in_demo_mode is
// false
@@ -1041,7 +1042,7 @@
eq(1),
eq(SATELLITE_RESULT_SUCCESS));
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(datagramTypeSos));
+ .addCountOfSuccessfulOutgoingDatagram(eq(datagramTypeSos), anyLong());
verify(mMockSatelliteModemInterface, times(1)).sendSatelliteDatagram(
any(SatelliteDatagram.class), anyBoolean(), anyBoolean(), any(Message.class));
assertFalse(mDatagramDispatcherUT.isDatagramWaitForConnectedStateTimerStarted());
@@ -1133,7 +1134,7 @@
eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE), eq(0),
eq(SATELLITE_RESULT_SUCCESS));
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(datagramTypeSos));
+ .addCountOfSuccessfulOutgoingDatagram(eq(datagramTypeSos), anyLong());
verify(mMockSatelliteModemInterface, times(1)).sendSatelliteDatagram(
any(SatelliteDatagram.class), anyBoolean(), anyBoolean(), any(Message.class));
assertFalse(mDatagramDispatcherUT.isDatagramWaitForConnectedStateTimerStarted());
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 933ed6a..6f716b5 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
@@ -22,6 +22,7 @@
import static android.hardware.devicestate.DeviceState.PROPERTY_FOLDABLE_HARDWARE_CONFIGURATION_FOLD_IN_OPEN;
import static android.hardware.devicestate.feature.flags.Flags.FLAG_DEVICE_STATE_PROPERTY_MIGRATION;
import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC;
+import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_MANUAL;
import static android.telephony.CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT;
import static android.telephony.CarrierConfigManager.KEY_CARRIER_SUPPORTED_SATELLITE_NOTIFICATION_HYSTERESIS_SEC_INT;
@@ -32,7 +33,12 @@
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_NIDD_APN_NAME_STRING;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ROAMING_P2P_SMS_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ROAMING_TURN_OFF_SESSION_FOR_EMERGENCY_CALL_BOOL;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_ALL;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_ONLY_RESTRICTED;
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_VOICE;
import static android.telephony.SubscriptionManager.SATELLITE_ENTITLEMENT_STATUS;
import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_GOOD;
import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_GREAT;
@@ -81,6 +87,8 @@
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS;
import static com.android.internal.telephony.satellite.SatelliteController.DEFAULT_CARRIER_EMERGENCY_CALL_WAIT_FOR_CONNECTION_TIMEOUT_MILLIS;
+import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_DATA_PLAN_METERED;
+import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_DATA_PLAN_UNMETERED;
import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_MODE_ENABLED_FALSE;
import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_MODE_ENABLED_TRUE;
@@ -218,7 +226,6 @@
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
-import java.util.stream.IntStream;
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@@ -3166,7 +3173,8 @@
// Verify call the requestSetSatelliteEnabledForCarrier to enable the satellite when
// satellite service is enabled by entitlement server.
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, true, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -3186,7 +3194,8 @@
.when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -3217,7 +3226,8 @@
List<String> entitlementPlmnList = new ArrayList<>();
List<String> barredPlmnList = new ArrayList<>();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3275,7 +3285,8 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", ""}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3283,7 +3294,8 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "123456789"}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3291,7 +3303,8 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "12"}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3299,7 +3312,8 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "1234"}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
}
@@ -3308,7 +3322,8 @@
List<String> mergedPlmnList, List<String> overlayConfigPlmnList,
List<String> barredPlmnList) {
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
List<String> plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(
SUB_ID);
@@ -3530,21 +3545,24 @@
// Change SUB_ID's EntitlementStatus to true
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, true, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), 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<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), 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<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), mIIntegerConsumer);
assertEquals(false, satelliteEnabledPerCarrier.get(SUB_ID));
assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID1));
@@ -3687,6 +3705,7 @@
// Do nothing when the satellite is not connected
doReturn(false).when(mServiceState).isUsingNonTerrestrialNetwork();
sendServiceStateChangedEvent();
+ setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS);
processAllMessages();
assertFalse(mSharedPreferences.getBoolean(SATELLITE_SYSTEM_NOTIFICATION_DONE_KEY, false));
verify(mMockNotificationManager, never()).notifyAsUser(anyString(), anyInt(), any(), any());
@@ -4271,8 +4290,10 @@
when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE);
when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE);
mSatelliteControllerUT.mIsApplicationSupportsP2P = true;
+ mSatelliteControllerUT.setIsSatelliteSupported(true);
mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true);
- mCarrierConfigBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, 1);
+ mCarrierConfigBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT,
+ CARRIER_ROAMING_NTN_CONNECT_MANUAL);
mCarrierConfigBundle.putInt(
KEY_CARRIER_SUPPORTED_SATELLITE_NOTIFICATION_HYSTERESIS_SEC_INT, 1 * 60);
mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ROAMING_P2P_SMS_SUPPORTED_BOOL, true);
@@ -4294,6 +4315,7 @@
}
mSatelliteControllerUT.setSatellitePhone(1);
mSatelliteControllerUT.isSatelliteAllowedCallback = null;
+ setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS);
processAllMessages();
mSatelliteControllerUT.elapsedRealtime = 0;
assertTrue(mSatelliteControllerUT.isCarrierRoamingNtnEligible(mPhone));
@@ -4721,7 +4743,7 @@
any());
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertTrue(resultArray[0].getProvisionStatus());
+ assertTrue(resultArray[0].isProvisioned());
assertEquals(mSubscriberId, resultArray[0].getSatelliteSubscriberInfo().getSubscriberId());
// Request provisioning with SatelliteSubscriberInfo that has not been provisioned
@@ -4732,7 +4754,7 @@
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertTrue(resultArray[1].getProvisionStatus());
+ assertTrue(resultArray[1].isProvisioned());
assertEquals(mSubscriberId2, resultArray[1].getSatelliteSubscriberInfo().getSubscriberId());
// Request provisioning with the same SatelliteSubscriberInfo that was previously
@@ -4747,9 +4769,9 @@
verifyDeprovisionSatellite(inputList);
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertFalse(resultArray[1].getProvisionStatus());
+ assertFalse(resultArray[1].isProvisioned());
assertEquals(mSubscriberId2, resultArray[1].getSatelliteSubscriberInfo().getSubscriberId());
- assertTrue(resultArray[0].getProvisionStatus());
+ assertTrue(resultArray[0].isProvisioned());
assertEquals(mSubscriberId, resultArray[0].getSatelliteSubscriberInfo().getSubscriberId());
// Request deprovision for subscriberID 1, verify that subscriberID 1 is set to deprovision.
@@ -4758,9 +4780,9 @@
verifyDeprovisionSatellite(inputList);
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertFalse(resultArray[1].getProvisionStatus());
+ assertFalse(resultArray[1].isProvisioned());
assertEquals(mSubscriberId2, resultArray[1].getSatelliteSubscriberInfo().getSubscriberId());
- assertFalse(resultArray[0].getProvisionStatus());
+ assertFalse(resultArray[0].isProvisioned());
assertEquals(mSubscriberId, resultArray[0].getSatelliteSubscriberInfo().getSubscriberId());
// Request provision for subscriberID 2, verify that subscriberID 2 is set to provision.
@@ -4770,9 +4792,9 @@
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertTrue(resultArray[1].getProvisionStatus());
+ assertTrue(resultArray[1].isProvisioned());
assertEquals(mSubscriberId2, resultArray[1].getSatelliteSubscriberInfo().getSubscriberId());
- assertFalse(resultArray[0].getProvisionStatus());
+ assertFalse(resultArray[0].isProvisioned());
assertEquals(mSubscriberId, resultArray[0].getSatelliteSubscriberInfo().getSubscriberId());
}
@@ -5198,18 +5220,13 @@
SystemSelectionSpecifier systemSelectionSpecifier = capturedList.getFirst();
assertEquals(mccmnc, systemSelectionSpecifier.getMccMnc());
- int[] actualBandsArray = IntStream.range(0, systemSelectionSpecifier.getBands().size()).map(
- systemSelectionSpecifier.getBands()::get).toArray();
+ int[] actualBandsArray = systemSelectionSpecifier.getBands();
assertArrayEquals(bands1, actualBandsArray);
- int[] actualEarfcnsArray = IntStream.range(0,
- systemSelectionSpecifier.getEarfcns().size()).map(
- systemSelectionSpecifier.getEarfcns()::get).toArray();
+ int[] actualEarfcnsArray = systemSelectionSpecifier.getEarfcns();
assertArrayEquals(earfcns1, actualEarfcnsArray);
assertArrayEquals(new SatelliteInfo[]{satelliteInfo1},
- systemSelectionSpecifier.getSatelliteInfos());
- int[] actualTagIdArray = IntStream.range(0,
- systemSelectionSpecifier.getTagIds().size()).map(
- systemSelectionSpecifier.getTagIds()::get).toArray();
+ systemSelectionSpecifier.getSatelliteInfos().toArray(new SatelliteInfo[0]));
+ int[] actualTagIdArray = systemSelectionSpecifier.getTagIds();
assertArrayEquals(tagIds, actualTagIdArray);
// Verify whether SatelliteModemInterface API was invoked and data is valid, when list
@@ -5251,36 +5268,26 @@
// Verify first SystemSelectionSpecifier
assertEquals(mccmnc, systemSelectionSpecifier.getMccMnc());
- actualBandsArray = IntStream.range(0,
- capturedSystemSelectionSpecifier1.getBands().size()).map(
- capturedSystemSelectionSpecifier1.getBands()::get).toArray();
+ actualBandsArray = capturedSystemSelectionSpecifier1.getBands();
assertArrayEquals(bands1, actualBandsArray);
- actualEarfcnsArray = IntStream.range(0,
- capturedSystemSelectionSpecifier1.getEarfcns().size()).map(
- capturedSystemSelectionSpecifier1.getEarfcns()::get).toArray();
+ actualEarfcnsArray = capturedSystemSelectionSpecifier1.getEarfcns();
assertArrayEquals(earfcns1, actualEarfcnsArray);
assertArrayEquals(new SatelliteInfo[]{satelliteInfo1},
- capturedSystemSelectionSpecifier1.getSatelliteInfos());
- actualTagIdArray = IntStream.range(0,
- capturedSystemSelectionSpecifier1.getTagIds().size()).map(
- capturedSystemSelectionSpecifier1.getTagIds()::get).toArray();
+ capturedSystemSelectionSpecifier1.getSatelliteInfos().toArray(
+ new SatelliteInfo[0]));
+ actualTagIdArray = capturedSystemSelectionSpecifier1.getTagIds();
assertArrayEquals(tagIds, actualTagIdArray);
// Verify second SystemSelectionSpecifier
assertEquals(mccmnc, systemSelectionSpecifier.getMccMnc());
- actualBandsArray = IntStream.range(0,
- capturedSystemSelectionSpecifier2.getBands().size()).map(
- capturedSystemSelectionSpecifier2.getBands()::get).toArray();
+ actualBandsArray = capturedSystemSelectionSpecifier2.getBands();
assertArrayEquals(bands2, actualBandsArray);
- actualEarfcnsArray = IntStream.range(0,
- capturedSystemSelectionSpecifier2.getEarfcns().size()).map(
- capturedSystemSelectionSpecifier2.getEarfcns()::get).toArray();
+ actualEarfcnsArray = capturedSystemSelectionSpecifier2.getEarfcns();
assertArrayEquals(earfcns2, actualEarfcnsArray);
assertArrayEquals(new SatelliteInfo[]{satelliteInfo2},
- capturedSystemSelectionSpecifier2.getSatelliteInfos());
- actualTagIdArray = IntStream.range(0,
- capturedSystemSelectionSpecifier2.getTagIds().size()).map(
- capturedSystemSelectionSpecifier2.getTagIds()::get).toArray();
+ capturedSystemSelectionSpecifier2.getSatelliteInfos().toArray(
+ new SatelliteInfo[0]));
+ actualTagIdArray = capturedSystemSelectionSpecifier2.getTagIds();
assertArrayEquals(tagIds, actualTagIdArray);
}
@@ -5304,7 +5311,7 @@
assertEquals(SATELLITE_RESULT_SUCCESS,
mRequestSatelliteSubscriberProvisionStatusResultCode);
assertEquals(provision,
- mRequestSatelliteSubscriberProvisionStatusResultList.get(0).getProvisionStatus());
+ mRequestSatelliteSubscriberProvisionStatusResultList.get(0).isProvisioned());
}
private void setComponentName() {
@@ -6212,6 +6219,12 @@
}
}
+ void setIsSatelliteSupported(@Nullable Boolean isSatelliteSupported) {
+ synchronized (mIsSatelliteSupportedLock) {
+ mIsSatelliteSupported = isSatelliteSupported;
+ }
+ }
+
public boolean isRadioOn() {
synchronized (mIsRadioOnLock) {
return mIsRadioOn;
@@ -6270,14 +6283,14 @@
final String callerSC = "SC:ResultReceiver";
final String callerSAC = "SAC:ResultReceiver";
- doReturn(false).when(mFeatureFlags).geofenceEnhancementForBetterUx();
+ doReturn(false).when(mFeatureFlags).carrierRoamingNbIotNtn();
mSatelliteControllerUT.incrementResultReceiverCount(callerSC);
assertEquals(0, mSatelliteControllerUT.getResultReceiverTotalCount());
mSatelliteControllerUT.decrementResultReceiverCount(callerSC);
assertEquals(0, mSatelliteControllerUT.getResultReceiverTotalCount());
- doReturn(true).when(mFeatureFlags).geofenceEnhancementForBetterUx();
+ doReturn(true).when(mFeatureFlags).carrierRoamingNbIotNtn();
mSatelliteControllerUT.incrementResultReceiverCount(callerSC);
assertEquals(1, mSatelliteControllerUT.getResultReceiverTotalCount());
@@ -6352,4 +6365,226 @@
return isProvisioned != null ? isProvisioned : false;
}
}
+
+ @Test
+ public void testGetSatelliteDataPlanForPlmn_WithEntitlement() throws Exception {
+ logd("testGetSatelliteDataPlanForPlmn_WithEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataPlanListMap = Map.of(
+ "00101", SATELLITE_DATA_PLAN_METERED,
+ "00103", SATELLITE_DATA_PLAN_UNMETERED);
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, dataPlanListMap, new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
+
+ int dataPlanForPlmn;
+ dataPlanForPlmn = mSatelliteControllerUT.getSatelliteDataPlanForPlmn(SUB_ID, "00101");
+ assertEquals(SATELLITE_DATA_PLAN_METERED, dataPlanForPlmn);
+
+ dataPlanForPlmn = mSatelliteControllerUT.getSatelliteDataPlanForPlmn(SUB_ID, "00103");
+ assertEquals(SATELLITE_DATA_PLAN_UNMETERED, dataPlanForPlmn);
+ }
+
+ @Test
+ public void testGetSatelliteDataPlanForPlmn_WithoutEntitlement() throws Exception {
+ logd("testGetSatelliteDataPlanForPlmn_WithoutEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataPlanListMap = new HashMap<>();
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, dataPlanListMap, new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
+
+ int dataPlanForPlmn = mSatelliteControllerUT.getSatelliteDataPlanForPlmn(SUB_ID, "00101");
+ assertEquals(SATELLITE_DATA_PLAN_METERED, dataPlanForPlmn);
+ }
+
+ @Test
+ public void TestGetSupportedSatelliteServicesForPlmn_WithEntitlement() throws Exception {
+ logd("TestGetSupportedSatelliteServicesForPlmn_WithEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, List<Integer>> serviceTypeListMap = Map.of(
+ "00101", List.of(SERVICE_TYPE_DATA, SERVICE_TYPE_SMS),
+ "00102", List.of(SERVICE_TYPE_VOICE, SERVICE_TYPE_SMS),
+ "00103", List.of(SERVICE_TYPE_DATA, SERVICE_TYPE_VOICE, SERVICE_TYPE_SMS));
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), serviceTypeListMap,
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
+
+ List<Integer> allowedServiceForPlmn;
+ allowedServiceForPlmn = mSatelliteControllerUT
+ .getSupportedSatelliteServicesForPlmn(SUB_ID, "00101");
+ assertEquals(List.of(SERVICE_TYPE_DATA, SERVICE_TYPE_SMS), allowedServiceForPlmn);
+
+ allowedServiceForPlmn = mSatelliteControllerUT
+ .getSupportedSatelliteServicesForPlmn(SUB_ID, "00102");
+ assertEquals(List.of(SERVICE_TYPE_VOICE, SERVICE_TYPE_SMS), allowedServiceForPlmn);
+
+ allowedServiceForPlmn = mSatelliteControllerUT
+ .getSupportedSatelliteServicesForPlmn(SUB_ID, "00103");
+ assertEquals(List.of(SERVICE_TYPE_DATA, SERVICE_TYPE_VOICE, SERVICE_TYPE_SMS),
+ allowedServiceForPlmn);
+ }
+
+ @Test
+ public void TestGetSupportedSatelliteServicesForPlmn_WithoutEntitlement() throws Exception {
+ logd("TestGetSupportedSatelliteServicesForPlmn_WithoutAllowedServices");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataPlanListMap = new HashMap<>();
+ Map<String, List<Integer>> allowedServiceListMap = new HashMap<>();
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, dataPlanListMap, allowedServiceListMap,
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
+
+ // Verify whether the carrier config plmn list is returned with conditions below
+ // the config data plmn list : empty
+ // the carrier config plmn list : exist with services {{2}}
+ setConfigData(new ArrayList<>());
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+ PersistableBundle carrierSupportedSatelliteServicesPerProvider =
+ new PersistableBundle();
+ List<String> carrierConfigPlmnList = List.of("00101");
+ carrierSupportedSatelliteServicesPerProvider.putIntArray(
+ carrierConfigPlmnList.get(0), new int[]{2});
+ mCarrierConfigBundle.putPersistableBundle(CarrierConfigManager
+ .KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE,
+ carrierSupportedSatelliteServicesPerProvider);
+ invokeCarrierConfigChanged();
+
+ List<Integer> servicesPerPlmn;
+ servicesPerPlmn = mSatelliteControllerUT.getSupportedSatelliteServicesForPlmn(
+ SUB_ID, "00101");
+ assertEquals(Arrays.asList(2).stream().sorted().toList(),
+ servicesPerPlmn.stream().sorted().toList());
+ }
+
+ @Test
+ public void testGetSupportedSatelliteDataModeForPlmn_WithEntitlement() throws Exception {
+ logd("testGetSupportedSatelliteDataModeForPlmn_WithEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataServicePolicyMap = Map.of(
+ "00101", SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED,
+ "00102", SATELLITE_DATA_SUPPORT_ALL
+ );
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ dataServicePolicyMap, new HashMap<>(), mIIntegerConsumer);
+
+ int dataSupportModeForPlmn;
+ dataSupportModeForPlmn = mSatelliteControllerUT
+ .getSatelliteDataServicePolicyForPlmn(SUB_ID, "00101");
+ assertEquals(SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED, dataSupportModeForPlmn);
+
+ dataSupportModeForPlmn = mSatelliteControllerUT
+ .getSatelliteDataServicePolicyForPlmn(SUB_ID, "00102");
+ assertEquals(SATELLITE_DATA_SUPPORT_ALL, dataSupportModeForPlmn);
+
+ }
+
+ @Test
+ public void testGetSupportedSatelliteDataModeForPlmn_WithoutEntitlement() throws Exception {
+ logd("testGetSupportedSatelliteDataModeForPlmn_WithoutEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataServicePolicyMap = new HashMap<>();
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ dataServicePolicyMap, new HashMap<>(), mIIntegerConsumer);
+
+ mCarrierConfigBundle.putInt(
+ CarrierConfigManager.KEY_SATELLITE_DATA_SUPPORT_MODE_INT,
+ SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED);
+ int dataSupportModeForPlmn = mSatelliteControllerUT
+ .getSatelliteDataServicePolicyForPlmn(SUB_ID, "00101");
+ assertEquals(SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED, dataSupportModeForPlmn);
+ }
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
index 56d5731..529088b 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
@@ -373,6 +373,7 @@
@Test
public void testSatelliteProvisionStateChangedBeforeTimeout() {
+ mTestSatelliteController.setSatelliteConnectedViaCarrierWithinHysteresisTime(false);
mTestSOSMessageRecommender.onEmergencyCallStarted(mTestConnection, false);
processAllMessages();
@@ -393,6 +394,7 @@
assertFalse(mTestSOSMessageRecommender.isDialerNotified());
reset(mMockSatelliteStats);
+ mTestSatelliteController.setSatelliteConnectedViaCarrierWithinHysteresisTime(true);
mTestSOSMessageRecommender.onEmergencyCallStarted(mTestConnection, false);
processAllMessages();
assertTrue(mTestSOSMessageRecommender.isTimerStarted());
@@ -983,6 +985,8 @@
private ComponentName mSmsAppComponent = new ComponentName(
DEFAULT_SATELLITE_MESSAGING_PACKAGE, DEFAULT_SATELLITE_MESSAGING_CLASS);
private boolean mIsDialerNotified;
+ private boolean mProvisionState = true;
+ private boolean mSatelliteAllowedByReasons = true;
/**
* Create an instance of SatelliteSOSMessageRecommender.
@@ -1017,6 +1021,16 @@
mIsDialerNotified = isDialerNotified;
}
+ @Override
+ protected boolean updateAndGetProvisionState() {
+ return mProvisionState;
+ }
+
+ @Override
+ protected boolean isSatelliteAllowedByReasons() {
+ return mSatelliteAllowedByReasons;
+ }
+
public boolean isTimerStarted() {
return hasMessages(EVENT_TIME_OUT);
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSessionControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSessionControllerTest.java
index 8c1ae50..0d11fed 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSessionControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSessionControllerTest.java
@@ -150,7 +150,9 @@
when(resources.getBoolean(
R.bool.config_satellite_modem_support_concurrent_tn_scanning))
.thenReturn(false);
-
+ when(resources.getBoolean(
+ R.bool.config_satellite_allow_tn_scanning_during_satellite_session))
+ .thenReturn(true);
when(mFeatureFlags.satellitePersistentLogging()).thenReturn(true);
when(mMockSatelliteController.isSatelliteAttachRequired()).thenReturn(false);
when(mMockSatelliteController.isSatelliteRoamingP2pSmSSupported(