Selectively delay ContentObservers based on state.
While optimizing MediaProvider operations, we noticed that many background apps register ContentObservers which end up stampeding after any change is notified. This can starve the device of precious CPU/RAM needed while a Camera app is still trying to persist heavy operations such as a burst capture. The initial mitigation was to simply delay all notifications while a camera session was active, but OEMs have informed us that in a multi-window environment it's important that foreground apps not be subject to these delays. Thus, to strike a balance, this change moves the delaying logic into ContentService, where we only dispatch immediate notifications to foreground apps. Background apps will still hear about the changes, but they'll be delayed several seconds to avoid the stampeding described above. Bug: 140249142 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: I0bffc49c116eef35c5bc4e1b24745e8e9e0974d6
Loading
Please register or sign in to comment