Closed Bug 2067052 Opened 3 months ago Closed 14 days ago

"Close private tabs" notification action should return the user to normal browsing instead of the private homepage

Categories

(Firefox for Android :: Privacy, enhancement)

Firefox 154
All
Android
enhancement

Tracking

()

RESOLVED DUPLICATE of bug 2073324

People

(Reporter: davejupp9000, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:154.0) Gecko/20100101 Firefox/154.0

Steps to reproduce:

Open Firefox for Android and browse in normal mode.
Switch to private browsing and open one or more private tabs.
Background the app (or pull down the notification shade).
Tap "Close private tabs" on the persistent private browsing notification.

Actual results:

The private tabs are erased, but the app is brought to the foreground still in private browsing mode, showing the private homepage. Depending on the homepageAsNewTab rollout, this is either an empty private tab list or a freshly opened private homepage tab. If you're attempting to hide your private browsing, this just makes it entirely clear you just cleared all your private tabs.

On the privacy trade-off:
There is an avoidable counter argument here, "Close private tabs" is plausibly (possibly usually) used as a panic button. Returning the user to normal mode surfaces their normal tabs and history, which in a shoulder-surfing scenario is potentially worse than an inert private homepage. However an inert private homepage almost guarantees that the user just cleared their private tabs, so is also leaking user information, just of a different form.

There are some mitigations here: The current behaviour already foregrounds the app, so the user is being shown something either way — the question is only which surface. Second, the existing code path already routes to the recents screen rather than the browser when the app was backgrounded (START_IN_RECENTS_SCREEN via VisibilityLifecycleCallback), and that branch could be preserved unchanged. The proposal would only affect the mode the app resumes in when it does come to the foreground.

With regards to the privacy concern, my preferred solution would be to keep the user out of the browser entirely but still confirm the deletion. for example, returning to normal mode with a snackbar reading "Private tabs closed", which confirms the action unambiguously in a way the private homepage does not. It would even be preferable to switch to normal mode in a new homepage tab, to resolve privacy concerns (i.e. how it's implemented now, but with the new tab in normal, not private mode)

Affected code:

mobile/android/fenix/app/src/main/java/org/mozilla/fenix/session/PrivateNotificationService.kt

erasePrivateTabs(), the if (inPrivateMode) branch
specifically the HomeActivity.PRIVATE_BROWSING_MODE extra, and the addNewHomepageTab(private = true) call under enableHomepageAsNewTab
Two tests in mobile/android/fenix/app/src/test/java/org/mozilla/fenix/session/PrivateNotificationServiceTest.kt assert the current behaviour and would need to be updated:

"service opens home activity in private mode if app is in private mode"
"WHEN homepage as a new tab is enabled AND app is in private mode THEN erasing private tabs reopens a private homepage tab and opens the home activity in private mode"

I can write this (tiny) patch if the team agrees the behaviour should change. Filing first rather than attaching a patch, since this is a product decision rather than an actual defect.

Expected results:

The app closes the private tabs, issues a notification saying they're cleared, and returns to normal browsing mode, without moving to the foreground (Unless it was previously there, in which case, if it was in private mode, it switches to an entirely new home page).

Having explicitly ended the private session, the user's next action is almost always a normal-mode one, and there is no private session left to return to.

It's definitely worth noting that the current behaviour IS by design. PrivateNotificationService.erasePrivateTabs() carries a comment from bug/issue fenix#16053 (Nov 2020) explaining that the app launches into the private home screen "as a confirmation that all private tabs have been deleted."

I don't believe this is useful functionality though. A notification saying the process was completed would have the same functionality.

Bug 1962114 (July 2026) makes this behavior explicitly by design:
To avoid a zero-tab state under homepageAsNewTab, erasing now reopens a new private homepage tab. The end state is therefore an active private session, which is close to the opposite of what the user just asked for. The user pressed a control labelled "Close private tabs" and ends up in private browsing with a tab open. We'd obviously need to keep this behaviour, but I don't think it should be the active foreground page.

At the moment, clicking that notification primarily makes it entirely clear that you just closed all your private tabs, which isn't significantly better than just leaving them there and going back to non-private mode with a fresh home page tab, as it makes you look suspicious.

After giving a little more thought to the above functionality, please disregard the suggestion there that the change would only affect the mode
the app resumes in.

What I would actually like to propose is:

If the app is in the background when "Close private tabs" is tapped: erase the private tabs and leave the app in the background.
Do not foreground anything. The notification click asked for an action to be performed, not to show the browser.

If the app is in the foreground and in private mode: switch to normal mode on a freshly created homepage tab.

Both rely on the confirmation behaviour suggested below:

Confirmation of tab closing:
My original suggestion asked for a "tabs cleared" notification. I want to withdraw that.

A persistent notification saying private tabs were cleared is (temporarily) just as suspicious as the current behaviour, it is legible to anyone who glances at the device, potentially without unlocking it. Notably, the existing private browsing notification already sets VISIBILITY_SECRET (AbstractPrivateNotificationService.createNotification), so hiding this class of information from the lock screen is already an established concern in this code.

A better solution here is to modify the confirmation notification: Tear this notification down ONLY when the private session ends.

Its disappearance is an unambiguous signal that the erase happened, it costs nothing to implement, and it leaks nothing. If I am reading the service
lifecycle correctly, the background case therefore needs no new UI at all.

Please correct me if the teardown is not that reliable in practice.

A caveat:
I described returning to a fresh normal homepage as resolving the privacy concern. That's somewhat overstating it, as obviously there might be somewhat sensitive data on that page as well.

I still think it is the better trade. The current end state, an empty private homepage, or since bug 1962114 a newly opened private tab -- reveals specifically that the user just cleared their private tabs, which is the single fact they are most likely trying not to disclose.

A normal homepage discloses that the device has been used for browsing, which is not really a secret.

Happy to write the patch if this direction sounds acceptable. Code changes are quite minimal from my glance through the code.

Thanks for the notes.

We triaged this bug, and here are our STRs

  1. Open a private tab
  2. Background the app
  3. Tap on the private tab notification to close it.
  4. Re-open the app

Expected results

  • App resumes in normal browsing mode

Actual results

  • App resumes in private browsing

Happy to write the patch if this direction sounds acceptable. Code changes are quite minimal from my glance through the code.

Thanks a lot for offering this! We would love this, but first, we need to check with our product partners. I'll write you back and notify you based on what they say.
Thank you!

Severity: -- → S3

I think this will be fixed by the change described in https://bugzilla.mozilla.org/show_bug.cgi?id=2073324#c3

Thanks for reporting this bug! Closing the bug based on Comment 3. Please reopen if I have misunderstood

Status: UNCONFIRMED → RESOLVED
Closed: 14 days ago
Duplicate of bug: 2073324
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.