Skip to content

[BUG]: Back from player opens a duplicate channel page (extra Back to leave a channel) #24

Description

@CodeSculptor

Summary

When a video is opened from a channel page and the user presses Back to leave the player, a
second, fresh channel activity is launched on top of the existing one. The user then has to
press Back twice to leave the channel (the first Back dismisses the duplicate channel page, which
looks identical to the one beneath it).

Repro (on v0.4.2-beta.7+st31.94, device R3GL3069JMZ):

  1. Subscriptions → Channels → tap a channel (Channel page opens)
  2. Tap a video in that channel (player opens, plays)
  3. Back → returns to the channel page ✓
  4. Back → shows the same channel page again (the duplicate) ✗ — expected to return to the Channels list
  5. Back → returns to the Channels list

Root cause

MobilePlaybackActivity.onBackPressed() (the #23 fix) calls finishReally(). The inherited
LeanbackActivity.finishReally() calls getViewManager().startParentView(this) before finishing
(smarttubetv/src/main/.../tv/ui/common/LeanbackActivity.java:131). startParentView
(common/.../app/views/ViewManager.java:132) launches the parent (channel) via a plain
new Intent(activity, MobileChannelActivity). MobileChannelActivity is launchMode=singleTop,
which only reuses an instance that is already at the top of the task — but the original channel
sits beneath the player (in a separate task), so a new MobileChannelActivity is created.

Activity trace confirming the second channel launch on Back:

START ... MobileChannelActivity   (tap channel)
START ... MobilePlaybackActivity  (tap video)
START ... MobileChannelActivity   (~Back from player — the duplicate)

Every finish() / finishReally() branch except the bare super.finish() calls
startParentView, so there is no trivial stmobile-only one-liner.

Notes

Fix options (to scope)

  1. Shared (clean, but mergeability cost): make ViewManager.startParentView reuse an existing
    parent instance (e.g. moveTaskToFront / FLAG_ACTIVITY_REORDER_TO_FRONT/CLEAR_TOP) instead
    of always starting a new one. Touches common → weigh upstream-merge impact.
  2. stmobile-only workaround: have MobilePlaybackActivity.onBackPressed stop playback and
    finishAndRemoveTask() directly (bypassing startParentView) so the player's task is removed
    and the system returns to the channel's task; or give MobileChannelActivity a singleTask
    launch mode. Both risk regressing [BUG]: Player <-> channel Back loop with lingering audio #23's PIP / background-audio paths and need device testing.

Deferred from the beta.7 release (shipped as-is; beta.7 is strictly better than beta.6).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions