Genymobile / gnirehtet

Gnirehtet provides reverse tethering for Android
Apache License 2.0
6.1k stars 564 forks source link

No Gnirehtet connection in android work profile #408

Open hgt9 opened 2 years ago

hgt9 commented 2 years ago

Gnirehtet works perfect on my android 11, but in my android work profile which I made with the app Island I am not able to get internet via gnirehtet.

Is it possible to use profile 10 which is the work profile in gnirehtet or is it more complicated that adb cant reach the work profile?

Anybody solved this already or has an idea how this might get to work?

ungive commented 2 years ago

This is easily fixed by starting the GnirehtetActivity not only on the main (default) profile, but also on the work profile.

To do that, first find out your work profile's user ID:

$ adb shell pm list users
Users:
    UserInfo{0:Me:c13} running
    UserInfo{10: Island :10101030} running

"Island" is the name of my work profile (using the Island app) and 10 its respective user ID.

Now, before running gnirehtet, start the activity on the work profile:

$ adb shell am start --user 10 -a com.genymobile.gnirehtet.START -n com.genymobile.gnirehtet/.GnirehtetActivity
Starting: Intent { act=com.genymobile.gnirehtet.START cmp=com.genymobile.gnirehtet/.GnirehtetActivity }

Make sure to replace the user ID here (10) with the user ID of your work profile.

This command was simply taken from the relay server's source code: https://github.com/Genymobile/gnirehtet/blob/f5c0710c751f7ca82ce413058abc57d9af7208c3/relay-rust/src/main.rs#L421-L429

After that you can run gnirehtet like you normally would, with internet on both your normal and your work profile. You'll see two notifications that indicate the connection status.