Android 11 seems to have killed the ability to use a LIMIT clause, introduced in VERSION_CODES.O, in the order argument of a ContentProvider query.
This PR changes the query to use a Bundle when the version code is >= VERSION_CODES.O. It also changes the sorting order to use DATE_TAKEN if available, or DATE_MODIFIED otherwise.
Target and Build versions have been set to 30.
Extracted the code to generate the recent images cursor and added some baseline tests
Reviewers
@baz8080 @schlan @e2po @bridgeri127 @fibelatti
References
None
Risks
Moderate - code has been added to change behaviour depending on Android versions. Tested locally on Android 11 beta 3, have not tested Android 10 yet.
Android and Kotlin are rusty so definitely welcome suggestions!
Changes
Android 11 seems to have killed the ability to use a
LIMIT
clause, introduced inVERSION_CODES.O
, in the order argument of aContentProvider
query.This PR changes the query to use a
Bundle
when the version code is >=VERSION_CODES.O
. It also changes the sorting order to useDATE_TAKEN
if available, orDATE_MODIFIED
otherwise.Target and Build versions have been set to 30.
Extracted the code to generate the recent images cursor and added some baseline tests
Reviewers
@baz8080 @schlan @e2po @bridgeri127 @fibelatti
References
Risks