Skip to content
Commit 462062c9 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

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
parent 4827332e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment