Skip lost mobile data notification when connected to satellite network
that does not support data.
Bug: 371462111
Test: Manually tested notification is skipped on VZW/NTN -b/371462111#comment12
Test: Manually tested SMS/MMS/CALLS/DATA
FLAG: EXEMPT bugfix
Change-Id: I1473c783325aecac8e38b1d2498cc289815b13c1
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 0433a33..ddd0d09 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -44,6 +44,7 @@
import android.telecom.TelecomManager;
import android.telephony.AnomalyReporter;
import android.telephony.CarrierConfigManager;
+import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -373,12 +374,16 @@
break;
case EVENT_DATA_ROAMING_DISCONNECTED:
+ Log.d(LOG_TAG, "EVENT_DATA_ROAMING_DISCONNECTED");
if (SubscriptionManagerService.getInstance()
.isEsimBootStrapProvisioningActiveForSubId(msg.arg1)) {
Log.i(LOG_TAG,
"skip notification/warnings during esim bootstrap activation");
+ } else if (skipDataRoamingDisconnectedNotificationInSatelliteMode((msg.arg1))) {
+ Log.i(LOG_TAG, "skip data roaming disconnected notification when device is "
+ + "connected to satellite network that does not support data.");
} else {
- notificationMgr.showDataRoamingNotification(msg.arg1, false);
+ notificationMgr.showDataRoamingNotification((msg.arg1), false);
}
break;
@@ -1495,4 +1500,32 @@
}
pw.println("------- End PhoneGlobals -------");
}
+
+ private boolean skipDataRoamingDisconnectedNotificationInSatelliteMode(int subId) {
+ SatelliteController satelliteController = SatelliteController.getInstance();
+ if (satelliteController.isSatelliteEnabledOrBeingEnabled()) {
+ Log.d(LOG_TAG, "skipDataRoamingDisconnected - skip notification as "
+ + "satellite is enabled or being enabled");
+ return true;
+ }
+
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ Phone phone = PhoneFactory.getPhone(phoneId);
+ ServiceState serviceState = phone.getServiceState();
+ if (serviceState != null && serviceState.isUsingNonTerrestrialNetwork()) {
+ Log.d(LOG_TAG, "skipDataRoamingDisconnected - isUsingNtn");
+ List<Integer> capabilities =
+ satelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(phone);
+ if (!capabilities.contains(NetworkRegistrationInfo.SERVICE_TYPE_DATA)) {
+ // Skip data roaming disconnected notification as device is connected to
+ // non-terrestrial network that does not support data.
+ Log.d(LOG_TAG, "skipDataRoamingDisconnected - skip notification as "
+ + "NTN does not support data");
+ return true;
+ }
+ }
+
+ Log.d(LOG_TAG, "skipDataRoamingDisconnected - do not skip notification.");
+ return false;
+ }
}