Do not read ECBM system property to avoid race.
Code does a sanity check to make sure ECBM mode is active before
showing notification. However checking system property for that is
not safe as the property may not have been updated. Query the phone
instead.
Bug: 30237792
Change-Id: If650121391f2effccb9461c13d34f49f5bbe70c2
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index ca25653..9ed38ae 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -171,8 +171,8 @@
* Shows notification for Emergency Callback Mode
*/
private void showNotification(long millisUntilFinished) {
- final boolean isInEcm = Boolean.parseBoolean(
- SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE));
+ Phone imsPhone = mPhone.getImsPhone();
+ boolean isInEcm = mPhone.isInEcm() || (imsPhone != null && imsPhone.isInEcm());
if (!isInEcm) {
Log.i(LOG_TAG, "Asked to show notification but not in ECM mode");
if (mTimer != null) {