Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android: make disconnected notification non-foreground #391

Merged
merged 1 commit into from
May 29, 2024
Merged

Conversation

kari-ts
Copy link
Contributor

@kari-ts kari-ts commented May 13, 2024

Follow-up to #389
Use foreground notifications only when the service was started as a foreground service

Updates #cleanup

Copy link
Contributor

@oxtoacart oxtoacart left a comment

Choose a reason for hiding this comment

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

I left a few comments.

I'm not 100% sure we want to do this. Dropping this means that we lose the disconnected state status bar icon.

android/src/main/java/com/tailscale/ipn/App.kt Outdated Show resolved Hide resolved
android/src/main/java/com/tailscale/ipn/App.kt Outdated Show resolved Hide resolved
android/src/main/java/com/tailscale/ipn/App.kt Outdated Show resolved Hide resolved
android/src/main/java/com/tailscale/ipn/App.kt Outdated Show resolved Hide resolved
@kari-ts kari-ts changed the title android: only show notification if connected android: make disconnected notification non-foreground May 14, 2024
@kari-ts kari-ts requested a review from oxtoacart May 14, 2024 22:33
@kari-ts
Copy link
Contributor Author

kari-ts commented May 14, 2024

Put disconnected notification back in, but it is no longer a persistent notification. Also fix issue so that the correct notification is used for always-on VPN and when IPNService is restarted after being killed

@@ -41,6 +41,7 @@ open class IPNService : VpnService(), libtailscale.IPNService {
// This means we were started by Android due to Always On VPN.
// Get the application to make sure it's been initialized, then
// request the VPN.
showForegroundNotification()
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tested this? I think it might not work because I'm not sure that startForeground() has been called in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using non-foreground notification. Also canceling notifications when App closes to clear any lingering notifications, and only showing a disconnected notification when in the Stopped state.

@kari-ts kari-ts force-pushed the kari/note branch 2 times, most recently from fc6e776 to acd0e6f Compare May 29, 2024 17:52
Follow-up to #389
Only use foreground notifications when VPN was started as a foreground service.

Updates #cleanup

Signed-off-by: kari-ts <kari@tailscale.com>
Copy link
Contributor

@oxtoacart oxtoacart left a comment

Choose a reason for hiding this comment

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

LGTM!

@kari-ts kari-ts merged commit cbc4779 into main May 29, 2024
4 checks passed
@kari-ts kari-ts deleted the kari/note branch May 29, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants