Safely read carrier config.
There were problems reading carrier config from a secondary user (where
the com.android.phone process is empty) and also problems running a
second instance of CarrierConfigLoader. However, the secondary user can
talk to the main CarrierConfigLoader through the public API.
Bug: 21334821
Bug: 22108473
Change-Id: I127dbb8453d4bb24548cacdfb27ba44879ca4b33
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index 8569693..780f76b 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -201,8 +201,12 @@
mDialButton = findViewById(R.id.floating_action_button);
// Check whether we should show the onscreen "Dial" button and co.
- PersistableBundle carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId(
- SubscriptionManager.getDefaultVoiceSubId());
+ // Read carrier config through the public API because PhoneGlobals is not available when we
+ // run as a secondary user.
+ CarrierConfigManager configMgr =
+ (CarrierConfigManager) getSystemService(Context.CARRIER_CONFIG_SERVICE);
+ PersistableBundle carrierConfig =
+ configMgr.getConfigForSubId(SubscriptionManager.getDefaultVoiceSubId());
if (carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_ONSCREEN_DIAL_BUTTON_BOOL)) {
mDialButton.setOnClickListener(this);
} else {