Merge "Cleaned up the flag roaming_notification_for_single_data_network" 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-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/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/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/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 12b34d0..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);
@@ -3895,7 +3872,6 @@
 
     @Test
     public void testNormalCallWhenEligibilityIsTrue() throws Exception {
-        mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
         mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN);
 
         setupForCallTest();
@@ -3938,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()))
@@ -3960,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()))
@@ -4018,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()))