Support comparison of byte array values in areBundlesEqual

Currently, telecom framework will send tons of unnecessary
Call#onDetailsChanged to notify update between Call.Details
with same byte[] value. Since we didn't support the proper way to
compare these value, onDetailsChanged might be called multiple times
meaninglessly.

Bug: 232180843
Test: CallDetailsTest
Change-Id: I739412da62f303cb00dc84cb0a6d7773d0a0aeaa
This commit is contained in:
Grace Jia
2022-05-12 12:49:02 -07:00
parent 4220511d7e
commit 17005bdfb0

View File

@@ -2895,7 +2895,19 @@ public final class Call {
if (key != null) {
final Object value = bundle.get(key);
final Object newValue = newBundle.get(key);
if (!Objects.equals(value, newValue)) {
if (!newBundle.containsKey(key)) {
return false;
}
if (value instanceof Bundle && newValue instanceof Bundle) {
if (!areBundlesEqual((Bundle) value, (Bundle) newValue)) {
return false;
}
}
if (value instanceof byte[] && newValue instanceof byte[]) {
if (!Arrays.equals((byte[]) value, (byte[]) newValue)) {
return false;
}
} else if (!Objects.equals(value, newValue)) {
return false;
}
}