Closed Bug 1980721 Opened 1 year ago Closed 1 year ago

Make appstate.mode consistent when switching between app and custom tab

Categories

(Firefox for Android :: Privacy, enhancement)

All
Android
enhancement

Tracking

()

VERIFIED FIXED
143 Branch
Tracking Status
firefox143 --- verified

People

(Reporter: mavduevskiy, Assigned: mavduevskiy)

References

Details

(Whiteboard: [fxdroid])

Attachments

(2 files)

DefaultBrowsingModeManager and AppState keep track of the browsing mode. While AppSate has a lifecope of application, the manager is tied to an activity, which creates an opportunity for them to go async. For example, if we are in private mode while in the app, and open a custom tab that is in normal mode, the custom tab will update the AppState, and when switching back to the app, it's manager will think that it's in private mode, but the appstate carries on the update from the custom tab.

Assignee: nobody → mavduevskiy
Whiteboard: [fxdroid]

appstate.mode is updated by DefaultBrowsingModeManager during init phase; so that a custom tab is able to rewrite the mode set by the application. Managers calculate mode based on intent correctly, the missing peace was to update the appstate as well.

This reverts commit 824b3b8f3aefd97b803581beaaa7e10060b3978f.

The Bugbug bot thinks this bug should belong to the 'Firefox for Android::Privacy' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: General → Privacy
Pushed by anpopa@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b5d91d374d45 https://hg.mozilla.org/integration/autoland/rev/f5fde9ae177f Part 1: Update appstate.mode on app restart r=android-reviewers,rebecatudor273,anpopa https://github.com/mozilla-firefox/firefox/commit/29e0a6ae4294 https://hg.mozilla.org/integration/autoland/rev/32512583142d Part 2: Revert "Bug 1971361 - Fix PBM lock feature for custom tabs." r=android-reviewers,rebecatudor273,anpopa
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch

For QA team:

There are 4 scenarios that need to be tested for this ticket:

Scenario 1:

  1. In Setting -> Private browsing -> enable "Use screen lock to hide tabs in private browsing.
  2. In Settings -> Set Firefox as the default browser to open the custom tabs in Firefox.
  3. Open a private browsing tab and visit some site in that tab, e.g. https://example.org .
  4. Switch to another app that can launch custom-tabs, e.g. Gmail, and tap some link to open a custom tab.
  5. Swipe back to Firefox.

Expected behavior
PBM is locked and authentication is required.

Scenario 2:
Preconditions:

  • set Firefox as the default browser
  1. In Settings | Private Browsing, activate Use screen lock to hide tabs in private browsing
  2. Open a private browsing tab and visit some site in that tab, e.g. https://example.org .
  3. Switch to another app that can launch custom-tabs, e.g. Gmail, and tap some link to open a custom tab.
  4. Switch back to Firefox Nightly, when prompted, unlock the private tabs
  5. Now return to the custom tab opened at step 3(Gmail).

Expected behavior
I should be looking at the custom tab that I opened in step 3 (which is not a private tab).

Scenario 3 (Bug 1971361):
Preconditions:

  • set Firefox as the default browser
  1. In Settings | Private Browsing, activate Use screen lock to hide tabs in private browsing
  2. Open a private browsing tab and visit some site in that tab, e.g. https://example.org .
  3. Switch to another app that can launch custom-tabs, e.g. Gmail, and tap some link to open a custom tab.
  4. Switch back to Firefox Nightly, when prompted, don’t authenticate / don’t unlock the private tabs
  5. Now return to the custom tab opened at step 3(Gmail).

Expected behavior
Normal custom tab is not locked, auth is not required.

Scenario 4 (Bug 1980477):

  1. In Setting -> Private browsing -> enable "Use screen lock to hide tabs in private browsing" and enable "Open links in private tab".
  2. In Settings -> Set Firefox as the default browser to open the custom tabs in Firefox.
  3. Open a private browsing tab and visit some site in that tab, e.g. https://example.org .
  4. Switch to normal a normal browsing tab.
  5. Switch to another app that can launch custom-tabs, e.g. Gmail, and tap some link to open a private custom tab.
  6. Authenticate to open the private custom tab.
  7. Go back to Firefox.

Expected behavior
Browser shouldn't be locked.

Flags: qe-verify+
See Also: → 1980477

Verified all 4 scenarios, and everything works as expected.
Tested on Firefox for Android Nightly 143.0a1 from 8/5 using a Samsung Galaxy S24 (Android 15), and a Realme GT Master Edition (Android 13).

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: