[Auto-PiP] Add auto-PiP permission prompt logic to Android DocPiP [chromium/src : main]

0 views
Skip to first unread message

Phil Yan (Gerrit)

unread,
Dec 5, 2025, 3:01:50 AM (2 days ago) Dec 5
to Tommy Steimel, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
Attention needed from Frank Liberato and Tommy Steimel

Phil Yan voted Commit-Queue+0

Commit-Queue+0
Open in Gerrit

Related details

Attention is currently required from:
  • Frank Liberato
  • Tommy Steimel
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id756a7541731187183f7c43c1a8a96fa35d9b078
Gerrit-Change-Number: 7230700
Gerrit-PatchSet: 5
Gerrit-Owner: Phil Yan <phi...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Phil Yan <phi...@chromium.org>
Gerrit-Reviewer: Tommy Steimel <ste...@chromium.org>
Gerrit-Attention: Tommy Steimel <ste...@chromium.org>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Comment-Date: Fri, 05 Dec 2025 08:01:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Frank Liberato (Gerrit)

unread,
Dec 5, 2025, 11:37:09 AM (2 days ago) Dec 5
to Phil Yan, Tommy Steimel, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
Attention needed from Phil Yan and Tommy Steimel

Frank Liberato added 3 comments

File chrome/android/java/src/org/chromium/chrome/browser/media/DocumentPictureInPictureActivity.java
Line 114, Patchset 5 (Latest): AutoPictureInPicturePermissionController.clearAutoPipTriggered(webContents);
Frank Liberato . unresolved

why is it clearing the triggered flag? if this doc pip window is being created in response to an autopip signal, shouldn't it remain set for the lifetime of the window?

as an aside, the state management feels a little fragile. i'm not sure why - i haven't diagrammed it all out but multiple calls into set / clear the state from here and elsewhere makes me wonder. maybe it's okay, but it's hard to tell.

File chrome/android/junit/src/org/chromium/chrome/browser/media/AutoPictureInPicturePermissionControllerTest.java
Line 201, Patchset 5 (Latest): @Test
Frank Liberato . resolved

i notice that you're an owner of other files in this directory but not this one -- is it because it's a new file, or OWNERS has a weird pattern?

File chrome/browser/picture_in_picture/auto_picture_in_picture_tab_helper.cc
Line 98, Patchset 5 (Latest): picture_in_picture::AutoPictureInPicturePermissionControllerBridge::
Frank Liberato . unresolved

nit: you might want AutoPicture...Bridge::OnPrimaryPageChanged and let that java side sort out the details.

Open in Gerrit

Related details

