Skip to content

Notification: gate changes. - #9087

Merged
atavism merged 2 commits into
atavism/issue-3782from
jigar/issue-3782
Sep 22, 2026
Merged

atavism merged 2 commits into
atavism/issue-3782from
jigar/issue-3782

Conversation

@jigar-f

@jigar-f jigar-f commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

This pull request enhances the VPN startup synchronization logic to better handle duplicate and conflicting start/stop requests. It introduces explicit rejection reasons for denied VPN start attempts, allows custom handling of these rejections, and ensures proper cleanup of notifications and service state. The update also adds comprehensive tests to verify the new behavior.

Key changes include:

VPN Start/Stop Coordination Improvements:

  • Introduced a Rejection enum in VpnStartGate to explicitly indicate why a VPN start was rejected (either START_IN_PROGRESS or STOPPING), and updated the run method to accept an onRejected callback for custom rejection handling. [1] [2]
  • Updated LanternVpnService to track if the service was promoted to the foreground during a start attempt, and to properly stop the notification and service if the attempt is later rejected due to a stop in progress.

Notification Handling:

  • Modified NotificationHelper.showStartingVPNConnectedNotification to return a Boolean indicating if the service was promoted, allowing callers to react appropriately when a start is rejected.

Testing Enhancements:

  • Added new tests in VpnStartGateTest to verify that duplicate and conflicting start attempts are rejected with the correct reasons, and that the onRejected callback is invoked as expected.

These changes collectively improve the reliability and clarity of VPN service management, especially in edge cases involving rapid or overlapping start/stop requests.

Copilot AI lite review requested due to automatic review settings September 21, 2026 14:34
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: bf0d686f-7b80-4fa7-95a3-51f1ac9074f5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review comments remain, and the changes include coverage for the updated coordination behavior.

Review effort: Lite
Findings: None

What changed in this PR

Improves VPN startup synchronization for duplicate and conflicting start/stop requests, including explicit rejection handling and foreground-service cleanup.

Changes:

  • Added rejection reasons and callbacks to VpnStartGate.
  • Updated VPN service cleanup for rejected starts.
  • Reported foreground promotion status from notifications.
  • Added coordination and rejection tests.
File Description
android/​app/​src/​test/​kotlin/​org/​getlantern/​lantern/​service/​VpnStartGateTest.kt Tests duplicate and conflicting start rejection behavior.
android/​app/​src/​main/​kotlin/​org/​getlantern/​lantern/​service/​VpnStartGate.kt Adds rejection reasons and callback handling.
android/​app/​src/​main/​kotlin/​org/​getlantern/​lantern/​service/​LanternVpnService.kt Cleans up foreground state after rejected starts.
android/​app/​src/​main/​kotlin/​org/​getlantern/​lantern/​notification/​NotificationManager.kt Reports whether foreground promotion occurred.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jigar-f
jigar-f requested a review from atavism September 21, 2026 14:38
@atavism

atavism commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

LGTM!

@atavism
atavism merged commit ecbe06d into atavism/issue-3782 Sep 22, 2026
5 checks passed
@atavism
atavism deleted the jigar/issue-3782 branch September 22, 2026 11:16
atavism added a commit that referenced this pull request Sep 22, 2026
* fix(android): serialize VPN startup preparation

* code review updates

* code review updates

* code review updates

* code review updates

* Notification: gate changes. (#9087)

Co-authored-by: atavism <atavism@users.noreply.github.com>

* code review updates

---------

Co-authored-by: jigar-f <132374182+jigar-f@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants