Fix the trailer intent so SmartTube can read the video id #61
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fm/tv-trailer-intent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Root cause
The trailer button launched SmartTube correctly but with a URI SmartTube cannot read the video id from.
TitleTrailer.kt:20builtIntent(ACTION_VIEW, Uri.parse("vnd.youtube:$video")), an opaque URI (no//), then pinned the resolved package withsetPackage.smarttubetv/src/main/AndroidManifest.xml:114-124:SplashActivity(exported) acceptsVIEWwith schemesvnd.youtubeandvnd.youtube.launch. That is why the activity resolves and launches.common/.../utils/IntentExtractor.java:39: the documented form isvnd.youtube://8kKDjRmHp0g. Line 65-66:else if (VND_SCHEME.equals(uri.getScheme())) { videoId = uri.getHost(); }.Uri.getHost()is null for an opaquevnd.youtube:ID, soisValid(line 173-175, length 11) fails andextractVideoIdreturns null.common/.../presenters/SplashPresenter.java:312-319: with no earlier processor matching, the last chain entry opens the default view and shows the toastCan't process intent: .... That is the notification Justin saw.org.smarttube.stable,org.smarttube.beta,app.smarttube,app.smarttube.fdroidinsmarttubetv/build.gradle) all share the same manifest, and Wolfskin takes the package fromqueryIntentActivitiesinstead of hardcoding one.Fix
vnd.youtube:$videobecomesvnd.youtube://$video(one line). Same scheme, so the existing<queries>entry, handler lookup, explicit package and no-browser-fallback behaviour are unchanged. The official YouTube app also accepts the authority form.Test
TitleTrailerTest(the launched-intent case) now registers and asserts the authority form: actionVIEW, explicit package, schemevnd.youtube, anddata.host == id(the value SmartTube reads). The id used isab_-defghij, so_and-are covered.docker/gradle.sh debug :app:testDefaultDebugUnitTest --tests ...TitleTrailerTest: 3 tests, 0 failures. Nothing else was run (slim test budget).Not verified on device
The TV box was not touched. One thing to check later on the box: tap the trailer button and confirm SmartTube plays the trailer instead of showing
Can't process intent.Delta review of the trailer PR at head
8be769b67c176dd07f8809deb03c8f74a79742bf.Code verdict: APPROVE (
review/code-claude= success).Design verdict: PASS (
review/design-claude= success). No blocking finding.What I checked:
TitleTrailer.kt:21:vnd.youtube:$video->vnd.youtube://$video. The scheme is the same. The handler lookup (queryIntentActivities,MATCH_DEFAULT_ONLY, first exported), the explicitsetPackage, the exception handling and the no-browser-fallback behaviour are untouched.<queries>entry inapp/src/default/AndroidManifest.xml:6is scheme-only, so it matches both URI forms. [INFERENCE from intent-filter matching rules]VIEW, explicit package, scheme anddata.host == "ab_-defghij", the value SmartTube reads. It would fail on the old opaque form. The id includes_and-. The other two trailer tests keep their intent.getHost()claim follows the PR's cited lines and matchesUrisemantics.Non-blocking notes:
android.net.Urikeeps the id's case and does not validate characters, so mixed-case ids and_/-survive./,?or#would now split into host and path. Real ids are 11 characters of[A-Za-z0-9_-], so no change is needed.Full report (delta reviews 3):
/root/.treehouse/firstmate-7bab20/2/firstmate/data/round2-review/report.md. Not run: Gradle/make, nothing on the box.Pull request closed