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

Google Backup does not work on Wi-Fi while on VPN #1587

Closed
atkrv opened this issue Nov 13, 2017 · 18 comments
Closed

Google Backup does not work on Wi-Fi while on VPN #1587

atkrv opened this issue Nov 13, 2017 · 18 comments
Labels
Android bug Bug of Android OS

Comments

@atkrv
Copy link

atkrv commented Nov 13, 2017

Android 8.1.0 can't route Wi-Fi while on VPN. Reproduced even with NoRoot Firewall.

Steps to reproduce

  1. Install and enable any VPN app
  2. Try to auto-backup photos in Google Photos or stream music in Play Music (Stream only on Wi-Fi setting must be ON)

Expected behavior

Apps should work with no network errors

Actual behavior

Google Photos can't backup any photos with Waiting for Wi-Fi message. Play Music can't stream any song with Can't prepare radio. Please try againg. message.

Screenshots and video:

screenshot_20171113-202539

screenshot_20171113-202532

VIDEO
https://uploads.adguard.com/up01_dj4zx_device-2017-11-13-203520.mp4

Logs

Archive.zip

Customer ID

1656541, 1691627

Your environment

  • Adguard version: 2.10.164
  • Adguard filtering mode: VPN
  • Device model: Google Nexus 6P
  • Android 8.1.0
  • Not rooted
@atkrv atkrv added the Android bug Bug of Android OS label Nov 13, 2017
@ameshkov
Copy link
Member

@altokarev report it to Google please

@atkrv
Copy link
Author

atkrv commented Nov 16, 2017

@ameshkov ameshkov changed the title Android 8.1.0 can't route Wi-Fi while on VPN Google Backup does not work on Wi-Fi while on VPN Nov 29, 2017
@crispinb
Copy link

crispinb commented Dec 7, 2017

The Android team in their wisdom have decided not to fix this until some 'future release'. This unfortunately makes Adguard unusable on Android. Presumably they have decided to force ads on Android users.

@ameshkov
Copy link
Member

ameshkov commented Dec 7, 2017

I wonder would it help to disable filtering for Google apps in AdGuard's apps mgmt settings?

Photos, Play Music, etc.

@crispinb
Copy link

crispinb commented Dec 7, 2017

@ameshkov Good thought -- I've never got round to exploring the Android Adguard settings. Just tried it and is promising so far. Background upload of one test photo just worked with Adguard enabled. That's not enough of a test to be certain it works under all circumstances (eg does Photos offload jobs to Google Play Services when in the background?) but looks good. Thanks.

@ameshkov ameshkov added this to the 2.11 milestone Mar 11, 2018
@ameshkov ameshkov added Bug P2: High and removed Android bug Bug of Android OS labels Mar 11, 2018
@ameshkov
Copy link
Member

ameshkov commented Mar 11, 2018

Okay, this is now officially our bug:)

Google closed the original issue as Won't Fix (Intended Behavior)

When a VPN is up the OS has no way to guarantee that network traffic will go on wifi. The VPN app could decide to send and receive traffic on any available interface, including cell data. Recent changes to the VPN code have made it so that if the VPN calls setUnderlyingNetworks, the networking APIs will reflect some of the properties of the underlying networks (e.g., whether they are metered or not) into the VPN's networkcapabilities. But it's up to the podcast app to use the required APIs, such as isActiveNetworkMetered.

What we should do now

On Oreo, we should be calling VpnService.setUnderlyingNetworks when the tunnel is established and VpnService.Builder.setUnderlyingNetworks when we're preparing the tunnel.

@Revertron
Copy link

Aha, and we can pass null to let the system know, that we are not binding to particular interface.
I think it will be easy.

@TPS
Copy link
Contributor

TPS commented Mar 11, 2018

Fair warning, FYI: If y'all read the rest of the issue thread where that last quote comes from, not even the existing official GApps implement this functionally, so perhaps not so easy/simple. 🤦🤷‍♂️🤔

@ameshkov
Copy link
Member

ameshkov commented Mar 11, 2018

Aha, and we can pass null to let the system know, that we are not binding to particular interface.
I think it will be easy.

This is the default behavior and it does not seem to work. It is worth trying, though -- just reproduce the original issue first.

If it does not work out well and we are forced to specify the exact Network, don't forget that you'll also need to use bindSocket:

This method only needs to be called if the VPN has explicitly bound its underlying communications channels — such as the socket(s) passed to protect(int) — to a Network using APIs such as bindSocket(Socket) or bindSocket(DatagramSocket). The VPN should call this method every time the set of Networks it is using changes.

@sviperz
Copy link

sviperz commented Mar 12, 2018

AG version: 2.11.31 Beta
AG filtering mode: VPN
Device: Google Pixel 2016
OS: Android 8.1.0
No root

Google Photos indeed doesn't "see" WiFi connection when AG is enabled.
no_backup

Disabling the app in the Apps Management settings fixed the issue immediately.
backing_up

@ameshkov
Copy link
Member

ameshkov commented Mar 19, 2018

@sviperz it should've been resolved in the latest nightly

@sviperz
Copy link

sviperz commented Mar 19, 2018

@ameshkov yes, it's fixed for now. Thanks!

@vozersky
Copy link
Member

vozersky commented May 8, 2018

#1853

looks like this issue is back

@vozersky vozersky reopened this May 8, 2018
@vozersky vozersky modified the milestones: 2.11, 2.12 May 8, 2018
@ameshkov ameshkov assigned nkartyshov and unassigned Revertron May 14, 2018
@ameshkov
Copy link
Member

@nkartyshov
Copy link
Contributor

This system problem the Android Oreo 8.1, on the Android P such problem is not observed. The Android cannot reconfigure wifi routes when the VPN works.
Workaround is to turn off filtering for Google photos.

@Kr328
Copy link

Kr328 commented Jun 23, 2019

@ameshkov
Same problem on Android Pie but shadowsocks-android resolve it by this

Call VpnService.setUnderlyingNetworks when default network changed and pass default Network to it

@ameshkov
Copy link
Member

@Kr328 this is exactly what we do

@ameshkov
Copy link
Member

@Kr328 thanks for the link anyway! I guess we'd better review ours just in case: #2836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android bug Bug of Android OS
Projects
None yet
Development

No branches or pull requests

9 participants