summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui/Call.java
diff options
context:
space:
mode:
authorTa-wei Yen <twyen@google.com>2016-01-08 20:41:04 +0000
committerTa-wei Yen <twyen@google.com>2016-01-08 20:41:04 +0000
commit211d8616c2efcbb7a252cced6d28b359f9a2f2ff (patch)
treec732fd3a8280dd05a064948578f9bde546ab807c /InCallUI/src/com/android/incallui/Call.java
parente7df20972b910d168bab043e08a34f83ef89d22d (diff)
Revert "Workaround for java.lang.IllegalArgumentException in android.util.ArrayMap"
This reverts commit b1d3cff91f5fc15c7f75c9bef8928101d7bb33d5. Change-Id: Ie3b063f24ff27d3b79b40dd3f1d069d2023f5ef2
Diffstat (limited to 'InCallUI/src/com/android/incallui/Call.java')
-rw-r--r--InCallUI/src/com/android/incallui/Call.java112
1 files changed, 41 insertions, 71 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index 6becb4450..d82346ebb 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -552,7 +552,47 @@ public class Call {
// maximum number of conferenced child calls as the metric for conference call usage.
mLogState.conferencedCalls = Math.max(numChildCalls, mLogState.conferencedCalls);
- updateFromCallExtras(mTelecomCall.getDetails().getExtras());
+ Bundle callExtras = mTelecomCall.getDetails().getExtras();
+ if (callExtras != null) {
+ // Child address arrives when the call is first set up, so we do not need to notify the
+ // UI of this.
+ if (callExtras.containsKey(Connection.EXTRA_CHILD_ADDRESS)) {
+ String childNumber = callExtras.getString(Connection.EXTRA_CHILD_ADDRESS);
+ if (!Objects.equals(childNumber, mChildNumber)) {
+ mChildNumber = childNumber;
+ }
+ }
+
+ // 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;
+ }
+ }
+ }
// If the handle of the call has changed, update state for the call determining if it is an
// emergency call.
@@ -581,76 +621,6 @@ 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;
- }
-
- if (callExtras.containsKey(Connection.EXTRA_CHILD_ADDRESS)) {
- String childNumber = callExtras.getString(Connection.EXTRA_CHILD_ADDRESS);
- if (!Objects.equals(childNumber, mChildNumber)) {
- mChildNumber = childNumber;
- }
- }
-
- // 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;
- }
- }
- }
-
- /**
* Determines if a received upgrade to video request should be cancelled. This can happen if
* another InCall UI responds to the upgrade to video request.
*