Skip to content

Commit

Permalink
Retry notifyVpnStart to allow value propagation (#3847)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/488551667048375/1205911542931688/f

### Description
See [asana](https://app.asana.com/0/488551667048375/1205911542931688/f) for better explanation

### Steps to test this PR
Smoke test AppTP/VPN enable/disable and general functionality
  • Loading branch information
aitorvs authored Nov 11, 2023
1 parent 7866d68 commit 9b7fda5
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,17 @@ class TrackerBlockingVpnService : VpnService(), CoroutineScope by MainScope(), V
*/
private fun notifyVpnStart(): Boolean {
val emptyNotification = VpnEnabledNotificationContentPlugin.VpnEnabledNotificationContent.EMPTY
val vpnNotification: VpnEnabledNotificationContentPlugin.VpnEnabledNotificationContent =
vpnEnabledNotificationContentPluginPoint.getHighestPriorityPlugin()?.getInitialContent()
?: emptyNotification
var vpnNotification: VpnEnabledNotificationContentPlugin.VpnEnabledNotificationContent = emptyNotification
for (retries in 1..20) {
vpnNotification =
vpnEnabledNotificationContentPluginPoint.getHighestPriorityPlugin()?.getInitialContent()
?: emptyNotification

if (vpnNotification != emptyNotification) {
logcat { "Notification in retry: $retries" }
break
}
}

startForeground(
VPN_FOREGROUND_SERVICE_ID,
Expand Down

0 comments on commit 9b7fda5

Please sign in to comment.