Merge "Re-evaluate disallowed reasons when carrier config changes" into main
diff --git a/res/values/config.xml b/res/values/config.xml
index 847c4c5..03da05b 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -394,4 +394,10 @@
 
     <!-- Whether to turn off OEM-enabled satellite during emergency call -->
     <bool name="config_turn_off_oem_enabled_satellite_during_emergency_call">false</bool>
+
+    <!-- The timeout duration in milliseconds used to determine how long does it wait for modem to
+         get in-service state when dialing emergency routing emergency calls in airplane mode before
+         starting the call. If the value is 0, it doesn't wait and starts the call right after
+         turning radio power on. -->
+    <integer name="config_in_service_wait_timer_when_dialing_emergency_routing_ecc_in_apm">3000</integer>
 </resources>
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index dcddf2b..bab260c 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -571,8 +571,10 @@
                 // Initialize EmergencyStateTracker if domain selection is supported
                 boolean isSuplDdsSwitchRequiredForEmergencyCall = getResources()
                         .getBoolean(R.bool.config_gnss_supl_requires_default_data_for_emergency);
+                int inServiceWaitTimeWhenDialEccInApm = getResources().getInteger(R.integer
+                        .config_in_service_wait_timer_when_dialing_emergency_routing_ecc_in_apm);
                 EmergencyStateTracker.make(this, isSuplDdsSwitchRequiredForEmergencyCall,
-                        mFeatureFlags);
+                        inServiceWaitTimeWhenDialEccInApm, mFeatureFlags);
                 DynamicRoutingController.getInstance().initialize(this);
             }
 
diff --git a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
index f5b230f..0a1a1ad 100644
--- a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
+++ b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
@@ -556,6 +556,7 @@
                         + satelliteSubscriberProvisionStatus);
             }
         };
+        initializeSatelliteSystemNotification(context);
         result = mSatelliteController.registerForSatelliteProvisionStateChanged(
                 mInternalSatelliteProvisionStateCallback);
         plogd("registerForSatelliteProvisionStateChanged result: " + result);
@@ -1403,7 +1404,7 @@
         logd("mSatelliteDisallowedReasons:"
                 + String.join(", ", mSatelliteDisallowedReasons.toString()));
         notifySatelliteDisallowedReasonsChanged();
-        if (mNotifySatelliteAvailabilityEnabled) {
+        if (mFeatureFlags.carrierRoamingNbIotNtn() && mNotifySatelliteAvailabilityEnabled) {
             showSatelliteSystemNotification();
         }
     }
@@ -1526,6 +1527,10 @@
         );
         notificationChannel.setSound(null, null);
         mNotificationManager = context.getSystemService(NotificationManager.class);
+        if(mNotificationManager == null) {
+            ploge("initializeSatelliteSystemNotification: notificationManager is null");
+            return;
+        }
         mNotificationManager.createNotificationChannel(notificationChannel);
 
         createAvailableNotifications(context);