Skip to content

[Wishlist] File change observer #4

@nift4

Description

@nift4

The current state:

  • Android R+ is very good at telling us when a new file is added (even if currently pending-by-FUSE) and when files are deleted. I'm not yet sure how good it is at rescanning/notifying update if the app overwrites a file and doesn't say so, but I expect it to do well here. (It's less good at notifying about playlist changes, but that would be OK if it notifies for the file URI of the playlist, which I'm not sure about yet.)

  • Android Q and earlier depends entirely on cooperative apps. Which generally just doesn't happen. So we should use File NIO's WatchService, or FileObserver on legacy, to polyfill these ourselves. But then there is the problem that some apps do cooperate and the only way to know is to get the event from MediaStore - even though we may or may not be able to map the event (as it may happen by bulkInsert which triggers a change notification on the entire volume without details.....), so it's hard to do this backport properly. (Also, playlist URI notifications are good enough to work with but also not any better as they dont tell the affected URI for new or deleted entire playlists, only for member change. So this will need manual change tracking as well due to abstract playlists which is another big pain.)

Also, FileObserver is only good for legacy due to https://issuetracker.google.com/issues/37017033 which docs would need to warn about.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions