Set max wait time if setVoicemailNumber is stuck
In some rare cases, Google can be in the middle of a
switch that happens right after the phone boots. Then
at the same time, ongoing configuration changes that
require interaction with the SIM can get stuck until
the RIL request times out. In order to limit the amount
of time that the binder thread blocks, set a hard
deadline of 2 seconds. The potential side effect would
be that an extremely slow SIM card access might result
in a false negative response, but this should not happen
in practice. If it does, still preferable to avoid the
ANR.
Bug: 29190397
Test: es posible
Flag: EXEMPT bugfix
Change-Id: Idd3ebf510f9422e3dfbdb308fafa4756c0b7c17e
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2779bdb..b3bd131 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -471,7 +471,7 @@
public static final String RESET_NETWORK_ERASE_MODEM_CONFIG_ENABLED =
"reset_network_erase_modem_config_enabled";
- private static final int SET_NETWORK_SELECTION_MODE_AUTOMATIC_TIMEOUT_MS = 2000; // 2 seconds
+ private static final int BLOCKING_REQUEST_DEFAULT_TIMEOUT_MS = 2000; // 2 seconds
private static final int MODEM_ACTIVITY_TIME_OFFSET_CORRECTION_MS = 50;
@@ -4189,8 +4189,12 @@
final long identity = Binder.clearCallingIdentity();
try {
- Boolean success = (Boolean) sendRequest(CMD_SET_VOICEMAIL_NUMBER,
- new Pair<String, String>(alphaTag, number), new Integer(subId));
+ Boolean success = (Boolean) sendRequest(
+ CMD_SET_VOICEMAIL_NUMBER,
+ new Pair<String, String>(alphaTag, number),
+ new Integer(subId),
+ BLOCKING_REQUEST_DEFAULT_TIMEOUT_MS);
+ if (success == null) return false; // most likely due to a timeout
return success;
} finally {
Binder.restoreCallingIdentity(identity);
@@ -6750,7 +6754,7 @@
}
if (DBG) log("setNetworkSelectionModeAutomatic: subId " + subId);
sendRequest(CMD_SET_NETWORK_SELECTION_MODE_AUTOMATIC, null, subId,
- SET_NETWORK_SELECTION_MODE_AUTOMATIC_TIMEOUT_MS);
+ BLOCKING_REQUEST_DEFAULT_TIMEOUT_MS);
} finally {
Binder.restoreCallingIdentity(identity);
}