Merge "Update the mCurrentSatelliteAllowedState on the locationMngr disabled." into main
diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml
index 3e45f96..c0beb0e 100644
--- a/res/values-ko/strings.xml
+++ b/res/values-ko/strings.xml
@@ -867,7 +867,7 @@
<string name="radio_info_ims_reg_status" msgid="25582845222446390">"IMS 등록: <xliff:g id="STATUS">%1$s</xliff:g>\nVoLTE: <xliff:g id="AVAILABILITY_0">%2$s</xliff:g>\nVoWi-Fi: <xliff:g id="AVAILABILITY_1">%3$s</xliff:g>\n화상 통화: <xliff:g id="AVAILABILITY_2">%4$s</xliff:g>\nUT 인터페이스: <xliff:g id="AVAILABILITY_3">%5$s</xliff:g>"</string>
<string name="radioInfo_service_in" msgid="45753418231446400">"서비스 중"</string>
<string name="radioInfo_service_out" msgid="287972405416142312">"서비스 지역 벗어남"</string>
- <string name="radioInfo_service_emergency" msgid="4763879891415016848">"긴급 통화만 허용"</string>
+ <string name="radioInfo_service_emergency" msgid="4763879891415016848">"긴급 전화만 허용"</string>
<string name="radioInfo_service_off" msgid="3456583511226783064">"무선 연결 끊김"</string>
<string name="radioInfo_roaming_in" msgid="3156335577793145965">"로밍"</string>
<string name="radioInfo_roaming_not" msgid="1904547918725478110">"로밍 안함"</string>
diff --git a/res/values-ne/strings.xml b/res/values-ne/strings.xml
index ab677d5..095bf9c 100644
--- a/res/values-ne/strings.xml
+++ b/res/values-ne/strings.xml
@@ -83,7 +83,7 @@
<string name="make_and_receive_calls" msgid="4868913166494621109">"कल गर्नुहोस् र प्राप्त गर्नुहोस्"</string>
<string name="smart_forwarding_settings_menu" msgid="8850429887958938540">"स्मार्ट तरिकाले फर्वार्ड गर्ने सुविधा"</string>
<string name="smart_forwarding_settings_menu_summary" msgid="5096947726032885325">"एउटा नम्बर सम्पर्क क्षेत्रबाहिर भएका बेला कल सधैँ आफ्नो अर्को नम्बरमा फर्वार्ड गर्नुहोस्"</string>
- <string name="voicemail_notifications_preference_title" msgid="7829238858063382977">"सूचनाहरू"</string>
+ <string name="voicemail_notifications_preference_title" msgid="7829238858063382977">"नोटिफिकेसनहरू"</string>
<string name="cell_broadcast_settings" msgid="8135324242541809924">"आपत्कालीन प्रसारणहरू"</string>
<string name="call_settings" msgid="3677282690157603818">"कल सेटिङहरू"</string>
<string name="additional_gsm_call_settings" msgid="1561980168685658846">"अतिरिक्त सेटिङहरू"</string>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index d20aa6d..8385490 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -303,7 +303,7 @@
<string name="data_usage_template" msgid="6287906680674061783">"<xliff:g id="ID_2">%2$s</xliff:g>期間使用了 <xliff:g id="ID_1">%1$s</xliff:g> 的行動數據"</string>
<string name="advanced_options_title" msgid="9208195294513520934">"進階"</string>
<string name="carrier_settings_euicc" msgid="1190237227261337749">"電信業者"</string>
- <string name="keywords_carrier_settings_euicc" msgid="8540160967922063745">"電信業者, eSIM 卡, SIM 卡, eUICC, 切換電信業者, 新增電信業者"</string>
+ <string name="keywords_carrier_settings_euicc" msgid="8540160967922063745">"電信業者, eSIM, SIM 卡, eUICC, 切換電信業者, 新增電信業者"</string>
<string name="carrier_settings_euicc_summary" msgid="2027941166597330117">"<xliff:g id="CARRIER_NAME">%1$s</xliff:g> - <xliff:g id="PHONE_NUMBER">%2$s</xliff:g>"</string>
<string name="mobile_data_settings_title" msgid="7228249980933944101">"行動數據"</string>
<string name="mobile_data_settings_summary" msgid="5012570152029118471">"使用行動網路存取數據"</string>
@@ -843,7 +843,7 @@
<string name="dsds_dialog_message" msgid="4047480385678538850">"你必須重新啟動裝置,才能變更這項設定。"</string>
<string name="dsds_dialog_confirm" msgid="9032004888134129885">"重新啟動"</string>
<string name="dsds_dialog_cancel" msgid="3245958947099586655">"取消"</string>
- <string name="removable_esim_string" msgid="7931369811671787649">"將可移除的 eSIM 卡設為預設 eSIM 卡"</string>
+ <string name="removable_esim_string" msgid="7931369811671787649">"將可移除的 eSIM 設為預設 eSIM"</string>
<string name="radio_info_radio_power" msgid="8805595022160471587">"行動無線電電源"</string>
<string name="simulate_out_of_service_string" msgid="7787925611727597193">"模擬無法使用服務的情況 (僅限偵錯版本)"</string>
<string name="enforce_satellite_channel_string" msgid="295306734591329892">"強制執行 Camp 衛星 LTE 頻道 (僅限偵錯版本)"</string>
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 5f3fc97..1242fec 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -141,6 +141,9 @@
@NonNull private boolean[] mHasSentConfigChange;
// Whether the broadcast was sent from EVENT_SYSTEM_UNLOCKED, to track rebroadcasts
@NonNull private boolean[] mFromSystemUnlocked;
+ // Whether this carrier config loading needs to trigger
+ // TelephonyRegistryManager.notifyCarrierConfigChanged
+ @NonNull private boolean[] mNeedNotifyCallback;
// CarrierService change monitoring
@NonNull private CarrierServiceChangeCallback[] mCarrierServiceChangeCallbacks;
@@ -257,6 +260,7 @@
}
switch (msg.what) {
case EVENT_CLEAR_CONFIG: {
+ mNeedNotifyCallback[phoneId] = true;
clearConfigForPhone(phoneId, true);
break;
}
@@ -268,8 +272,10 @@
// trying to load the carrier config when the SIM is still loading when the
// unlock happens.
if (mHasSentConfigChange[i]) {
- logdWithLocalLog("System unlocked");
+ logl("System unlocked");
mFromSystemUnlocked[i] = true;
+ // Do not add mNeedNotifyCallback[phoneId] = true here. We intentionally
+ // do not want to notify callback when system unlock happens.
updateConfigForPhoneId(i);
}
}
@@ -281,8 +287,9 @@
// Always clear up the cache and re-load config from scratch since the carrier
// service change is reliable and specific to the phoneId now.
clearCachedConfigForPackage(carrierPackageName);
- logdWithLocalLog("Package changed: " + carrierPackageName
+ logl("Package changed: " + carrierPackageName
+ ", phone=" + phoneId);
+ mNeedNotifyCallback[phoneId] = true;
updateConfigForPhoneId(phoneId);
break;
}
@@ -375,7 +382,7 @@
ICarrierService carrierService =
ICarrierService.Stub.asInterface(conn.service);
carrierService.getCarrierConfig(phoneId, carrierId, resultReceiver);
- logdWithLocalLog("Fetch config for default app: "
+ logl("Fetch config for default app: "
+ mPlatformCarrierConfigPackage
+ ", carrierId=" + carrierId.getSpecificCarrierId());
} catch (RemoteException e) {
@@ -494,7 +501,7 @@
if (config != null) {
mConfigFromCarrierApp[phoneId] = config;
} else {
- logdWithLocalLog("Config from carrier app is null "
+ logl("Config from carrier app is null "
+ "for phoneId " + phoneId);
// Put a stub bundle in place so that the rest of the logic
// continues smoothly.
@@ -510,7 +517,7 @@
ICarrierService carrierService =
ICarrierService.Stub.asInterface(conn.service);
carrierService.getCarrierConfig(phoneId, carrierId, resultReceiver);
- logdWithLocalLog("Fetch config for carrier app: "
+ logl("Fetch config for carrier app: "
+ getCarrierPackageForPhoneId(phoneId)
+ ", carrierId=" + carrierId.getSpecificCarrierId());
} catch (RemoteException e) {
@@ -676,7 +683,7 @@
ICarrierService carrierService =
ICarrierService.Stub.asInterface(conn.service);
carrierService.getCarrierConfig(phoneId, null, resultReceiver);
- logdWithLocalLog("Fetch no sim config from default app: "
+ logl("Fetch no sim config from default app: "
+ mPlatformCarrierConfigPackage);
} catch (RemoteException e) {
loge("Failed to get no sim carrier config from default app: " +
@@ -728,6 +735,7 @@
mServiceBound = new boolean[mNumPhones];
mHasSentConfigChange = new boolean[mNumPhones];
mFromSystemUnlocked = new boolean[mNumPhones];
+ mNeedNotifyCallback = new boolean[mNumPhones];
mServiceConnectionForNoSimConfig = new CarrierServiceConnection[mNumPhones];
mServiceBoundForNoSimConfig = new boolean[mNumPhones];
mCarrierServiceChangeCallbacks = new CarrierServiceChangeCallback[mNumPhones];
@@ -866,16 +874,21 @@
TelephonyRegistryManager trm = mContext.getSystemService(TelephonyRegistryManager.class);
// Unlike broadcast, we wouldn't notify registrants on carrier config change when device is
// unlocked. Only real carrier config change will send the notification to registrants.
- if (trm != null && !mFromSystemUnlocked[phoneId]) {
+ if (trm != null && (mFeatureFlags.carrierConfigChangedCallbackFix()
+ ? mNeedNotifyCallback[phoneId] : !mFromSystemUnlocked[phoneId])) {
+ logl("Notify carrier config changed callback for phone " + phoneId);
trm.notifyCarrierConfigChanged(phoneId, subId, carrierId, specificCarrierId);
+ mNeedNotifyCallback[phoneId] = false;
+ } else {
+ logl("Skipped notifying carrier config changed callback for phone " + phoneId);
}
mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
if (SubscriptionManager.isValidSubscriptionId(subId)) {
- logd("Broadcast CARRIER_CONFIG_CHANGED for phone " + phoneId + ", subId=" + subId);
+ logl("Broadcast CARRIER_CONFIG_CHANGED for phone " + phoneId + ", subId=" + subId);
} else {
- logd("Broadcast CARRIER_CONFIG_CHANGED for phone " + phoneId);
+ logl("Broadcast CARRIER_CONFIG_CHANGED for phone " + phoneId);
}
mHasSentConfigChange[phoneId] = true;
mFromSystemUnlocked[phoneId] = false;
@@ -896,7 +909,7 @@
/** Binds to the default or carrier config app. */
private boolean bindToConfigPackage(@NonNull String pkgName, int phoneId, int eventId) {
- logdWithLocalLog("Binding to " + pkgName + " for phone " + phoneId);
+ logl("Binding to " + pkgName + " for phone " + phoneId);
Intent carrierService = new Intent(CarrierService.CARRIER_SERVICE_INTERFACE);
carrierService.setPackage(pkgName);
CarrierServiceConnection serviceConnection = new CarrierServiceConnection(
@@ -1071,7 +1084,7 @@
return;
}
- logdWithLocalLog("Save carrier config to cache. phoneId=" + phoneId
+ logl("Save carrier config to cache. phoneId=" + phoneId
+ ", xml=" + getFilePathForLogging(fileName) + ", version=" + version);
FileOutputStream outFile = null;
@@ -1175,7 +1188,7 @@
}
if (restoredBundle != null) {
- logdWithLocalLog("Restored carrier config from cache. phoneId=" + phoneId + ", xml="
+ logl("Restored carrier config from cache. phoneId=" + phoneId + ", xml="
+ getFilePathForLogging(fileName) + ", version=" + savedVersion
+ ", modified time=" + getFileTime(filePath));
}
@@ -1232,7 +1245,7 @@
});
if (packageFiles == null || packageFiles.length < 1) return false;
for (File f : packageFiles) {
- logdWithLocalLog("Deleting " + getFilePathForLogging(f.getName()));
+ logl("Deleting " + getFilePathForLogging(f.getName()));
f.delete();
}
return true;
@@ -1299,7 +1312,7 @@
if (mNumPhones == oldNumPhones) {
return;
}
- logdWithLocalLog("mNumPhones change from " + oldNumPhones + " to " + mNumPhones);
+ logl("mNumPhones change from " + oldNumPhones + " to " + mNumPhones);
// If DS -> SS switch, release the resources BEFORE truncating the arrays to avoid leaking
for (int phoneId = mNumPhones; phoneId < oldNumPhones; phoneId++) {
@@ -1332,10 +1345,12 @@
mServiceBoundForNoSimConfig = Arrays.copyOf(mServiceBoundForNoSimConfig, mNumPhones);
mHasSentConfigChange = Arrays.copyOf(mHasSentConfigChange, mNumPhones);
mFromSystemUnlocked = Arrays.copyOf(mFromSystemUnlocked, mNumPhones);
+ mNeedNotifyCallback = Arrays.copyOf(mNeedNotifyCallback, mNumPhones);
mCarrierServiceChangeCallbacks = Arrays.copyOf(mCarrierServiceChangeCallbacks, mNumPhones);
// Load the config for all the phones and re-register callback AFTER padding the arrays.
for (int phoneId = 0; phoneId < mNumPhones; phoneId++) {
+ mNeedNotifyCallback[phoneId] = true;
updateConfigForPhoneId(phoneId);
mCarrierServiceChangeCallbacks[phoneId] = new CarrierServiceChangeCallback(phoneId);
TelephonyManager.from(mContext).registerCarrierPrivilegesCallback(phoneId,
@@ -1464,6 +1479,7 @@
// Post to run on handler thread on which all states should be confined.
mHandler.post(() -> {
+ mNeedNotifyCallback[phoneId] = true;
overrideConfig(mOverrideConfigs, phoneId, overrides);
if (persistent) {
@@ -1483,7 +1499,7 @@
fileToDelete.delete();
}
}
- logdWithLocalLog("overrideConfig: subId=" + subscriptionId + ", persistent="
+ logl("overrideConfig: subId=" + subscriptionId + ", persistent="
+ persistent + ", overrides=" + overrides);
updateSubscriptionDatabase(phoneId);
});
@@ -1520,7 +1536,7 @@
enforceTelephonyFeatureWithException(getCurrentPackageName(),
"notifyConfigChangedForSubId");
- logdWithLocalLog("Notified carrier config changed. phoneId=" + phoneId
+ logl("Notified carrier config changed. phoneId=" + phoneId
+ ", subId=" + subscriptionId);
// This method should block until deleting has completed, so that an error which prevents us
@@ -1529,6 +1545,7 @@
String callingPackageName = mContext.getPackageManager().getNameForUid(
Binder.getCallingUid());
clearCachedConfigForPackage(callingPackageName);
+ mNeedNotifyCallback[phoneId] = true;
updateConfigForPhoneId(phoneId);
}
@@ -1536,7 +1553,7 @@
@Override
public void updateConfigForPhoneId(int phoneId, @NonNull String simState) {
updateConfigForPhoneId_enforcePermission();
- logdWithLocalLog("Update config for phoneId=" + phoneId + " simState=" + simState);
+ logl("Update config for phoneId=" + phoneId + " simState=" + simState);
if (!SubscriptionManager.isValidPhoneId(phoneId)) {
throw new IllegalArgumentException("Invalid phoneId: " + phoneId);
}
@@ -1554,6 +1571,7 @@
break;
case IccCardConstants.INTENT_VALUE_ICC_LOADED:
case IccCardConstants.INTENT_VALUE_ICC_LOCKED:
+ mNeedNotifyCallback[phoneId] = true;
updateConfigForPhoneId(phoneId);
break;
}
@@ -1703,6 +1721,7 @@
+ Arrays.toString(mServiceBoundForNoSimConfig));
indentPW.println("mHasSentConfigChange=" + Arrays.toString(mHasSentConfigChange));
indentPW.println("mFromSystemUnlocked=" + Arrays.toString(mFromSystemUnlocked));
+ indentPW.println("mNeedNotifyCallback=" + Arrays.toString(mNeedNotifyCallback));
indentPW.println();
indentPW.println("CarrierConfigLoader local log=");
indentPW.increaseIndent();
@@ -2067,7 +2086,7 @@
Log.d(LOG_TAG, msg, tr);
}
- private void logdWithLocalLog(@NonNull String msg) {
+ private void logl(@NonNull String msg) {
Log.d(LOG_TAG, msg);
mCarrierConfigLoadingLog.log(msg);
}
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 1139850..4fe2d24 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -843,11 +843,6 @@
* @param subId The subscription ID
*/
void updateNetworkSelection(int serviceState, int subId) {
- if (!mFeatureFlags.dismissNetworkSelectionNotificationOnSimDisable()) {
- updateNetworkSelectionForFeatureDisabled(serviceState, subId);
- return;
- }
-
// for dismissNetworkSelectionNotificationOnSimDisable feature enabled.
int phoneId = SubscriptionManager.getPhoneId(subId);
Phone phone = SubscriptionManager.isValidPhoneId(phoneId) ?
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 17d3392..68773f1 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -17,7 +17,6 @@
package com.android.phone;
import android.annotation.IntDef;
-import android.annotation.Nullable;
import android.app.Activity;
import android.app.KeyguardManager;
import android.app.ProgressDialog;
@@ -443,19 +442,11 @@
//TODO: handle message here;
break;
case EVENT_DATA_ROAMING_SETTINGS_CHANGED:
- if (mFeatureFlags.reorganizeRoamingNotification()) {
- updateDataRoamingStatus(
- ROAMING_NOTIFICATION_REASON_DATA_ROAMING_SETTING_CHANGED);
- } else {
- updateDataRoamingStatusForFeatureDisabled(null);
- }
+ updateDataRoamingStatus(
+ ROAMING_NOTIFICATION_REASON_DATA_ROAMING_SETTING_CHANGED);
break;
case EVENT_MOBILE_DATA_SETTINGS_CHANGED:
- if (mFeatureFlags.reorganizeRoamingNotification()) {
- updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_DATA_SETTING_CHANGED);
- } else {
- updateDataRoamingStatusForFeatureDisabled(null);
- }
+ updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_DATA_SETTING_CHANGED);
break;
case EVENT_CARRIER_CONFIG_CHANGED:
int subId = (Integer) msg.obj;
@@ -896,11 +887,7 @@
/** Clear fields on power off radio **/
private void clearCacheOnRadioOff() {
// Re-show is-roaming notifications after APM mode
- if (mFeatureFlags.reorganizeRoamingNotification()) {
- mShownNotificationReasons.clear();
- } else {
- mPrevRoamingOperatorNumerics.clear();
- }
+ mShownNotificationReasons.clear();
}
private void setRadioPowerOn() {
@@ -997,11 +984,7 @@
} else if (action.equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
// Roaming status could be overridden by carrier config, so we need to update it.
if (VDBG) Log.v(LOG_TAG, "carrier config changed.");
- if (mFeatureFlags.reorganizeRoamingNotification()) {
- updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_CARRIER_CONFIG_CHANGED);
- } else {
- updateDataRoamingStatusForFeatureDisabled(null);
- }
+ updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_CARRIER_CONFIG_CHANGED);
updateLimitedSimFunctionForDualSim();
int subId = intent.getIntExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
@@ -1016,12 +999,8 @@
registerSettingsObserver();
Phone phone = getPhone(mDefaultDataSubId);
if (phone != null) {
- if (mFeatureFlags.reorganizeRoamingNotification()) {
- updateDataRoamingStatus(
- ROAMING_NOTIFICATION_REASON_DEFAULT_DATA_SUBS_CHANGED);
- } else {
- updateDataRoamingStatusForFeatureDisabled(null);
- }
+ updateDataRoamingStatus(
+ ROAMING_NOTIFICATION_REASON_DEFAULT_DATA_SUBS_CHANGED);
}
}
}
@@ -1037,11 +1016,7 @@
+ mDefaultDataSubId + ", ss roaming=" + serviceState.getDataRoaming());
}
if (subId == mDefaultDataSubId) {
- if (mFeatureFlags.reorganizeRoamingNotification()) {
- updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_SERVICE_STATE_CHANGED);
- } else {
- updateDataRoamingStatusForFeatureDisabled(serviceState.getOperatorNumeric());
- }
+ updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_SERVICE_STATE_CHANGED);
}
}
@@ -1067,26 +1042,24 @@
List<DataDisallowedReason> disallowReasons = phone.getDataNetworkController()
.getInternetDataDisallowedReasons();
- if (mFeatureFlags.roamingNotificationForSingleDataNetwork()) {
- if (disallowReasons.contains(DataDisallowedReason.ONLY_ALLOWED_SINGLE_NETWORK)
- && disallowReasons.contains(DataDisallowedReason.ROAMING_DISABLED)
- && (notificationReason == ROAMING_NOTIFICATION_REASON_DATA_SETTING_CHANGED
- || notificationReason
- == ROAMING_NOTIFICATION_REASON_DATA_ROAMING_SETTING_CHANGED)) {
- // If the ONLY_ALLOWED_SINGLE_NETWORK disallow reason has not yet been removed due
- // to a change in mobile_data (including roaming_data) settings, update roaming
- // notification again after the Internet is completely disconnected to check
- // ONLY_ALLOWED_SINGLE_NETWORK disallow reason is removed.
- mWaitForInternetDisconnection.set(true);
- Log.d(LOG_TAG, "updateDataRoamingStatus,"
- + " wait for internet disconnection for single data network");
- } else if (!disallowReasons.contains(DataDisallowedReason.ONLY_ALLOWED_SINGLE_NETWORK)
- && mWaitForInternetDisconnection.compareAndSet(true, false)) {
- // If the ONLY_ALLOWED_SINGLE_NETWORK disallow reason has been removed,
- // no longer wait for Internet disconnection.
- Log.d(LOG_TAG, "updateDataRoamingStatus,"
- + " cancel to wait for internet disconnection for single data network");
- }
+ if (disallowReasons.contains(DataDisallowedReason.ONLY_ALLOWED_SINGLE_NETWORK)
+ && disallowReasons.contains(DataDisallowedReason.ROAMING_DISABLED)
+ && (notificationReason == ROAMING_NOTIFICATION_REASON_DATA_SETTING_CHANGED
+ || notificationReason
+ == ROAMING_NOTIFICATION_REASON_DATA_ROAMING_SETTING_CHANGED)) {
+ // If the ONLY_ALLOWED_SINGLE_NETWORK disallow reason has not yet been removed due
+ // to a change in mobile_data (including roaming_data) settings, update roaming
+ // notification again after the Internet is completely disconnected to check
+ // ONLY_ALLOWED_SINGLE_NETWORK disallow reason is removed.
+ mWaitForInternetDisconnection.set(true);
+ Log.d(LOG_TAG, "updateDataRoamingStatus,"
+ + " wait for internet disconnection for single data network");
+ } else if (!disallowReasons.contains(DataDisallowedReason.ONLY_ALLOWED_SINGLE_NETWORK)
+ && mWaitForInternetDisconnection.compareAndSet(true, false)) {
+ // If the ONLY_ALLOWED_SINGLE_NETWORK disallow reason has been removed,
+ // no longer wait for Internet disconnection.
+ Log.d(LOG_TAG, "updateDataRoamingStatus,"
+ + " cancel to wait for internet disconnection for single data network");
}
updateDataRoamingStatus(notificationReason, disallowReasons, serviceState);
@@ -1229,88 +1202,6 @@
return mCurrentRoamingNotification;
}
- // For reorganize_roaming_notification feature disabled.
- /**
- * When roaming, if mobile data cannot be established due to data roaming not enabled, we need
- * to notify the user so they can enable it through settings. Vise versa if the condition
- * changes, we need to dismiss the notification.
- * @param roamingOperatorNumeric The operator numeric for the current roaming. {@code null} if
- * the current roaming operator numeric didn't change.
- */
- private void updateDataRoamingStatusForFeatureDisabled(
- @Nullable String roamingOperatorNumeric) {
- if (VDBG) Log.v(LOG_TAG, "updateDataRoamingStatusForFeatureDisabled");
- Phone phone = getPhone(mDefaultDataSubId);
- if (phone == null) {
- Log.w(LOG_TAG, "Can't get phone with sub id = " + mDefaultDataSubId);
- return;
- }
-
- boolean dataAllowed;
- boolean notAllowedDueToRoamingOff;
- List<DataDisallowedReason> reasons = phone.getDataNetworkController()
- .getInternetDataDisallowedReasons();
- dataAllowed = reasons.isEmpty();
- notAllowedDueToRoamingOff = (reasons.size() == 1
- && reasons.contains(DataDisallowedReason.ROAMING_DISABLED));
- mDataRoamingNotifLog.log("dataAllowed=" + dataAllowed + ", reasons=" + reasons
- + ", roamingOperatorNumeric=" + roamingOperatorNumeric);
- if (VDBG) {
- Log.v(LOG_TAG, "dataAllowed=" + dataAllowed + ", reasons=" + reasons
- + ", roamingOperatorNumeric=" + roamingOperatorNumeric);
- }
-
- if (!dataAllowed && notAllowedDueToRoamingOff) {
- // Don't show roaming notification if we've already shown for this MccMnc
- if (roamingOperatorNumeric != null
- && !mPrevRoamingOperatorNumerics.add(roamingOperatorNumeric)) {
- Log.d(LOG_TAG, "Skip roaming disconnected notification since already shown in "
- + "MccMnc " + roamingOperatorNumeric);
- return;
- }
- // No need to show it again if we never cancelled it explicitly.
- if (mPrevRoamingNotification == ROAMING_NOTIFICATION_DISCONNECTED) return;
- // If the only reason of no data is data roaming disabled, then we notify the user
- // so the user can turn on data roaming.
- mPrevRoamingNotification = ROAMING_NOTIFICATION_DISCONNECTED;
- Log.d(LOG_TAG, "Show roaming disconnected notification");
- mDataRoamingNotifLog.log("Show roaming off.");
- Message msg = mHandler.obtainMessage(EVENT_DATA_ROAMING_DISCONNECTED);
- msg.arg1 = mDefaultDataSubId;
- msg.sendToTarget();
- } else if (dataAllowed && dataIsNowRoaming(mDefaultDataSubId)) {
- if (!shouldShowRoamingNotification(roamingOperatorNumeric != null
- ? roamingOperatorNumeric : phone.getServiceState().getOperatorNumeric())) {
- Log.d(LOG_TAG, "Skip showing roaming connected notification.");
- return;
- }
- // Don't show roaming notification if we've already shown for this MccMnc
- if (roamingOperatorNumeric != null
- && !mPrevRoamingOperatorNumerics.add(roamingOperatorNumeric)) {
- Log.d(LOG_TAG, "Skip roaming connected notification since already shown in "
- + "MccMnc " + roamingOperatorNumeric);
- return;
- }
- // No need to show it again if we never cancelled it explicitly, or carrier config
- // indicates this is not needed.
- if (mPrevRoamingNotification == ROAMING_NOTIFICATION_CONNECTED) return;
- mPrevRoamingNotification = ROAMING_NOTIFICATION_CONNECTED;
- Log.d(LOG_TAG, "Show roaming connected notification");
- mDataRoamingNotifLog.log("Show roaming on.");
- Message msg = mHandler.obtainMessage(EVENT_DATA_ROAMING_CONNECTED);
- msg.arg1 = mDefaultDataSubId;
- msg.sendToTarget();
- } else if (mPrevRoamingNotification != ROAMING_NOTIFICATION_NO_NOTIFICATION) {
- // Otherwise we either 1) we are not roaming or 2) roaming is off but ROAMING_DISABLED
- // is not the only data disable reason. In this case we dismiss the notification we
- // showed earlier.
- mPrevRoamingNotification = ROAMING_NOTIFICATION_NO_NOTIFICATION;
- Log.d(LOG_TAG, "Dismiss roaming notification");
- mDataRoamingNotifLog.log("Hide. data allowed=" + dataAllowed);
- mHandler.sendEmptyMessage(EVENT_DATA_ROAMING_OK);
- }
- }
-
/**
*
* @param subId to check roaming on
@@ -1448,16 +1339,8 @@
pw.increaseIndent();
pw.println("FeatureFlags:");
pw.increaseIndent();
- pw.println("reorganizeRoamingNotification="
- + mFeatureFlags.reorganizeRoamingNotification());
- pw.println("dismissNetworkSelectionNotificationOnSimDisable="
- + mFeatureFlags.dismissNetworkSelectionNotificationOnSimDisable());
pw.decreaseIndent();
- if (mFeatureFlags.reorganizeRoamingNotification()) {
- pw.println("mCurrentRoamingNotification=" + mCurrentRoamingNotification);
- } else {
- pw.println("mPrevRoamingNotification=" + mPrevRoamingNotification);
- }
+ pw.println("mCurrentRoamingNotification=" + mCurrentRoamingNotification);
pw.println("mDefaultDataSubId=" + mDefaultDataSubId);
pw.println("isSmsCapable=" + TelephonyManager.from(this).isSmsCapable());
pw.println("mDataRoamingNotifLog:");
@@ -1495,11 +1378,7 @@
}
pw.decreaseIndent();
pw.decreaseIndent();
- if (mFeatureFlags.reorganizeRoamingNotification()) {
- pw.println("mShownNotificationReasons=" + mShownNotificationReasons);
- } else {
- pw.println("mPrevRoamingOperatorNumerics:" + mPrevRoamingOperatorNumerics);
- }
+ pw.println("mShownNotificationReasons=" + mShownNotificationReasons);
pw.println("------- End PhoneGlobals -------");
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index a3d8baf..0548aa5 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -15017,4 +15017,25 @@
Binder.restoreCallingIdentity(identity);
}
}
+
+ /**
+ * Get list of applications that are optimized for low bandwidth satellite data.
+ *
+ * @return List of Application Name with data optimized network property.
+ * {@link #PROPERTY_SATELLITE_DATA_OPTIMIZED}
+ */
+ @Override
+ public List<String> getSatelliteDataOptimizedApps() {
+ enforceSatelliteCommunicationPermission("getSatelliteDataOptimizedApps");
+ List<String> appNames = new ArrayList<>();
+ int userId = Binder.getCallingUserHandle().getIdentifier();
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ appNames = mSatelliteController.getSatelliteDataOptimizedApps(userId);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+
+ return appNames;
+ }
}
diff --git a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
index d4edabe..a6451d5 100644
--- a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
+++ b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
@@ -278,6 +278,7 @@
@NonNull
private List<String> mSatelliteCountryCodes;
private boolean mIsSatelliteAllowAccessControl;
+ protected int mSatelliteAccessConfigVersion;
@Nullable
private File mSatelliteS2CellFile;
@Nullable
@@ -358,6 +359,8 @@
"config_updater_satellite_country_codes";
private static final String CONFIG_UPDATER_SATELLITE_IS_ALLOW_ACCESS_CONTROL_KEY =
"config_updater_satellite_is_allow_access_control";
+ protected static final String CONFIG_UPDATER_SATELLITE_VERSION_KEY =
+ "config_updater_satellite_version";
private static final String LATEST_SATELLITE_COMMUNICATION_ALLOWED_SET_TIME_KEY =
"latest_satellite_communication_allowed_set_time";
@@ -432,7 +435,7 @@
plogd("Location settings is just enabled");
sendRequestAsync(EVENT_LOCATION_SETTINGS_ENABLED, null);
} else {
- plogd("Location settings is just enabled");
+ plogd("Location settings is just disabled");
sendRequestAsync(EVENT_LOCATION_SETTINGS_DISABLED, null);
}
}
@@ -1088,19 +1091,21 @@
}
}
- private void deleteSharedPreferencesCountryCodes(@NonNull Context context) {
+ private void deleteSharedPreferencesbyKey(
+ @NonNull Context context, @NonNull String key) {
+ plogd("deletedeleteSharedPreferencesbyKey: " + key);
if (mSharedPreferences == null) {
- plogd("deleteSharedPreferencesCountryCodes: mSharedPreferences is null");
+ plogd("deleteSharedPreferencesbyKey: mSharedPreferences is null");
initSharedPreferences(context);
}
if (mSharedPreferences == null) {
- plogd("deleteSharedPreferencesCountryCodes: mSharedPreferences is still null");
+ plogd("deleteSharedPreferencesbyKey: mSharedPreferences is still null");
return;
}
try {
- mSharedPreferences.edit().remove(CONFIG_UPDATER_SATELLITE_COUNTRY_CODES_KEY).apply();
+ mSharedPreferences.edit().remove(key).apply();
} catch (Exception ex) {
- ploge("deleteSharedPreferencesCountryCodes error : " + ex);
+ ploge("deleteSharedPreferencesbyKey error : " + ex);
}
}
@@ -1125,6 +1130,27 @@
}
}
+ private boolean updateSharedPreferencesSatelliteAccessConfigVersion(
+ @NonNull Context context, int version) {
+ if (mSharedPreferences == null) {
+ plogd("updateSharedPreferencesSatelliteAccessConfigVersion: "
+ + "mSharedPreferences is null");
+ initSharedPreferences(context);
+ }
+ if (mSharedPreferences == null) {
+ ploge("updateSharedPreferencesSatelliteAccessConfigVersion: "
+ + "mSharedPreferences is null");
+ return false;
+ }
+ try {
+ mSharedPreferences.edit().putInt(CONFIG_UPDATER_SATELLITE_VERSION_KEY, version).apply();
+ return true;
+ } catch (Exception ex) {
+ ploge("updateSharedPreferencesSatelliteAccessConfigVersion error: " + ex);
+ return false;
+ }
+ }
+
private void persistLatestSatelliteCommunicationAllowedState() {
if (mSharedPreferences == null) {
ploge("persistLatestSatelliteCommunicationAllowedState: mSharedPreferences is null");
@@ -1155,6 +1181,14 @@
return;
}
+ // satellite access config version
+ int satelliteAccessConfigVersion = satelliteConfig.getSatelliteConfigDataVersion();
+ if (satelliteAccessConfigVersion <= 0) {
+ plogd("updateSatelliteAccessDataWithConfigUpdaterData: version is invalid: "
+ + satelliteAccessConfigVersion);
+ return;
+ }
+
// validation check country code
List<String> satelliteCountryCodes = satelliteConfig.getDeviceSatelliteCountryCodes();
if (!isValidCountryCodes(satelliteCountryCodes)) {
@@ -1262,17 +1296,37 @@
+ " into shared preferences");
localS2CellFile.delete();
localSatelliteAccessConfigFile.delete();
- deleteSharedPreferencesCountryCodes(context);
+ deleteSharedPreferencesbyKey(
+ context, CONFIG_UPDATER_SATELLITE_COUNTRY_CODES_KEY);
mConfigUpdaterMetricsStats.reportOemConfigError(
SatelliteConstants.CONFIG_UPDATE_RESULT_IO_ERROR);
return;
}
+ // copy version of satellite access config into the shared preferences of phone
+ if (!updateSharedPreferencesSatelliteAccessConfigVersion(
+ context, satelliteAccessConfigVersion)) {
+ ploge("updateSatelliteAccessDataWithConfigUpdaterData: "
+ + "fail to copy satelliteAccessConfigVersion"
+ + " into shared preferences");
+ localS2CellFile.delete();
+ localSatelliteAccessConfigFile.delete();
+ deleteSharedPreferencesbyKey(
+ context, CONFIG_UPDATER_SATELLITE_COUNTRY_CODES_KEY);
+ deleteSharedPreferencesbyKey(
+ context, CONFIG_UPDATER_SATELLITE_IS_ALLOW_ACCESS_CONTROL_KEY);
+ mConfigUpdaterMetricsStats.reportOemConfigError(
+ SatelliteConstants.CONFIG_UPDATE_RESULT_IO_ERROR);
+ return;
+ }
+
+ mSatelliteAccessConfigVersion = satelliteAccessConfigVersion;
mSatelliteS2CellFile = localS2CellFile;
mSatelliteAccessConfigFile = localSatelliteAccessConfigFile;
mSatelliteCountryCodes = satelliteCountryCodes;
mIsSatelliteAllowAccessControl = satelliteConfig.isSatelliteDataForAllowedRegion();
- plogd("Use s2 cell file=" + mSatelliteS2CellFile.getAbsolutePath()
+ plogd("mSatelliteAccessConfigVersion=" + mSatelliteAccessConfigVersion
+ + "Use s2 cell file=" + mSatelliteS2CellFile.getAbsolutePath()
+ ", mSatelliteAccessConfigFile=" + mSatelliteAccessConfigFile.getAbsolutePath()
+ ", country codes=" + String.join(",", mSatelliteCountryCodes)
+ ", mIsSatelliteAllowAccessControl=" + mIsSatelliteAllowAccessControl
@@ -1363,11 +1417,19 @@
return;
}
+ int satelliteConfigVersion = mSharedPreferences.getInt(
+ CONFIG_UPDATER_SATELLITE_VERSION_KEY, 0);
+ if (satelliteConfigVersion <= 0) {
+ ploge("loadConfigUpdaterConfigs: satelliteConfigVersion is invalid: "
+ + satelliteConfigVersion);
+ return;
+ }
+
Set<String> countryCodes =
mSharedPreferences.getStringSet(CONFIG_UPDATER_SATELLITE_COUNTRY_CODES_KEY, null);
if (countryCodes == null || countryCodes.isEmpty()) {
- ploge("config updater country codes are either null or empty");
+ ploge("loadConfigUpdaterConfigs: configupdater country codes are either null or empty");
return;
}
@@ -1378,7 +1440,7 @@
File s2CellFile = getConfigUpdaterSatelliteConfigFileFromLocalDirectory(
CONFIG_UPDATER_S2_CELL_FILE_NAME);
if (s2CellFile == null) {
- ploge("s2CellFile is null");
+ ploge("loadConfigUpdaterConfigs: s2CellFile is null");
return;
}
@@ -1389,11 +1451,18 @@
return;
}
- plogd("use config updater config data");
+ mSatelliteAccessConfigVersion = satelliteConfigVersion;
mSatelliteS2CellFile = s2CellFile;
mSatelliteAccessConfigFile = satelliteAccessConfigJsonFile;
mSatelliteCountryCodes = countryCodes.stream().collect(Collectors.toList());
mIsSatelliteAllowAccessControl = isSatelliteAllowAccessControl;
+ plogd("loadConfigUpdaterConfigs: use satellite config data from configupdater: "
+ + " mSatelliteAccessConfigVersion=" + mSatelliteAccessConfigVersion
+ + ", Use s2 cell file=" + mSatelliteS2CellFile.getAbsolutePath()
+ + ", mSatelliteAccessConfigFile=" + mSatelliteAccessConfigFile.getAbsolutePath()
+ + ", country codes=" + String.join(",", mSatelliteCountryCodes)
+ + ", mIsSatelliteAllowAccessControl=" + mIsSatelliteAllowAccessControl
+ + " from ConfigUpdater");
mAccessControllerMetricsStats.setConfigDataSource(
SatelliteConstants.CONFIG_DATA_SOURCE_CONFIG_UPDATER);
}
@@ -2222,9 +2291,9 @@
plogd(
"checkSatelliteAccessRestrictionForLocation: "
+ "checking satellite access restriction for location: lat - "
- + location.getLatitude()
+ + Rlog.pii(TAG, location.getLatitude())
+ ", long - "
- + location.getLongitude()
+ + Rlog.pii(TAG, location.getLongitude())
+ ", mS2Level - "
+ mS2Level);
SatelliteOnDeviceAccessController.LocationToken locationToken =
@@ -2276,9 +2345,9 @@
"checkSatelliteAccessRestrictionForLocation: "
+ (satelliteAllowed ? "Satellite Allowed" : "Satellite NOT Allowed")
+ " for location: lat - "
- + location.getLatitude()
+ + Rlog.pii(TAG, location.getLatitude())
+ ", long - "
- + location.getLongitude()
+ + Rlog.pii(TAG, location.getLongitude())
+ ", mS2Level - "
+ mS2Level);
Bundle bundle = new Bundle();
@@ -3088,6 +3157,9 @@
mControllerMetricsStats.reportFailedSatelliteAccessCheckCount();
}
+ mControllerMetricsStats.reportCurrentVersionOfSatelliteAccessConfig(
+ mSatelliteAccessConfigVersion);
+
mAccessControllerMetricsStats
.setLocationQueryTime(mLocationQueryStartTimeMillis)
.setTotalCheckingTime(mTotalCheckingStartTimeMillis)
diff --git a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
index 1f46ff6..b3c0fdd 100644
--- a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
+++ b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
@@ -118,10 +118,6 @@
* @param featureFlags The feature flag.
*/
public static void make(@NonNull Context context, @NonNull FeatureFlags featureFlags) {
- if (!featureFlags.carrierEnabledSatelliteFlag()) {
- logd("carrierEnabledSatelliteFlag is disabled. don't created this.");
- return;
- }
if (sInstance == null) {
HandlerThread handlerThread = new HandlerThread(TAG);
handlerThread.start();
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index ab7a3bf..5f0b2c1 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -2004,7 +2004,8 @@
private static final int SATELLITE_CHANNEL = 8665;
private final OnCheckedChangeListener mForceSatelliteChannelOnChangeListener =
(buttonView, isChecked) -> {
- if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
+
+ if (!isValidSubscription(mSubId)) {
loge("Force satellite channel invalid subId " + mSubId);
return;
}
@@ -2237,11 +2238,9 @@
dataMode);
overrideBundle.putBoolean(
KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, false);
- log("satData: mMockSatelliteDataListener: new " + overrideBundle);
- if (SubscriptionManager.isValidSubscriptionId(mSubId)) {
+ if (isValidSubscription(mSubId)) {
getCarrierConfig().overrideConfig(mSubId, overrideBundle, false);
- } else {
- Log.e(TAG, "SubscriptionId is not valid: " + mSubId);
+ log("satData: mMockSatelliteDataListener: Updated new config" + overrideBundle);
}
};
@@ -2271,7 +2270,7 @@
}
private void reloadCarrierConfigDefaults() {
- if (mSatelliteDataOriginalBundle[mPhoneId] != null) {
+ if (mSatelliteDataOriginalBundle[mPhoneId] != null && isValidSubscription(mSubId)) {
log("satData: Setting originalCarrierConfig = "
+ mSatelliteDataOriginalBundle[mPhoneId]);
getCarrierConfig().overrideConfig(mSubId, mSatelliteDataOriginalBundle[mPhoneId],
@@ -2281,24 +2280,40 @@
private boolean isValidOperator(int subId) {
String operatorNumeric = null;
- if (SubscriptionManager.isValidSubscriptionId(subId)) {
- operatorNumeric = mTelephonyManager
- .getNetworkOperatorForPhone(mPhoneId);
+ if (isValidSubscription(subId)) {
+ operatorNumeric = mTelephonyManager.getNetworkOperatorForPhone(mPhoneId);
TelephonyManager tm;
- if (TextUtils.isEmpty(operatorNumeric)
- && (tm = getSystemService(TelephonyManager.class)) != null) {
+ if (TextUtils.isEmpty(operatorNumeric) && (tm = getSystemService(
+ TelephonyManager.class)) != null) {
operatorNumeric = tm.getSimOperatorNumericForPhone(mPhoneId);
}
}
return !TextUtils.isEmpty(operatorNumeric);
}
+ /**
+ * This method will do extra check to validate the subId.
+ * <p>
+ * In case user opens the radioInfo when sim is active and enable some checks and go to the
+ * SIM settings screen and disabled the screen. Upon return to radioInfo screen subId is still
+ * valid but not in active state any more.
+ */
+ private boolean isValidSubscription(int subId) {
+ boolean isValidSubId = false;
+ if (SubscriptionManager.isValidSubscriptionId(subId)) {
+ SubscriptionManager mSm = getSystemService(SubscriptionManager.class);
+ isValidSubId = mSm.isActiveSubscriptionId(subId);
+ }
+ log("isValidSubscription, subId [ " + subId + " ] = " + isValidSubId);
+ return isValidSubId;
+ }
+
private final OnCheckedChangeListener mMockSatelliteListener =
(buttonView, isChecked) -> {
int subId = mSubId;
int phoneId = mPhoneId;
if (SubscriptionManager.isValidPhoneId(phoneId)
- && SubscriptionManager.isValidSubscriptionId(subId)) {
+ && isValidSubscription(subId)) {
if (getCarrierConfig() == null) return;
if (isChecked) {
if (!isValidOperator(subId)) {
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index d793db9..6860b25 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -23,7 +23,6 @@
import static android.telephony.TelephonyManager.HAL_SERVICE_VOICE;
import static com.android.internal.telephony.PhoneConstants.PHONE_TYPE_GSM;
-import static com.android.internal.telephony.flags.Flags.carrierEnabledSatelliteFlag;
import android.annotation.NonNull;
import android.app.AlertDialog;
@@ -1318,7 +1317,8 @@
}
if (!isEmergencyNumber) {
- if (isCallDisallowedDueToSatellite(phone)
+ if ((isCallDisallowedDueToSatellite(phone)
+ || isCallDisallowedDueToNtnEligibility(phone))
&& (imsPhone == null || !imsPhone.canMakeWifiCall())) {
Log.d(this, "onCreateOutgoingConnection, cannot make call "
+ "when device is connected to carrier roaming satellite network");
@@ -4843,23 +4843,17 @@
* else {@code false}.
*/
private boolean isCallDisallowedDueToSatellite(Phone phone) {
- if (!carrierEnabledSatelliteFlag()) {
- return false;
- }
-
if (phone == null) {
return false;
}
if (!mSatelliteController.isInSatelliteModeForCarrierRoaming(phone)) {
- // Device is not connected to satellite
+ // Phone is not connected to carrier roaming ntn
return false;
}
- List<Integer> capabilities =
- mSatelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(phone);
- if (capabilities.contains(NetworkRegistrationInfo.SERVICE_TYPE_VOICE)) {
- // Call is supported while using satellite
+ if (isVoiceSupportedInSatelliteMode(phone)) {
+ // Call is supported in satellite mode
return false;
}
@@ -4867,6 +4861,42 @@
return true;
}
+ private boolean isCallDisallowedDueToNtnEligibility(@Nullable Phone phone) {
+ if (phone == null) {
+ Log.d(this, "isCallDisallowedDueToNtnEligibility: phone is null");
+ return false;
+ }
+
+ if (!mSatelliteController.getLastNotifiedNtnEligibility(phone)) {
+ // Phone is not carrier roaming ntn eligible
+ Log.d(this, "isCallDisallowedDueToNtnEligibility: eligibility is false");
+ return false;
+ }
+
+ if (isVoiceSupportedInSatelliteMode(phone)) {
+ // Call is supported in satellite mode
+ Log.d(this, "isCallDisallowedDueToNtnEligibility: voice is supported");
+ return false;
+ }
+
+ // Call is disallowed while eligibility is true
+ Log.d(this, "isCallDisallowedDueToNtnEligibility: return true");
+ return true;
+ }
+
+ private boolean isVoiceSupportedInSatelliteMode(@NonNull Phone phone) {
+ List<Integer> capabilities =
+ mSatelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(phone);
+ if (capabilities.contains(NetworkRegistrationInfo.SERVICE_TYPE_VOICE)) {
+ // Call is supported in satellite mode
+ Log.d(this, "isVoiceSupportedInSatelliteMode: voice is supported");
+ return true;
+ }
+
+ Log.d(this, "isVoiceSupportedInSatelliteMode: voice is not supported");
+ return false;
+ }
+
private boolean getTurnOffOemEnabledSatelliteDuringEmergencyCall() {
boolean turnOffSatellite = false;
try {
diff --git a/tests/src/com/android/phone/CarrierConfigLoaderTest.java b/tests/src/com/android/phone/CarrierConfigLoaderTest.java
index 5190b21..00726c1 100644
--- a/tests/src/com/android/phone/CarrierConfigLoaderTest.java
+++ b/tests/src/com/android/phone/CarrierConfigLoaderTest.java
@@ -28,6 +28,7 @@
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -69,6 +70,7 @@
import org.junit.Test;
import org.junit.rules.TestRule;
import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -482,4 +484,41 @@
mCarrierConfigLoader.updateConfigForPhoneId(1, IccCardConstants.INTENT_VALUE_ICC_ABSENT);
mTestableLooper.processAllMessages();
}
+
+ @Test
+ public void testSystemUnlocked_noCallback() throws Exception {
+ replaceInstance(TelephonyManager.class, "sInstance", null, mTelephonyManager);
+ replaceInstance(CarrierConfigLoader.class, "mHasSentConfigChange",
+ mCarrierConfigLoader, new boolean[]{true});
+ doNothing().when(mContext).sendBroadcastAsUser(any(Intent.class), any(UserHandle.class));
+
+ mFakePermissionEnforcer.grant(android.Manifest.permission.MODIFY_PHONE_STATE);
+ // Prepare to make sure we can save the config into the XML file which used as cache
+ doReturn(PLATFORM_CARRIER_CONFIG_PACKAGE).when(mTelephonyManager)
+ .getCarrierServicePackageNameForLogicalSlot(anyInt());
+
+ doReturn(true).when(mContext).bindService(
+ any(Intent.class), any(ServiceConnection.class), anyInt());
+ Mockito.clearInvocations(mTelephonyRegistryManager);
+ Mockito.clearInvocations(mContext);
+ mHandler.sendMessage(mHandler.obtainMessage(13 /* EVENT_SYSTEM_UNLOCKED */));
+ mTestableLooper.processAllMessages();
+ mHandler.sendMessage(mHandler.obtainMessage(5 /* EVENT_FETCH_DEFAULT_DONE */));
+ mTestableLooper.processAllMessages();
+ mHandler.sendMessage(mHandler.obtainMessage(6 /* EVENT_FETCH_CARRIER_DONE */));
+ mTestableLooper.processAllMessages();
+
+ ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class);
+ verify(mSubscriptionManagerService).updateSubscriptionByCarrierConfig(eq(0), anyString(),
+ any(PersistableBundle.class), runnableCaptor.capture());
+
+ runnableCaptor.getValue().run();
+ mTestableLooper.processAllMessages();
+
+ // Broadcast should be sent for backwards compatibility.
+ verify(mContext).sendBroadcastAsUser(any(Intent.class), any(UserHandle.class));
+ // But callback should not be sent.
+ verify(mTelephonyRegistryManager, never()).notifyCarrierConfigChanged(
+ anyInt(), anyInt(), anyInt(), anyInt());
+ }
}
diff --git a/tests/src/com/android/phone/PhoneInterfaceManagerTest.java b/tests/src/com/android/phone/PhoneInterfaceManagerTest.java
index ef6a02a..bbcb52b 100644
--- a/tests/src/com/android/phone/PhoneInterfaceManagerTest.java
+++ b/tests/src/com/android/phone/PhoneInterfaceManagerTest.java
@@ -46,6 +46,7 @@
import android.platform.test.flag.junit.SetFlagsRule;
import android.preference.PreferenceManager;
import android.telephony.RadioAccessFamily;
+import android.telephony.Rlog;
import android.telephony.TelephonyManager;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -74,6 +75,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
+import java.util.List;
import java.util.Locale;
/**
@@ -85,6 +87,8 @@
@Rule
public TestRule compatChangeRule = new PlatformCompatChangeRule();
+ private static final String TAG = "PhoneInterfaceManagerTest";
+
private PhoneInterfaceManager mPhoneInterfaceManager;
private SharedPreferences mSharedPreferences;
@Mock private IIntegerConsumer mIIntegerConsumer;
@@ -322,6 +326,10 @@
mPhoneInterfaceManager).getDefaultPhone();
}
+ private static void loge(String message) {
+ Rlog.e(TAG, message);
+ }
+
@Test
public void setNullCipherNotificationsEnabled_allReqsMet_successfullyEnabled() {
setModemSupportsNullCipherNotification(true);
@@ -550,4 +558,25 @@
String packageName = mPhoneInterfaceManager.getCurrentPackageName();
assertEquals(null, packageName);
}
+
+ @Test
+ public void testGetSatelliteDataOptimizedApps() throws Exception {
+ doReturn(true).when(mFeatureFlags).carrierRoamingNbIotNtn();
+ mPhoneInterfaceManager.setFeatureFlags(mFeatureFlags);
+ loge("FeatureFlagApi is set to return true");
+
+ boolean containsCtsApp = false;
+ String ctsPackageName = "android.telephony.cts";
+ List<String> listSatelliteApplications =
+ mPhoneInterfaceManager.getSatelliteDataOptimizedApps();
+
+ for (String packageName : listSatelliteApplications) {
+ if (ctsPackageName.equals(packageName)) {
+ containsCtsApp = true;
+ }
+ }
+
+ assertFalse(containsCtsApp);
+ }
+
}
diff --git a/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java b/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java
index 9d23493..9ecb04b 100644
--- a/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java
+++ b/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java
@@ -34,6 +34,7 @@
import static com.android.phone.satellite.accesscontrol.SatelliteAccessController.ALLOWED_STATE_CACHE_VALID_DURATION_NANOS;
import static com.android.phone.satellite.accesscontrol.SatelliteAccessController.CMD_IS_SATELLITE_COMMUNICATION_ALLOWED;
+import static com.android.phone.satellite.accesscontrol.SatelliteAccessController.CONFIG_UPDATER_SATELLITE_VERSION_KEY;
import static com.android.phone.satellite.accesscontrol.SatelliteAccessController.DEFAULT_DELAY_MINUTES_BEFORE_VALIDATING_POSSIBLE_CHANGE_IN_ALLOWED_REGION;
import static com.android.phone.satellite.accesscontrol.SatelliteAccessController.DEFAULT_MAX_RETRY_COUNT_FOR_VALIDATING_POSSIBLE_CHANGE_IN_ALLOWED_REGION;
import static com.android.phone.satellite.accesscontrol.SatelliteAccessController.DEFAULT_REGIONAL_SATELLITE_CONFIG_ID;
@@ -411,6 +412,8 @@
when(mMockSharedPreferences.getBoolean(anyString(), anyBoolean())).thenReturn(true);
when(mMockSharedPreferences.getStringSet(anyString(), any()))
.thenReturn(Set.of(TEST_SATELLITE_COUNTRY_CODES));
+ when(mMockSharedPreferences.getInt(
+ eq(CONFIG_UPDATER_SATELLITE_VERSION_KEY), anyInt())).thenReturn(0);
doReturn(mMockSharedPreferencesEditor).when(mMockSharedPreferences).edit();
doReturn(mMockSharedPreferencesEditor).when(mMockSharedPreferencesEditor)
.putBoolean(anyString(), anyBoolean());
@@ -418,6 +421,8 @@
.putStringSet(anyString(), any());
doReturn(mMockSharedPreferencesEditor).when(mMockSharedPreferencesEditor)
.putLong(anyString(), anyLong());
+ doReturn(mMockSharedPreferencesEditor).when(mMockSharedPreferencesEditor)
+ .putInt(anyString(), anyInt());
doNothing().when(mMockSharedPreferencesEditor).apply();
when(mMockFeatureFlags.satellitePersistentLogging()).thenReturn(true);
@@ -1445,7 +1450,7 @@
@Test
- public void testUpdateSatelliteConfigData() throws Exception {
+ public void testUpdateSatelliteAccessDataWithConfigUpdaterData() throws Exception {
logd("registering for config update changed");
verify(mMockSatelliteController).registerForConfigUpdateChanged(
mConfigUpdateHandlerCaptor.capture(), mConfigUpdateIntCaptor.capture(),
@@ -1461,8 +1466,9 @@
// These APIs are executed during loadRemoteConfigs
logd("verify load remote configs shared preferences method calls");
- verify(mMockSharedPreferences, times(1)).getStringSet(anyString(), any());
- verify(mMockSharedPreferences, times(5)).getBoolean(anyString(), anyBoolean());
+ verify(mMockSharedPreferences, times(1)).getInt(anyString(), anyInt());
+ verify(mMockSharedPreferences, times(0)).getStringSet(anyString(), any());
+ verify(mMockSharedPreferences, times(4)).getBoolean(anyString(), anyBoolean());
// satelliteConfig is null
logd("test for satelliteConfig is null");
@@ -1476,10 +1482,10 @@
verify(mMockCachedAccessRestrictionMap, never()).clear();
verify(mMockSatelliteController, times(1)).getSatelliteConfig();
- // satelliteConfig has invalid country codes
- logd("test for satelliteConfig with invalid country codes");
+ // satelliteConfig has satellite config data version(0) which is from device config.
+ logd("test for satelliteConfig from device config version 0");
SatelliteConfig mockConfig = mock(SatelliteConfig.class);
- doReturn(List.of("USA", "JAP")).when(mockConfig).getDeviceSatelliteCountryCodes();
+ doReturn(0).when(mockConfig).getSatelliteConfigDataVersion();
doReturn(mockConfig).when(mMockSatelliteController).getSatelliteConfig();
doReturn(false).when(mockConfig).isSatelliteDataForAllowedRegion();
@@ -1487,6 +1493,24 @@
verify(mMockSharedPreferences, never()).edit();
verify(mMockCachedAccessRestrictionMap, never()).clear();
verify(mMockSatelliteController, times(2)).getSatelliteConfig();
+ verify(mockConfig, times(1)).getSatelliteConfigDataVersion();
+ verify(mockConfig, times(0)).getDeviceSatelliteCountryCodes();
+ verify(mockConfig, times(0)).isSatelliteDataForAllowedRegion();
+ verify(mockConfig, times(0)).getSatelliteS2CellFile(mMockContext);
+ verify(mockConfig, times(0)).getSatelliteAccessConfigJsonFile(mMockContext);
+
+ // satelliteConfig has invalid country codes
+ logd("test for satelliteConfig with invalid country codes");
+ doReturn(1).when(mockConfig).getSatelliteConfigDataVersion();
+ doReturn(List.of("USA", "JAP")).when(mockConfig).getDeviceSatelliteCountryCodes();
+ doReturn(mockConfig).when(mMockSatelliteController).getSatelliteConfig();
+ doReturn(false).when(mockConfig).isSatelliteDataForAllowedRegion();
+
+ sendConfigUpdateChangedEvent(mMockContext);
+ verify(mMockSharedPreferences, never()).edit();
+ verify(mMockCachedAccessRestrictionMap, never()).clear();
+ verify(mMockSatelliteController, times(3)).getSatelliteConfig();
+ verify(mockConfig, times(2)).getSatelliteConfigDataVersion();
verify(mockConfig, times(1)).getDeviceSatelliteCountryCodes();
verify(mockConfig, times(0)).isSatelliteDataForAllowedRegion();
verify(mockConfig, times(0)).getSatelliteS2CellFile(mMockContext);
@@ -1501,7 +1525,8 @@
sendConfigUpdateChangedEvent(mMockContext);
verify(mMockSharedPreferences, never()).edit();
verify(mMockCachedAccessRestrictionMap, never()).clear();
- verify(mMockSatelliteController, times(3)).getSatelliteConfig();
+ verify(mMockSatelliteController, times(4)).getSatelliteConfig();
+ verify(mockConfig, times(3)).getSatelliteConfigDataVersion();
verify(mockConfig, times(2)).getDeviceSatelliteCountryCodes();
verify(mockConfig, times(1)).isSatelliteDataForAllowedRegion();
verify(mockConfig, times(0)).getSatelliteS2CellFile(mMockContext);
@@ -1526,7 +1551,8 @@
sendConfigUpdateChangedEvent(mMockContext);
verify(mMockSharedPreferences, never()).edit();
verify(mMockCachedAccessRestrictionMap, never()).clear();
- verify(mMockSatelliteController, times(4)).getSatelliteConfig();
+ verify(mMockSatelliteController, times(5)).getSatelliteConfig();
+ verify(mockConfig, times(4)).getSatelliteConfigDataVersion();
verify(mockConfig, times(3)).getDeviceSatelliteCountryCodes();
verify(mockConfig, times(2)).isSatelliteDataForAllowedRegion();
verify(mockConfig, times(1)).getSatelliteS2CellFile(mMockContext);
@@ -1553,7 +1579,8 @@
sendConfigUpdateChangedEvent(mMockContext);
verify(mMockSharedPreferences, never()).edit();
verify(mMockCachedAccessRestrictionMap, never()).clear();
- verify(mMockSatelliteController, times(5)).getSatelliteConfig();
+ verify(mMockSatelliteController, times(6)).getSatelliteConfig();
+ verify(mockConfig, times(5)).getSatelliteConfigDataVersion();
verify(mockConfig, times(4)).getDeviceSatelliteCountryCodes();
verify(mockConfig, times(3)).isSatelliteDataForAllowedRegion();
verify(mockConfig, times(2)).getSatelliteS2CellFile(mMockContext);
@@ -1580,9 +1607,10 @@
.getSatelliteAccessConfigJsonFile(mMockContext);
sendConfigUpdateChangedEvent(mMockContext);
- verify(mMockSharedPreferences, times(2)).edit();
+ verify(mMockSharedPreferences, times(3)).edit();
verify(mMockCachedAccessRestrictionMap, times(1)).clear();
- verify(mMockSatelliteController, times(6)).getSatelliteConfig();
+ verify(mMockSatelliteController, times(7)).getSatelliteConfig();
+ verify(mockConfig, times(6)).getSatelliteConfigDataVersion();
verify(mockConfig, times(5)).getDeviceSatelliteCountryCodes();
verify(mockConfig, times(5)).isSatelliteDataForAllowedRegion();
verify(mockConfig, times(3)).getSatelliteS2CellFile(mMockContext);
@@ -1642,6 +1670,8 @@
logd("Creating sats2.dat and satellite_access_config.json files");
// set given sats2.dat and satellite_access_config.json as device geofence files
+ doReturn(0).when(mMockSharedPreferences)
+ .getInt(eq(CONFIG_UPDATER_SATELLITE_VERSION_KEY), anyInt());
String sats2FilePath = setupTestFileFromRawResource(sats2ResId, targetSats2FileName);
when(mMockResources.getString(
com.android.internal.R.string.config_oem_enabled_satellite_s2cell_file))
@@ -1655,6 +1685,7 @@
}
private void setupOtaGeofenceData(
+ int version,
SatelliteConfig mockConfig,
int sats2ResId,
String targetSats2FileName,
@@ -1683,6 +1714,9 @@
doReturn(List.of(TEST_SATELLITE_COUNTRY_CODES))
.when(mockConfig)
.getDeviceSatelliteCountryCodes();
+ doReturn(version).when(mockConfig).getSatelliteConfigDataVersion();
+ doReturn(version).when(mMockSharedPreferences)
+ .getInt(eq(CONFIG_UPDATER_SATELLITE_VERSION_KEY), anyInt());
}
private boolean areOnDeviceAndOtaFilesValidAndDifferent(
@@ -1778,6 +1812,7 @@
"v15_sats2.dat",
com.android.phone.tests.R.raw.v15_satellite_access_config,
"v15_satellite_access_config.json");
+ assertEquals(0, mSatelliteAccessControllerUT.getSatelliteAccessConfigVersion());
assertTrue(isLocationAllowed(bundleCaptor, mockResultReceiverIterator, locationUS));
assertFalse(isLocationAllowed(bundleCaptor, mockResultReceiverIterator, locationKR));
assertFalse(isLocationAllowed(bundleCaptor, mockResultReceiverIterator, locationTW));
@@ -1826,6 +1861,7 @@
+ " Simulate config update for v16 files. Expectation: locationUS -"
+ " allowed; locationKR - allowed; locationTW - allowed");
setupOtaGeofenceData(
+ 16,
mockConfig,
com.android.phone.tests.R.raw.v16_sats2,
"v16_sats2.dat",
@@ -1833,6 +1869,8 @@
"v16_satellite_access_config.json",
new String[] {"US", "CA", "UK", "KR", "TW"});
sendConfigUpdateChangedEvent(mMockContext);
+
+ assertEquals(16, mSatelliteAccessControllerUT.getSatelliteAccessConfigVersion());
assertTrue(isLocationAllowed(bundleCaptor, mockResultReceiverIterator, locationUS));
assertTrue(isLocationAllowed(bundleCaptor, mockResultReceiverIterator, locationKR));
assertTrue(isLocationAllowed(bundleCaptor, mockResultReceiverIterator, locationTW));
@@ -1887,6 +1925,7 @@
+ " Simulate config update for v17 files. Expectation: locationUS -"
+ " allowed; locationKR - not allowed; locationTW - not allowed");
setupOtaGeofenceData(
+ 17,
mockConfig,
com.android.phone.tests.R.raw.v17_sats2,
"v17_sats2.dat",
@@ -1894,6 +1933,8 @@
"v17_satellite_access_config.json",
new String[] {"US", "CA", "UK", "KR", "TW"});
sendConfigUpdateChangedEvent(mMockContext);
+
+ assertEquals(17, mSatelliteAccessControllerUT.getSatelliteAccessConfigVersion());
assertTrue(isLocationAllowed(bundleCaptor, mockResultReceiverIterator, locationUS));
assertFalse(isLocationAllowed(bundleCaptor, mockResultReceiverIterator, locationKR));
assertFalse(isLocationAllowed(bundleCaptor, mockResultReceiverIterator, locationTW));
@@ -2730,5 +2771,11 @@
return mSatelliteAccessConfigMap;
}
}
+
+ public int getSatelliteAccessConfigVersion() {
+ synchronized (mLock) {
+ return mSatelliteAccessConfigVersion;
+ }
+ }
}
}
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 2fc2757..c0bd2dd 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -337,7 +337,6 @@
mTestConnectionService.setTelephonyManagerProxy(mTelephonyManagerProxy);
mBinderStub = (IConnectionService.Stub) mTestConnectionService.onBind(null);
- mSetFlagsRule.disableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
mSetFlagsRule.enableFlags(Flags.FLAG_DO_NOT_OVERRIDE_PRECISE_LABEL);
mSetFlagsRule.enableFlags(Flags.FLAG_CALL_EXTRA_FOR_NON_HOLD_SUPPORTED_CARRIERS);
}
@@ -3805,8 +3804,6 @@
@Test
public void testNormalCallUsingNonTerrestrialNetwork_enableFlag() throws Exception {
- mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
-
setupForCallTest();
// Call is not supported while using satellite
when(mSatelliteController.isInSatelliteModeForCarrierRoaming(any())).thenReturn(true);
@@ -3832,8 +3829,6 @@
@Test
public void testNormalCallUsingSatelliteConnectedWithinHysteresisTime() throws Exception {
- mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
-
// Call is not supported when device is connected to satellite within hysteresis time
setupForCallTest();
when(mSatelliteController.isInSatelliteModeForCarrierRoaming(any())).thenReturn(true);
@@ -3859,25 +3854,7 @@
}
@Test
- public void testNormalCallUsingNonTerrestrialNetwork_disableFlag() throws Exception {
- mSetFlagsRule.disableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
-
- setupForCallTest();
- // Flag is disabled, so call is supported while using satellite
- when(mSatelliteController.isInSatelliteModeForCarrierRoaming(any())).thenReturn(true);
- when(mSatelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(any())).thenReturn(
- List.of(NetworkRegistrationInfo.SERVICE_TYPE_VOICE));
-
- // UnsupportedOperationException is thrown as we cannot perform actual call
- assertThrows(UnsupportedOperationException.class, () -> mTestConnectionService
- .onCreateOutgoingConnection(PHONE_ACCOUNT_HANDLE_1,
- createConnectionRequest(PHONE_ACCOUNT_HANDLE_1, "1234", TELECOM_CALL_ID1)));
- }
-
- @Test
public void testNormalCallUsingNonTerrestrialNetwork_canMakeWifiCall() throws Exception {
- mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
-
setupForCallTest();
// Call is not supported while using satellite
when(mSatelliteController.isInSatelliteModeForCarrierRoaming(any())).thenReturn(true);
@@ -3894,6 +3871,35 @@
}
@Test
+ public void testNormalCallWhenEligibilityIsTrue() throws Exception {
+ mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN);
+
+ setupForCallTest();
+
+ // Carrier roaming ntn eligibility is true and call is not supported
+ when(mSatelliteController.getLastNotifiedNtnEligibility(any())).thenReturn(true);
+ when(mSatelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(any()))
+ .thenReturn(List.of(NetworkRegistrationInfo.SERVICE_TYPE_DATA));
+
+ mConnection = mTestConnectionService.onCreateOutgoingConnection(PHONE_ACCOUNT_HANDLE_1,
+ createConnectionRequest(PHONE_ACCOUNT_HANDLE_1, "1234", TELECOM_CALL_ID1));
+ DisconnectCause disconnectCause = mConnection.getDisconnectCause();
+ assertEquals(android.telephony.DisconnectCause.SATELLITE_ENABLED,
+ disconnectCause.getTelephonyDisconnectCause());
+ assertEquals(DISCONNECT_REASON_CARRIER_ROAMING_SATELLITE_MODE, disconnectCause.getReason());
+
+ // Carrier roaming ntn eligibility is true and call is supported
+ setupForCallTest();
+ when(mSatelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(any())).thenReturn(
+ List.of(NetworkRegistrationInfo.SERVICE_TYPE_VOICE));
+
+ // UnsupportedOperationException is thrown as we cannot perform actual call
+ assertThrows(UnsupportedOperationException.class, () -> mTestConnectionService
+ .onCreateOutgoingConnection(PHONE_ACCOUNT_HANDLE_1,
+ createConnectionRequest(PHONE_ACCOUNT_HANDLE_1, "1234", "TC@2")));
+ }
+
+ @Test
public void testIsAvailableForEmergencyCallsNotForCrossSim() {
Phone mockPhone = Mockito.mock(Phone.class);
when(mockPhone.getImsRegistrationTech()).thenReturn(
@@ -3908,8 +3914,6 @@
@Test
public void testIsAvailableForEmergencyCallsUsingNonTerrestrialNetwork_enableFlag() {
- mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
-
// Call is not supported while using satellite
when(mSatelliteController.isInSatelliteModeForCarrierRoaming(any())).thenReturn(true);
when(mSatelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(any()))
@@ -3930,33 +3934,7 @@
}
@Test
- public void testIsAvailableForEmergencyCallsUsingNonTerrestrialNetwork_disableFlag() {
- mSetFlagsRule.disableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
-
- // Call is supported while using satellite
- when(mSatelliteController.isInSatelliteModeForCarrierRoaming(any())).thenReturn(true);
- when(mSatelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(any()))
- .thenReturn(List.of(NetworkRegistrationInfo.SERVICE_TYPE_VOICE));
- Phone mockPhone = Mockito.mock(Phone.class);
- ServiceState ss = new ServiceState();
- ss.setEmergencyOnly(true);
- ss.setState(ServiceState.STATE_EMERGENCY_ONLY);
- when(mockPhone.getServiceState()).thenReturn(ss);
-
- when(mPhoneFactoryProxy.getPhones()).thenReturn(new Phone[] {mockPhone});
-
- assertTrue(mTestConnectionService.isAvailableForEmergencyCalls(mockPhone,
- EmergencyNumber.EMERGENCY_CALL_ROUTING_EMERGENCY));
- assertFalse(mTestConnectionService.isAvailableForEmergencyCalls(mockPhone,
- EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL));
- assertTrue(mTestConnectionService.isAvailableForEmergencyCalls(mockPhone,
- EmergencyNumber.EMERGENCY_CALL_ROUTING_UNKNOWN));
- }
-
- @Test
public void testIsAvailableForEmergencyCallsUsingNTN_CellularAvailable() {
- mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
-
// Call is not supported while using satellite
when(mSatelliteController.isInSatelliteModeForCarrierRoaming(any())).thenReturn(true);
when(mSatelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(any()))
@@ -3988,8 +3966,6 @@
@Test
public void testIsAvailableForEmergencyCallsUsingNTN_CellularNotAvailable() {
- mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
-
// Call is not supported while using satellite
when(mSatelliteController.isInSatelliteModeForCarrierRoaming(any())).thenReturn(true);
when(mSatelliteController.getCapabilitiesForCarrierRoamingSatelliteMode(any()))