Fix ConcurrentModificationException in FoldableDisplaySwitchTrackingInteractorTest
We're modifying callback list in UnfoldTransitionRepository while FakeUnfoldTransitionProvider is still iterating over them. This exception is only thrown when running Robolectric tests as Robolectric's ArrayList implementation differs from Android's one. While Android implementation will just stop iterating, Robolectric will continue and throw exception when trying to get `next()` element. Solution is to either not modify the list from within callback method or modify it safely and I went for the later with CopyOnWriteArrayList. Fixes: 412727194 Test: FoldableDisplaySwitchTrackingInteractorTest - on device and deviceless Flag: NONE just fixing test Change-Id: I59558cd6a74a3afbdfaa7b8549bbc7083ae9c87d
Loading
Please register or sign in to comment