Android: Convert SyncProgramsJobService to Kotlin#14503
Android: Convert SyncProgramsJobService to Kotlin#14503Simonx22 wants to merge 1 commit intodolphin-emu:masterfrom
Conversation
JosJuice
left a comment
There was a problem hiding this comment.
Quite a lot changed in this PR for being a PR that converts to Kotlin. Was the threading solution changed because the old one didn't work, or just because the new one is preferable? Did you also consider coroutines as an option?
I'm not necessarily opposed to making these changes, but I'd like to know the reasoning.
| private const val COLUMN_SHORT_DESCRIPTION = "short_description" | ||
| private const val COLUMN_POSTER_ART_URI = "poster_art_uri" | ||
| private const val COLUMN_POSTER_ART_ASPECT_RATIO = "poster_art_aspect_ratio" | ||
| private const val COLUMN_INTENT_URI = "intent_uri" |
There was a problem hiding this comment.
It would be preferable to not hardcode these. Is there a problem with PreviewProgram.Builder?
There was a problem hiding this comment.
Is there a problem with
PreviewProgram.Builder?
Yes. PreviewProgram.Builder has a limitation here: the setter methods we need are restricted in androidx.tvprovider, so they cause restricted API errors.
To avoid hardcoding, I used public TV contract column constants (TvContractCompat.PreviewPrograms and framework TvContract.Programs) instead of hardcoded string values.
Changes: - Convert SyncProgramsJobService from Java to Kotlin. - Replace AsyncTask/executor lifecycle handling with coroutine-based job execution and cancellation. - Stop using restricted androidx.tvprovider builder APIs.
a7456ec to
dbeca0d
Compare
Yeah.. I originally intended this to be just a Kotlin conversion, but while working on it I noticed the problematic API calls and decided to clean those up too. I meant to update the PR description but forgot because I was busy dealing with the R8 issues.
Not initially, but I’ve implemented them now. |
Changes:
SyncProgramsJobServicefrom Java to Kotlin.