summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2015-08-19 11:18:58 -0700
committerTyler Gunn <tgunn@google.com>2015-08-19 20:52:13 +0000
commit1e9bfc6461d3fe5455c9d7a21414ec66695b5798 (patch)
treebb559250279f3e5e0d35ecb8f8bc1d183a249b90 /telecomm
parent11e84bde9e98cb4b777a67208989d259883e9375 (diff)
downloadframeworks_base-1e9bfc6461d3fe5455c9d7a21414ec66695b5798.zip
frameworks_base-1e9bfc6461d3fe5455c9d7a21414ec66695b5798.tar.gz
frameworks_base-1e9bfc6461d3fe5455c9d7a21414ec66695b5798.tar.bz2
Fix incorrect android.telecom.Call.Details equality check.
The the android.telecom.Call.Details class provides its own equals implementation. Recently added in M is to also check if the mExtras and mIntentExtras are different. Unfortunately, Bundles do not implement equals. As a result when Telecom calls are parceled and sent to the InCallServices, this means that the internalUpdate method will always assume that the Details of a call have changed, even if they have not. This was causing a LOT of extra calls to onUpdate in the InCall UI (2x the amount). Although there is still room for improvement in the number of callbacks from Telecom, this fix prevents a pretty significant regression on that front. Bug: 23218195 Change-Id: I128e996faf60376ed3df1dc848a97c4a7b0482ee
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/Call.java32
1 files changed, 30 insertions, 2 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 4569549..0a1dbf6 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -512,8 +512,8 @@ public final class Call {
Objects.equals(mGatewayInfo, d.mGatewayInfo) &&
Objects.equals(mVideoState, d.mVideoState) &&
Objects.equals(mStatusHints, d.mStatusHints) &&
- Objects.equals(mExtras, d.mExtras) &&
- Objects.equals(mIntentExtras, d.mIntentExtras);
+ areBundlesEqual(mExtras, d.mExtras) &&
+ areBundlesEqual(mIntentExtras, d.mIntentExtras);
}
return false;
}
@@ -1245,4 +1245,32 @@ public final class Call {
});
}
}
+
+ /**
+ * Determines if two bundles are equal.
+ *
+ * @param bundle The original bundle.
+ * @param newBundle The bundle to compare with.
+ * @retrun {@code true} if the bundles are equal, {@code false} otherwise.
+ */
+ private static boolean areBundlesEqual(Bundle bundle, Bundle newBundle) {
+ if (bundle == null || newBundle == null) {
+ return bundle == newBundle;
+ }
+
+ if (bundle.size() != newBundle.size()) {
+ return false;
+ }
+
+ for(String key : bundle.keySet()) {
+ if (key != null) {
+ final Object value = bundle.get(key);
+ final Object newValue = newBundle.get(key);
+ if (!Objects.equals(value, newValue)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
}