Update ECBM system property early to reduce race condition window.
Update property before broadcasting ECBM intent.
Bug: 30237792
Change-Id: I787fd55cc9406d7f48b24797e29eb11413d6c0c0
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
index 2f33cba..09df6ad 100644
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
@@ -2679,10 +2679,10 @@
}
// if phone is not in Ecm mode, and it's changed to Ecm mode
if (mIsPhoneInEcmState == false) {
+ setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "true");
mIsPhoneInEcmState = true;
// notify change
sendEmergencyCallbackModeChange();
- setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "true");
// Post this runnable so we will automatically exit
// if no one invokes exitEmergencyCallbackMode() directly.
@@ -2709,15 +2709,16 @@
}
// if exiting ecm success
if (ar.exception == null) {
+ if (mIsPhoneInEcmState) {
+ setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "false");
+ mIsPhoneInEcmState = false;
+ }
+
// release wakeLock
if (mWakeLock.isHeld()) {
mWakeLock.release();
}
- if (mIsPhoneInEcmState) {
- mIsPhoneInEcmState = false;
- setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "false");
- }
// send an Intent
sendEmergencyCallbackModeChange();
// Re-initiate data connection
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
index 53eb44d..0cfe257 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
@@ -1305,10 +1305,10 @@
}
// if phone is not in Ecm mode, and it's changed to Ecm mode
if (mIsPhoneInEcmState == false) {
+ setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "true");
mIsPhoneInEcmState = true;
// notify change
sendEmergencyCallbackModeChange();
- setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "true");
// Post this runnable so we will automatically exit
// if no one invokes exitEmergencyCallbackMode() directly.
@@ -1325,6 +1325,12 @@
Rlog.d(LOG_TAG, "handleExitEmergencyCallbackMode: mIsPhoneInEcmState = "
+ mIsPhoneInEcmState);
}
+
+ if (mIsPhoneInEcmState) {
+ setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "false");
+ mIsPhoneInEcmState = false;
+ }
+
// Remove pending exit Ecm runnable, if any
removeCallbacks(mExitEcmRunnable);
@@ -1337,10 +1343,6 @@
mWakeLock.release();
}
- if (mIsPhoneInEcmState) {
- mIsPhoneInEcmState = false;
- setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "false");
- }
// send an Intent
sendEmergencyCallbackModeChange();
}