Merge "Implement checkCarrierPrivilegesForPackageAnyPhone" into mnc-dev
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 0578e0c..d3d9dcf 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -236,9 +236,7 @@
 
             int phoneType = mPhone.getPhoneType();
             Preference fdnButton = prefSet.findPreference(BUTTON_FDN_KEY);
-            boolean shouldHideCarrierSettings = Settings.Global.getInt(
-                    getContentResolver(), Settings.Global.HIDE_CARRIER_NETWORK_SETTINGS, 0) == 1;
-            if (shouldHideCarrierSettings) {
+            if (carrierConfig.getBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)) {
                 prefSet.removePreference(fdnButton);
             } else {
                 if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 66cce28..2cf5276 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -562,7 +562,7 @@
     }
 
     @Override
-    public void reloadCarrierConfigForSubId(int subId) {
+    public void notifyConfigChangedForSubId(int subId) {
         int phoneId = SubscriptionManager.getPhoneId(subId);
         if (!SubscriptionManager.isValidPhoneId(phoneId)) {
             log("Ignore invalid phoneId: " + phoneId + " for subId: " + subId);
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 8106ab6..96d00ae 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -541,10 +541,7 @@
                 PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
         mIsGlobalCdma = isLteOnCdma
                 && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
-        int shouldHideCarrierSettings = android.provider.Settings.Global.getInt(
-                mPhone.getContext().getContentResolver(),
-                android.provider.Settings.Global.HIDE_CARRIER_NETWORK_SETTINGS, 0);
-        if (shouldHideCarrierSettings == 1) {
+        if (carrierConfig.getBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)) {
             prefSet.removePreference(mButtonPreferredNetworkMode);
             prefSet.removePreference(mButtonEnabledNetworks);
             prefSet.removePreference(mLteDataServicePref);
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 500e173..b9e8a57 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -47,6 +47,7 @@
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
+import android.telephony.ModemActivityInfo;
 import android.text.TextUtils;
 import android.util.ArrayMap;
 import android.util.ArraySet;
@@ -129,6 +130,9 @@
     private static final int EVENT_SET_VOICEMAIL_NUMBER_DONE = 34;
     private static final int CMD_SET_NETWORK_SELECTION_MODE_AUTOMATIC = 35;
     private static final int EVENT_SET_NETWORK_SELECTION_MODE_AUTOMATIC_DONE = 36;
+    private static final int CMD_GET_MODEM_ACTIVITY_INFO = 37;
+    private static final int EVENT_GET_MODEM_ACTIVITY_INFO_DONE = 38;
+
 
     /** The singleton instance. */
     private static PhoneInterfaceManager sInstance;
@@ -643,6 +647,32 @@
                     handleNullReturnEvent(msg, "setNetworkSelectionModeAutomatic");
                     break;
 
+                case CMD_GET_MODEM_ACTIVITY_INFO:
+                    request = (MainThreadRequest) msg.obj;
+                    onCompleted = obtainMessage(EVENT_GET_MODEM_ACTIVITY_INFO_DONE, request);
+                    mPhone.queryModemActivityInfo(onCompleted);
+                    break;
+
+                case EVENT_GET_MODEM_ACTIVITY_INFO_DONE:
+                    ar = (AsyncResult) msg.obj;
+                    request = (MainThreadRequest) ar.userObj;
+                    if (ar.exception == null && ar.result != null) {
+                        request.result = ar.result;
+                    } else {
+                        if (ar.result == null) {
+                            loge("queryModemActivityInfo: Empty response");
+                        } else if (ar.exception instanceof CommandException) {
+                            loge("queryModemActivityInfo: CommandException: " +
+                                    ar.exception);
+                        } else {
+                            loge("queryModemActivityInfo: Unknown exception");
+                        }
+                    }
+                    synchronized (request) {
+                        request.notifyAll();
+                    }
+                    break;
+
                 default:
                     Log.w(LOG_TAG, "MainThreadHandler: unexpected message code: " + msg.what);
                     break;
@@ -2497,4 +2527,13 @@
             Binder.restoreCallingIdentity(identity);
         }
     }
+
+    /**
+     * {@hide}
+     * Returns the modem stats
+     */
+    @Override
+    public ModemActivityInfo getModemActivityInfo() {
+        return (ModemActivityInfo) sendRequest(CMD_GET_MODEM_ACTIVITY_INFO, null);
+    }
 }