Attention is currently required from:
  • Phil Yan
  • Tommy Steimel
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id756a7541731187183f7c43c1a8a96fa35d9b078
    Gerrit-Change-Number: 7230700
    Gerrit-PatchSet: 5
    Gerrit-Owner: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-Reviewer: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Tommy Steimel <ste...@chromium.org>
    Gerrit-Attention: Tommy Steimel <ste...@chromium.org>
    Gerrit-Attention: Phil Yan <phi...@chromium.org>
    Gerrit-Comment-Date: Fri, 05 Dec 2025 16:36:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Phil Yan (Gerrit)

    unread,
    Dec 5, 2025, 2:27:31 PM (2 days ago) Dec 5
    to Tommy Steimel, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Frank Liberato and Tommy Steimel

    Phil Yan added 3 comments

    File chrome/android/java/src/org/chromium/chrome/browser/media/DocumentPictureInPictureActivity.java
    Line 114, Patchset 5: AutoPictureInPicturePermissionController.clearAutoPipTriggered(webContents);
    Frank Liberato . resolved

    why is it clearing the triggered flag? if this doc pip window is being created in response to an autopip signal, shouldn't it remain set for the lifetime of the window?

    as an aside, the state management feels a little fragile. i'm not sure why - i haven't diagrammed it all out but multiple calls into set / clear the state from here and elsewhere makes me wonder. maybe it's okay, but it's hard to tell.

    Phil Yan

    The reasoning for clearing the flag here is to avoid showing the prompt for manually triggered PiP.

    However, after double checking `auto_picture_in_picture_tab_helper.cc`, I realized that I previously missed the existing `AreAutoPictureInPicturePreconditionsMet()` which serves the **exact same** purpose as the new triggered flag. It's still true that we cannot directly rely on `IsInAutoPictureInPicture()`, which is set to true only *after* pip is created, because the prompt view is added to the activity during the pip initialization process. But we can use `AreAutoPictureInPicturePreconditionsMet()`(exposed via JNI) here and let the native side handle its lifecycle instead of reinventing the wheel.

    To lean on the cautious side, in the new `isAutoPictureInPictureInUse` JNI method I just added, I checked `tab_helper->AreAutoPictureInPicturePreconditionsMet() || tab_helper->IsInAutoPictureInPicture()` to keep in consistency with the implementation in `auto_picture_in_picture_tab_helper.cc` although I think `IsInAutoPictureInPicture()` should always be false at the time the doc pip activity checks for it in `initializeCompositor`.

    File chrome/android/junit/src/org/chromium/chrome/browser/media/AutoPictureInPicturePermissionControllerTest.java
    Line 201, Patchset 5: @Test
    Frank Liberato . unresolved

    i notice that you're an owner of other files in this directory but not this one -- is it because it's a new file, or OWNERS has a weird pattern?

    Phil Yan

    Looks like it's because the owner file is ultimately mapped to media/OWNERS which I'm not part of. I'm currently in chrome/browser/picture_in_picture/OWNERS.

    chrome/android/junit/src/org/chromium/chrome/browser/media/OWNERS ->
    components/browser_ui/media/OWNERS ->
    media/OWNERS.

    Do you think it's okay to add me or picture_in_picture/OWNERS in one of these layers?

    File chrome/browser/picture_in_picture/auto_picture_in_picture_tab_helper.cc
    Line 98, Patchset 5: picture_in_picture::AutoPictureInPicturePermissionControllerBridge::
    Frank Liberato . resolved

    nit: you might want AutoPicture...Bridge::OnPrimaryPageChanged and let that java side sort out the details.

    Phil Yan

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Frank Liberato
    • Tommy Steimel
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id756a7541731187183f7c43c1a8a96fa35d9b078
    Gerrit-Change-Number: 7230700
    Gerrit-PatchSet: 6
    Gerrit-Owner: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-Reviewer: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Tommy Steimel <ste...@chromium.org>
    Gerrit-Attention: Tommy Steimel <ste...@chromium.org>
    Gerrit-Attention: Frank Liberato <libe...@chromium.org>
    Gerrit-Comment-Date: Fri, 05 Dec 2025 19:27:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Frank Liberato <libe...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Frank Liberato (Gerrit)

    unread,
    Dec 5, 2025, 2:31:03 PM (2 days ago) Dec 5
    to Phil Yan, Tommy Steimel, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Phil Yan and Tommy Steimel

    Frank Liberato voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Phil Yan
    • Tommy Steimel
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id756a7541731187183f7c43c1a8a96fa35d9b078
    Gerrit-Change-Number: 7230700
    Gerrit-PatchSet: 6
    Gerrit-Owner: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-Reviewer: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Tommy Steimel <ste...@chromium.org>
    Gerrit-Attention: Tommy Steimel <ste...@chromium.org>
    Gerrit-Attention: Phil Yan <phi...@chromium.org>
    Gerrit-Comment-Date: Fri, 05 Dec 2025 19:30:51 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Tommy Steimel (Gerrit)

    unread,
    Dec 5, 2025, 4:49:10 PM (2 days ago) Dec 5
    to Phil Yan, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Phil Yan

    Tommy Steimel added 1 comment

    File chrome/browser/picture_in_picture/auto_picture_in_picture_permission_controller_bridge.h
    Line 20, Patchset 6 (Latest): static void OnPrimaryPageChanged(content::WebContents& web_contents);
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Phil Yan
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id756a7541731187183f7c43c1a8a96fa35d9b078
    Gerrit-Change-Number: 7230700
    Gerrit-PatchSet: 6
    Gerrit-Owner: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-Reviewer: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Tommy Steimel <ste...@chromium.org>
    Gerrit-Attention: Phil Yan <phi...@chromium.org>
    Gerrit-Comment-Date: Fri, 05 Dec 2025 21:49:00 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Phil Yan (Gerrit)

    unread,
    Dec 5, 2025, 7:21:51 PM (2 days ago) Dec 5
    to Tommy Steimel, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Frank Liberato and Tommy Steimel

    Phil Yan added 2 comments

    File chrome/android/junit/src/org/chromium/chrome/browser/media/AutoPictureInPicturePermissionControllerTest.java
    Frank Liberato . resolved

    i notice that you're an owner of other files in this directory but not this one -- is it because it's a new file, or OWNERS has a weird pattern?

    Phil Yan

    Looks like it's because the owner file is ultimately mapped to media/OWNERS which I'm not part of. I'm currently in chrome/browser/picture_in_picture/OWNERS.

    chrome/android/junit/src/org/chromium/chrome/browser/media/OWNERS ->
    components/browser_ui/media/OWNERS ->
    media/OWNERS.

    Do you think it's okay to add me or picture_in_picture/OWNERS in one of these layers?

    Phil Yan

    Updated chrome/android/junit/src/org/chromium/chrome/browser/media/OWNERS to include `per-file *PictureInPicture*.java=file://chrome/browser/picture_in_picture/OWNERS`

    File chrome/browser/picture_in_picture/auto_picture_in_picture_permission_controller_bridge.h
    Line 20, Patchset 6: static void OnPrimaryPageChanged(content::WebContents& web_contents);
    Tommy Steimel . resolved
    Phil Yan

    Good point! Done.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Frank Liberato
    • Tommy Steimel
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id756a7541731187183f7c43c1a8a96fa35d9b078
    Gerrit-Change-Number: 7230700
    Gerrit-PatchSet: 8
    Gerrit-Owner: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
    Gerrit-Reviewer: Phil Yan <phi...@chromium.org>
    Gerrit-Reviewer: Tommy Steimel <ste...@chromium.org>
    Gerrit-Attention: Tommy Steimel <ste...@chromium.org>
    Gerrit-Attention: Frank Liberato <libe...@chromium.org>
    Gerrit-Comment-Date: Sat, 06 Dec 2025 00:21:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Tommy Steimel <ste...@chromium.org>
    Comment-In-Reply-To: Frank Liberato <libe...@chromium.org>
    Comment-In-Reply-To: Phil Yan <phi...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Tommy Steimel (Gerrit)

    unread,
    Dec 5, 2025, 7:44:59 PM (2 days ago) Dec 5
    to Phil Yan, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Frank Liberato and Phil Yan

    Tommy Steimel voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Frank Liberato
    • Phil Yan
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Id756a7541731187183f7c43c1a8a96fa35d9b078
      Gerrit-Change-Number: 7230700
      Gerrit-PatchSet: 8
      Gerrit-Owner: Phil Yan <phi...@chromium.org>
      Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
      Gerrit-Reviewer: Phil Yan <phi...@chromium.org>
      Gerrit-Reviewer: Tommy Steimel <ste...@chromium.org>
      Gerrit-Attention: Frank Liberato <libe...@chromium.org>
      Gerrit-Attention: Phil Yan <phi...@chromium.org>
      Gerrit-Comment-Date: Sat, 06 Dec 2025 00:44:43 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages