notifyChildrenChanged - mark which children changed so that browsers can reload specific items only
Open
@tonihei is already working on this.
Since Feb 6, 2026.
enhancement
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
Hello,
MediaBrowserServiceCompat has notifyChildrenChanged takes a bundle that can be used to specify the page that the changed children belongs to.
fun notifySpecificPageChanged(parentId: String, page: Int, pageSize: Int) {
val options = Bundle().apply {
putInt(MediaBrowserCompat.EXTRA_PAGE, page)
putInt(MediaBrowserCompat.EXTRA_PAGE_SIZE, pageSize)
}
notifyChildrenChanged(parentId, options)
}
This bundle is used in MediaBrowserCompatUtils.hasDuplicatedItems to decide when not to notify based on active subscribed page from connected browsers.
void notifyChildrenChangedForCompatOnHandler(
ConnectionRecord connection, String parentId, @Nullable Bundle options) {
List<Pair<@NullableType IBinder, @NullableType Bundle>> callbackList =
connection.subscriptions.get(parentId);
if (callbackList != null) {
for (Pair<@NullableType IBinder, @NullableType Bundle> callback : callbackList) {
if (MediaBrowserCompatUtils.hasDuplicatedItems(options, callback.second)) {
performLoadChildren(parentId, connection, callback.second, options);
}
}
}
}
However, it is possible that multiple clients could have used different page configurations. How to notify only the applicable ones? Does the library have any support or does MediaBrowserServiceCompat have to track and notify accordingly?
notifyChildrenChanged() EXTRA_PAGE (0) and EXTRA_PAGE_SIZE (100)
┌─────────────────────────────────┐
│ SERVICE │
│ │
│ Data: [0, 1, 2, ... 999] │
│ │
│ ⚡ Item 75 changed │
│ │
│ │
└───────────┬─────────────────────┘
│
┌─────────────────┼─────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ BROWSER A │ │ BROWSER B │ │ BROWSER C │
│ │ │ │ │ │
│ Page: 0 │ │ Page: 0 │ │ Page: 0 │
│ Size: 100 │ │ Size: 50 │ │ Size: 200 │
│ │ │ │ │ │
│ Subscribed to: │ │ Subscribed to: │ │ Subscribed to: │
│ items [0-99] │ │ items [0-49] │ │ items [0-199] │
│ │ │ │ │ │
└──────────────────┘ └──────────────────┘ └──────────────────┘
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.