[Mobile] Create a child scope for mobile view models
MobileIconsViewModel was mistakenly using the @Application scope when instantiating the child view models that are passed out to the status bar. Instead, this change creates a child scope of the application scope and tracks it along in the reuse cache so that the child scopes can be properly canceled. There is a discussion to be had about the existing architecture, namely better ways that this problem could be fixed. We could find a different way to solve the duplicate log problem (i.e., remove the need for caching), remove the usage of `stateIn` for the view models, or find a better place to bind the models to a single scope while in use. All of these changes are potentially valid, though they would represent a larger change. For now, creating child scopes should solve the issue at hand. Test: MobileIconsViewModelTest Bug: 325198700 Flag: NONE Change-Id: I7f2c6a1644620d2e16fb1dc8ad986fa3c6e01bd4
Loading
Please register or sign in to comment