Only notify listeners if device Id changed

Bug: 265262866
Test: atest DeviceAssociationTest
Change-Id: I9bc58ca3c36f1b3f82b63a1d88ea1b50a35da0e1
This commit is contained in:
Marco Loaiza
2023-01-12 11:09:47 +00:00
parent 6529d77f37
commit e45ccc9216

View File

@@ -3053,8 +3053,11 @@ class ContextImpl extends Context {
throw new UnsupportedOperationException(
"Cannot update device ID on a Context created with createDeviceContext()");
}
mDeviceId = updatedDeviceId;
notifyOnDeviceChangedListeners(updatedDeviceId);
if (mDeviceId != updatedDeviceId) {
mDeviceId = updatedDeviceId;
notifyOnDeviceChangedListeners(updatedDeviceId);
}
}
@Override