Merge "Fixed to deliver result to DatagramDispatcher properly for single part SMS." into main
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/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/SatelliteController.java b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
index b32535c..c6383a6 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
@@ -436,9 +436,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 +577,9 @@
* 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<>();
private static AtomicLong sNextSatelliteEnableRequestId = new AtomicLong(0);
// key : subscriberId, value : provisioned or not.
@GuardedBy("mSatelliteTokenProvisionedLock")
@@ -657,6 +660,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 +738,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 +758,7 @@
}
}
} else {
- logd("[incrementResultReceiverCount]: geofenceEnhancementForBetterUx is not enabled");
+ logd("[incrementResultReceiverCount]: carrierRoamingNbIotNtn is not enabled");
}
}
@@ -757,7 +770,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 +781,7 @@
(k, v) -> v > 0 ? v - 1 : v);
}
} else {
- logd("[decrementResultReceiverCount]: geofenceEnhancementForBetterUx is not enabled");
+ logd("[decrementResultReceiverCount]: carrierRoamingNbIotNtn is not enabled");
}
}
@@ -4196,6 +4209,7 @@
*/
public void onSatelliteEntitlementStatusUpdated(int subId, boolean entitlementEnabled,
@Nullable List<String> allowedPlmnList, @Nullable List<String> barredPlmnList,
+ @Nullable Map<String,Integer> plmnDataPlanMap,
@Nullable IIntegerConsumer callback) {
if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
logd("onSatelliteEntitlementStatusUpdated: carrierEnabledSatelliteFlag is not enabled");
@@ -4216,6 +4230,9 @@
if (barredPlmnList == null) {
barredPlmnList = new ArrayList<>();
}
+ if (plmnDataPlanMap == null) {
+ plmnDataPlanMap = new HashMap<>();
+ }
logd("onSatelliteEntitlementStatusUpdated subId=" + subId + ", entitlementEnabled="
+ entitlementEnabled + ", allowedPlmnList=["
+ String.join(",", allowedPlmnList) + "]" + ", barredPlmnList=["
@@ -4244,6 +4261,7 @@
mMergedPlmnListPerCarrier.remove(subId);
mEntitlementPlmnListPerCarrier.put(subId, allowedPlmnList);
mEntitlementBarredPlmnListPerCarrier.put(subId, barredPlmnList);
+ mEntitlementDataPlanMapPerCarrier.put(subId, plmnDataPlanMap);
updatePlmnListPerCarrier(subId);
configureSatellitePlmnForCarrier(subId);
mSubscriptionManagerService.setSatelliteEntitlementPlmnList(subId, allowedPlmnList);
@@ -4771,6 +4789,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()) {
@@ -5477,7 +5500,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 +5578,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);
}
@@ -6468,6 +6491,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 +6521,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;
}
@@ -7202,7 +7240,7 @@
+ ", provisioned=" + provisioned);
list.add(new SatelliteSubscriberProvisionStatus.Builder()
.setSatelliteSubscriberInfo(satelliteSubscriberInfo)
- .setProvisionStatus(provisioned).build());
+ .setProvisioned(provisioned).build());
mSubscriberIdPerSub.put(subscriberId, info.getSubscriptionId());
}
}
@@ -7258,7 +7296,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;
}
@@ -8093,8 +8131,7 @@
NTN_SIGNAL_STRENGTH_NONE);
if (isInCarrierRoamingNbIotNtn(phone)) {
- if (mSatelliteSessionController != null
- && mSatelliteSessionController.isInConnectedState()) {
+ if (isInConnectedState()) {
synchronized (mNtnSignalsStrengthLock) {
carrierRoamingNtnSignalStrength = mNtnSignalStrength;
}
@@ -8114,6 +8151,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;
@@ -8239,4 +8290,28 @@
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;
+ }
}
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java b/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
index 182f667..6937b74 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;
@@ -262,6 +265,26 @@
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);
+ List<Integer> disallowedReasons = satelliteManager.getSatelliteDisallowedReasons();
+ if (disallowedReasons.stream().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=" + disallowedReasons);
+ return false;
+ }
+ return true;
+ }
+
private void handleEmergencyCallStartedEvent(@NonNull Connection connection) {
plogd("handleEmergencyCallStartedEvent: connection=" + connection);
mSatelliteController.setLastEmergencyCallTime();
@@ -310,6 +333,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 +346,7 @@
boolean isCellularAvailable = SatelliteServiceUtils.isCellularAvailable();
if (!isCellularAvailable
&& isSatelliteAllowed()
- && (isDeviceProvisioned()
+ && ((isDeviceProvisioned() && isSatelliteAllowedByReasons())
|| isSatelliteConnectedViaCarrierWithinHysteresisTime())
&& shouldTrackCall(mEmergencyConnection.getState())) {
plogd("handleTimeoutEvent: Sent EVENT_DISPLAY_EMERGENCY_MESSAGE to Dialer");
@@ -737,7 +762,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 7aaf936..b55c622 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java
@@ -553,10 +553,10 @@
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++) {
@@ -591,8 +591,7 @@
}
}
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 9ea0012..b2861d3 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
@@ -585,29 +585,6 @@
}
/**
- * Get whether device is connected to satellite.
- *
- * @return {@code true} if device is connected to satellite else return {@code false}.
- */
- public boolean isInConnectedState() {
- if (DBG) plogd("isInConnectedState: getCurrentState=" + getCurrentState());
- if (getCurrentState() == null) {
- return false;
- }
-
- switch (getCurrentState().getName()) {
- case "ConnectedState":
- case "TransferringState":
- return true;
- case "IdleState":
- return isConcurrentTnScanningSupported();
- default:
- return false;
- }
- }
-
-
- /**
* Release all resource.
*/
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
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/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java b/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
index 5dc4719..f934371 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
@@ -138,7 +138,7 @@
private long mCallbackModeDurationMillis;
private boolean mCarrierRoamingNtnMode;
private boolean mCarrierRoamingNtnEligible;
- private List<Integer> mCarrierRoamingNtnAvailableServices;
+ private int[] mCarrierRoamingNtnAvailableServices;
private NtnSignalStrength mCarrierRoamingNtnSignalStrength;
private boolean mIsSatelliteEnabled;
@@ -354,7 +354,7 @@
}
@Override
- public void onCarrierRoamingNtnAvailableServicesChanged(List<Integer> services) {
+ public void onCarrierRoamingNtnAvailableServicesChanged(int[] services) {
invocationCount.incrementAndGet();
mCarrierRoamingNtnAvailableServices = services;
}
@@ -1768,9 +1768,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/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..3ccd17e 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;
@@ -81,6 +82,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 +221,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 +3168,7 @@
// 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<>(), mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -3186,7 +3188,7 @@
.when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -3217,7 +3219,7 @@
List<String> entitlementPlmnList = new ArrayList<>();
List<String> barredPlmnList = new ArrayList<>();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3275,7 +3277,7 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", ""}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3283,7 +3285,7 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "123456789"}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3291,7 +3293,7 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "12"}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3299,7 +3301,7 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "1234"}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
}
@@ -3308,7 +3310,7 @@
List<String> mergedPlmnList, List<String> overlayConfigPlmnList,
List<String> barredPlmnList) {
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), mIIntegerConsumer);
List<String> plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(
SUB_ID);
@@ -3530,21 +3532,21 @@
// Change SUB_ID's EntitlementStatus to true
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, true, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), 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<>(), 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<>(), mIIntegerConsumer);
assertEquals(false, satelliteEnabledPerCarrier.get(SUB_ID));
assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID1));
@@ -3687,6 +3689,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 +4274,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 +4299,7 @@
}
mSatelliteControllerUT.setSatellitePhone(1);
mSatelliteControllerUT.isSatelliteAllowedCallback = null;
+ setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS);
processAllMessages();
mSatelliteControllerUT.elapsedRealtime = 0;
assertTrue(mSatelliteControllerUT.isCarrierRoamingNtnEligible(mPhone));
@@ -4721,7 +4727,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 +4738,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 +4753,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 +4764,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 +4776,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 +5204,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 +5252,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 +5295,7 @@
assertEquals(SATELLITE_RESULT_SUCCESS,
mRequestSatelliteSubscriberProvisionStatusResultCode);
assertEquals(provision,
- mRequestSatelliteSubscriberProvisionStatusResultList.get(0).getProvisionStatus());
+ mRequestSatelliteSubscriberProvisionStatusResultList.get(0).isProvisioned());
}
private void setComponentName() {
@@ -6212,6 +6203,12 @@
}
}
+ void setIsSatelliteSupported(@Nullable Boolean isSatelliteSupported) {
+ synchronized (mIsSatelliteSupportedLock) {
+ mIsSatelliteSupported = isSatelliteSupported;
+ }
+ }
+
public boolean isRadioOn() {
synchronized (mIsRadioOnLock) {
return mIsRadioOn;
@@ -6270,14 +6267,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 +6349,64 @@
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, 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, mIIntegerConsumer);
+
+ int dataPlanForPlmn = mSatelliteControllerUT.getSatelliteDataPlanForPlmn(SUB_ID, "00101");
+ assertEquals(SATELLITE_DATA_PLAN_METERED, dataPlanForPlmn);
+ }
}
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..46847aa 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
@@ -983,6 +983,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 +1019,16 @@
mIsDialerNotified = isDialerNotified;
}
+ @Override
+ protected boolean updateAndGetProvisionState() {
+ return mProvisionState;
+ }
+
+ @Override
+ protected boolean isSatelliteAllowedByReasons() {
+ return mSatelliteAllowedByReasons;
+ }
+
public boolean isTimerStarted() {
return hasMessages(EVENT_TIME_OUT);
}