summaryrefslogtreecommitdiff
path: root/src/com/android/incallui/Call.java
diff options
context:
space:
mode:
authorTa-wei Yen <twyen@google.com>2016-01-08 14:40:06 -0800
committerTyler Gunn <tgunn@google.com>2016-01-11 15:55:57 -0800
commita94a1179714f6a79a6d9d7ae542458b8e6d742e7 (patch)
tree35e814122f7f961be5b685af8dcb4ecd3920ae94 /src/com/android/incallui/Call.java
parent758739a7d9daa296262079bf802e0a2f41dbe1b4 (diff)
downloadInCallUI-a94a1179714f6a79a6d9d7ae542458b8e6d742e7.tar.gz
b/25613098 sometimes corrupt the bundle, resulting in a IllegalArgumentException while validating. Workaround with abandoning all the information in it. The bypassed code only tries to extract data from the bundle, which can already be null. These are not critical for the dialer to function. Bug:26343012 Bug:25613098 Change-Id: I16b05ecb0e5317f7170d80eb8426b5cdce20f6c2
Diffstat (limited to 'src/com/android/incallui/Call.java')
-rw-r--r--src/com/android/incallui/Call.java114
1 files changed, 72 insertions, 42 deletions
diff --git a/src/com/android/incallui/Call.java b/src/com/android/incallui/Call.java
index 16a53b29..b768cdd1 100644
--- a/src/com/android/incallui/Call.java
+++ b/src/com/android/incallui/Call.java
@@ -332,48 +332,7 @@ public class Call {
mTelecommCall.getChildren().get(i)).getId());
}
- Bundle callExtras = mTelecommCall.getDetails().getExtras();
- if (callExtras != null) {
- // Check for a change in the child address and notify any listeners.
- if (callExtras.containsKey(Connection.EXTRA_CHILD_ADDRESS)) {
- String childNumber = callExtras.getString(Connection.EXTRA_CHILD_ADDRESS);
-
- if (!Objects.equals(childNumber, mChildNumber)) {
- mChildNumber = childNumber;
- CallList.getInstance().onChildNumberChange(this);
- }
- }
-
- // Last forwarded number comes in as an array of strings. We want to choose the last
- // item in the array. The forwarding numbers arrive independently of when the call is
- // originally set up, so we need to notify the the UI of the change.
- if (callExtras.containsKey(Connection.EXTRA_LAST_FORWARDED_NUMBER)) {
- ArrayList<String> lastForwardedNumbers =
- callExtras.getStringArrayList(Connection.EXTRA_LAST_FORWARDED_NUMBER);
-
- if (lastForwardedNumbers != null) {
- String lastForwardedNumber = null;
- if (!lastForwardedNumbers.isEmpty()) {
- lastForwardedNumber = lastForwardedNumbers.get(
- lastForwardedNumbers.size() - 1);
- }
-
- if (!Objects.equals(lastForwardedNumber, mLastForwardedNumber)) {
- mLastForwardedNumber = lastForwardedNumber;
- CallList.getInstance().onLastForwardedNumberChange(this);
- }
- }
- }
-
- // Call subject is present in the extras at the start of call, so we do not need to
- // notify any other listeners of this.
- if (callExtras.containsKey(Connection.EXTRA_CALL_SUBJECT)) {
- String callSubject = callExtras.getString(Connection.EXTRA_CALL_SUBJECT);
- if (!Objects.equals(mCallSubject, callSubject)) {
- mCallSubject = callSubject;
- }
- }
- }
+ updateFromCallExtras(mTelecommCall.getDetails().getExtras());
// If the handle of the call has changed, update state for the call determining if it is an
// emergency call.
@@ -400,6 +359,77 @@ public class Call {
}
}
+ /**
+ * Tests corruption of the {@code callExtras} bundle by calling {@link
+ * Bundle#containsKey(String)}. If the bundle is corrupted a {@link IllegalArgumentException}
+ * will be thrown and caught by this function.
+ *
+ * @param callExtras the bundle to verify
+ * @returns {@code true} if the bundle is corrupted, {@code false} otherwise.
+ */
+ protected boolean areCallExtrasCorrupted(Bundle callExtras) {
+ /**
+ * There's currently a bug in Telephony service (b/25613098) that could corrupt the
+ * extras bundle, resulting in a IllegalArgumentException while validating data under
+ * {@link Bundle#containsKey(String)}.
+ */
+ try {
+ callExtras.containsKey(Connection.EXTRA_CHILD_ADDRESS);
+ return false;
+ } catch (IllegalArgumentException e) {
+ Log.e(this, "CallExtras is corrupted, ignoring exception", e);
+ return true;
+ }
+ }
+
+ protected void updateFromCallExtras(Bundle callExtras) {
+ if (callExtras == null || areCallExtrasCorrupted(callExtras)) {
+ /**
+ * If the bundle is corrupted, abandon information update as a work around. These are
+ * not critical for the dialer to function.
+ */
+ return;
+ }
+ // Check for a change in the child address and notify any listeners.
+ if (callExtras.containsKey(Connection.EXTRA_CHILD_ADDRESS)) {
+ String childNumber = callExtras.getString(Connection.EXTRA_CHILD_ADDRESS);
+ if (!Objects.equals(childNumber, mChildNumber)) {
+ mChildNumber = childNumber;
+ CallList.getInstance().onChildNumberChange(this);
+ }
+ }
+
+ // Last forwarded number comes in as an array of strings. We want to choose the
+ // last item in the array. The forwarding numbers arrive independently of when the
+ // call is originally set up, so we need to notify the the UI of the change.
+ if (callExtras.containsKey(Connection.EXTRA_LAST_FORWARDED_NUMBER)) {
+ ArrayList<String> lastForwardedNumbers =
+ callExtras.getStringArrayList(Connection.EXTRA_LAST_FORWARDED_NUMBER);
+
+ if (lastForwardedNumbers != null) {
+ String lastForwardedNumber = null;
+ if (!lastForwardedNumbers.isEmpty()) {
+ lastForwardedNumber = lastForwardedNumbers.get(
+ lastForwardedNumbers.size() - 1);
+ }
+
+ if (!Objects.equals(lastForwardedNumber, mLastForwardedNumber)) {
+ mLastForwardedNumber = lastForwardedNumber;
+ CallList.getInstance().onLastForwardedNumberChange(this);
+ }
+ }
+ }
+
+ // Call subject is present in the extras at the start of call, so we do not need to
+ // notify any other listeners of this.
+ if (callExtras.containsKey(Connection.EXTRA_CALL_SUBJECT)) {
+ String callSubject = callExtras.getString(Connection.EXTRA_CALL_SUBJECT);
+ if (!Objects.equals(mCallSubject, callSubject)) {
+ mCallSubject = callSubject;
+ }
+ }
+ }
+
private static int translateState(int state) {
switch (state) {
case android.telecom.Call.STATE_NEW: