1

I can read from developer.android.com about how to support Always-on VPN from the VPN application point of view.

But couldn't find any information how the android system internally implements this feature?

  • Does the android system wake up periodically and check if the VPN service is running and if not then tries to start the specified VPN service?
  • Does this happen on a regular interval basis?
  • What if there is no network connectivity? Will android wait until the n/w conn is restored to start the VPN service?

Thanks in advance

4

1 回答 1

3

android系统是否定期唤醒并检查VPN服务是否正在运行,如果没有,则尝试启动指定的VPN服务?

不,系统启动后会启动一次 VPN 服务(使用 action android.net.VpnService)。根据 Android 版本,用户首先必须解锁系统(Android 8+ 似乎就是这种情况)。在 Android 7.x 上,情况并非如此,如果 VPN 应用程序需要访问已锁定的KeyChain.

每当用户在系统的 VPN 设置中启用 Always-on VPN 功能时,它也会启动 VPN 服务。

这是否定期发生?

否,但从 Android 8 开始,如果启用了 Always-on VPN 功能但当前没有隧道接口,系统会显示通知(点击通知将打开系统的 VPN 设置)。

如果没有网络连接怎么办?android会等到n/w conn恢复后再启动VPN服务吗?

不,VPN 应用程序必须处理这种情况。

于 2018-06-13T08:26:43.610 回答