-
Notifications
You must be signed in to change notification settings - Fork 304
[TV] Make the app a first-class media-session citizen #5740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,9 @@ package au.com.shiftyjelly.pocketcasts | |
| import android.app.Application | ||
| import androidx.hilt.work.HiltWorkerFactory | ||
| import androidx.work.Configuration | ||
| import au.com.shiftyjelly.pocketcasts.repositories.notification.NotificationHelper | ||
| import au.com.shiftyjelly.pocketcasts.repositories.playback.PlaybackManager | ||
| import au.com.shiftyjelly.pocketcasts.repositories.playback.PlaybackServiceToggle | ||
| import au.com.shiftyjelly.pocketcasts.utils.TimberDebugTree | ||
| import dagger.hilt.android.HiltAndroidApp | ||
| import javax.inject.Inject | ||
|
|
@@ -22,13 +24,17 @@ class TvApplication : | |
|
|
||
| @Inject lateinit var playbackManager: PlaybackManager | ||
|
|
||
| @Inject lateinit var notificationHelper: NotificationHelper | ||
|
|
||
| private val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.IO) | ||
|
|
||
| override fun onCreate() { | ||
| super.onCreate() | ||
| if (BuildConfig.DEBUG) { | ||
| Timber.plant(TimberDebugTree()) | ||
| } | ||
| notificationHelper.setupNotificationChannels() | ||
| PlaybackServiceToggle.ensureCorrectServiceEnabled(this) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
findProviderForFeature<FeatureProvider>(feature)?.isEnabled(feature) ?: feature.defaultValue
The good news is it's self-consistent: Two suggestions:
|
||
| // setup() subscribes the Up Next queue's sync pipeline itself, so there must be no | ||
| // separate UpNextQueue.setupBlocking() call on TV. | ||
| applicationScope.launch { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two notes on this permission block (neither blocking):
POST_NOTIFICATIONSis already contributed by a library manifest —modules/services/repositories/src/main/AndroidManifest.xmlline 5 declares it, so it merges into the TV APK regardless. Harmless to repeat it explicitly, just don't count on this line as the thing that fixed anything. Separately: nothing intv/srcrequests the runtime permission (nohasNotificationsPermission()/ request flow), so on API 33+ the playback foreground-service notification is posted but not displayed. That doesn't stop the FGS or the session — worth knowing before claiming the notification surface works.FOREGROUND_SERVICE_DATA_SYNC— the PR calls this out as out of scope, and I agree it's pre-existing, but note the gap is slightly sharper than "TV has no foreground-service permissions": the samerepositorieslibrary manifest merges inandroidx.work.impl.foreground.SystemForegroundServicewithandroid:foregroundServiceType="dataSync", so the TV APK declares a dataSync FGS with no matching permission. Reachable callers areDownloadEpisodeWorker(wrapssetForegroundAsync(...).get()in atry/catch→ degrades safely),FixDownloadsWorkerandOpmlImportTask(unguardedsetForeground(...)). TV doesn't trigger any of them today, so deferring is defensible — it's just a one-line addition if you'd rather close it here.