Migrate off content providers and onto Room
Maintainers usually reply within 1 day
@psh is already working on this.
Since Mar 21, 2026.
Assessment
This issue has not been assessed yet.
Description
The app still has five content providers -
- CategoryContentProvider
fr.free.nrw.commons.category.CategoryContentProvider
- RecentSearchesContentProvider
fr.free.nrw.commons.explore.recentsearches.RecentSearchesContentProvider
- RecentLanguagesContentProvider
fr.free.nrw.commons.recentlanguages.RecentLanguagesContentProvider
- BookmarkPicturesContentProvider
fr.free.nrw.commons.bookmarks.pictures.BookmarkPicturesContentProvider
- BookmarkItemsContentProvider
fr.free.nrw.commons.bookmarks.items.BookmarkItemsContentProvider
These write to a different SQLite database file than room, so migration will me moving data from one database to the other when the time comes.
Step-by-step migration plan
Consistent code in content providers - extract the table definitions from the couple of content providers that still have them (Recent Languages and Content) so we can focus on the queries in subsequent steps.Move theDBOpenHelperto the more modernandroidx.sqlite.db.SupportSQLiteOpenHelperpointing at existing (legacy) database file. Content provider queries will need to update as theSupportSQLiteOpenHelperis slightly different.Create Room based entities and DAOs that match the queries in the content providersWrite tests using Room'sRoom.inMemoryDatabaseBuilder()to create tables with legacy code, and prove that room based entities can read from it, and vice-versa. This will let you write a test for step 5, demonstrating that the migration will work correctly.- Get an instance of
SupportSQLiteOpenHelperfrom a Room DB, letting content providers share the same database file as Room. Create a database migration that copies data from the old file to the Room database (sqlSELECTandINSERTstatements, pretty easy) - Swap references in the rest of the app from content provider queries to Room based entities now that we've proven they work and all the data lives in the same database. Ensure that we dont "leak" database entities out in other layers of the app.
- Delete content providers
Process
Do the work one-step at a time. Create an issue, have it assigned to you and in its description reference this as "parent" - this will link child issues and allow a one-stop-shop for measuring progress and avoid confusion -
parent: #6768
Similarly in your pull request when you complete the work -
closes: <your issue id>
relates to parent: #6768
Steps 3, 4 and 6 can be broken down per content provider to reduce the size of PR's.
- Dominant language
- Kotlin
- Stars
- 1.2k
- Forks
- 1.4k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 156
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from commons-app/apps-android-commons
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
commons-app/apps-android-commons#7486 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
commons-app/apps-android-commons#7464 · 2 comments ·
Maintainers usually reply within 1 day
-
[Bug]: Media detail page crashes on file pages with unclosed [[Category: markupPossibly taken @dkrrish9 claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
commons-app/apps-android-commons#7423 · 7 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
[Bug]: WikiSite treats the /w/ script path as a language variant, producing a bogus "w" language codePossibly taken @shryssssss-maker claimed this 4 days ago. Opendebated
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
commons-app/apps-android-commons#7422 · 4 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
test: unit tests for WikiSite (sub-issue of #6630)Possibly taken @Seyamalam claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
commons-app/apps-android-commons#7419 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in commons-app/apps-android-commons
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
carlrobertoh/ProxyAI#1250 ·
-
Location search keeps showing stale "Open-Meteo can't find ..." message after clearing search queryOpenBug Needs review
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
breezy-weather/breezy-weather#3082 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 76/100
wangzan101/Mika#1033 ·
Maintainers usually reply within 1 day
-
area: ci area: local-media area: startup area: ui platform: bilibili platform: netease platform: youtube status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
cwuom/NeriPlayer#794 ·
Maintainers usually reply within 1 day
-
area:android area:ui bug priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
meraxes89/streamify-apk#449 ·
Maintainers usually reply within 1 day