IMS: Handle essential records loaded

- define ACTION_ESSENTIAL_RECORDS_LOADED.
- Handle ESSENTIAL_RECORDS_LOADED to read the required
  carrier configs.

Change-Id: I1f6cfa672cba52e942f1495956c383b71ac1442f
CRs-Fixed: 3355431
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java b/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java
index 8ac9924..bf684df 100755
--- a/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/QtiCallConstants.java
@@ -553,4 +553,9 @@
     // Data Channel call information
     public static final String EXTRA_DATA_CHANNEL_MODEM_CALL_ID = "modemCallId";
     public static final String EXTRA_IS_DATA_CHANNEL_CALL = "isDcCall";
+
+    // Intent action broadcasted when essential records are loaded.
+    // requires permission "com.qti.permission.RECEIVE_ESSENTIAL_RECORDS_LOADED".
+    public static final String ACTION_ESSENTIAL_RECORDS_LOADED =
+        "org.codeaurora.intent.action.ESSENTIAL_RECORDS_LOADED";
 }
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiCarrierConfigHelper.java b/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiCarrierConfigHelper.java
index 132cee2..97d1008 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiCarrierConfigHelper.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiCarrierConfigHelper.java
@@ -44,6 +44,8 @@
 import java.util.List;
 import java.util.Map;
 
+import org.codeaurora.ims.QtiCallConstants;
+
 public class QtiCarrierConfigHelper {
     static final String TAG  = QtiCarrierConfigHelper.class.getSimpleName();
     private static final boolean DEBUG =
@@ -64,8 +66,9 @@
     private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
-            if (intent != null && intent.getAction()
-                    .equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
+            if (intent != null && (intent.getAction()
+                    .equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED) ||
+                    intent.getAction().equals(QtiCallConstants.ACTION_ESSENTIAL_RECORDS_LOADED))) {
                 int phoneId = intent.getIntExtra(CarrierConfigManager.EXTRA_SLOT_INDEX,
                         SubscriptionManager.INVALID_SIM_SLOT_INDEX);
                 if (mSubscriptionManager != null) {
@@ -150,6 +153,7 @@
         subCache = new int[PHONE_COUNT];
         IntentFilter filter = new IntentFilter(CarrierConfigManager
                 .ACTION_CARRIER_CONFIG_CHANGED);
+        filter.addAction(QtiCallConstants.ACTION_ESSENTIAL_RECORDS_LOADED);
         mContext.registerReceiver(mReceiver, filter);
         mSubscriptionManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
     }