waydroid / waydroid

Waydroid uses a container-based approach to boot a full Android system on a regular GNU/Linux system like Ubuntu.
https://waydro.id
GNU General Public License v3.0
8k stars 332 forks source link

[BUG] App-defined intents (schemes) are not opened in the resp. apps from WebView #1447

Closed tuxor1337 closed 4 months ago

tuxor1337 commented 5 months ago

Describe the bug

Similarly to #412 (which was about market:// links), but applying to all kinds of app-defined intent-filters: When clicking on or typing a link for which some of my apps defines an intent-filter, the link is not opened in that app. For example, if I install OsmAnd, and type geo:52.0,9.0?z=19 in the Waydroid browser (I don't mean the host browser!), it just tries to start a search, but it does not ask whether I want to open the link in an app (which is the usual behavior on my Android devices).

Some apps offer login via a WebView and after logging in, they redirect to an app-defined intent, such as the German railway app DB Navigator, which has an intent-filter for dbnav://. However, this just spawnes an ERR_UNKNOWN_URL_SCHEME within the WebView, and does not redirect the auth link back to the DB Navigator app.

As a workaround, I can manually copy the link that does not work as expected, and then run waydroid app intent android.intent.action.VIEW "URI" on my host (see https://github.com/waydroid/waydroid/pull/433).

The same behavior applies to waydroid on my desktop (Fedora 40, x86_64) and on my linux phone (pmOS on OnePlus 6).

Waydroid version

1.4.2

Device

Linux Desktop

Operating System

Fedora 40

Kernel version

6.8.11-300

Desktop Environment

GNOME 46.2

GPU

Intel i5 Gen8 integrated graphics

Logs

/var/lib/waydroid/waydroid.cfg

[waydroid]
arch = x86_64
vendor_type = MAINLINE
system_datetime = 1717219045
vendor_datetime = 1714216970
suspend_action = freeze
mount_overlays = True
images_path = /var/lib/waydroid/images
system_ota = https://ota.waydro.id/system/lineage/waydroid_x86_64/VANILLA.json
vendor_ota = https://ota.waydro.id/vendor/waydroid_x86_64/MAINLINE.json
binder = binder
vndbinder = vndbinder
hwbinder = hwbinder
binder_protocol = aidl3
service_manager_protocol = aidl3

[properties]

/var/lib/waydroid/waydroid.prop

sys.use_memfd=true
debug.stagefright.ccodec=0
ro.hardware.gralloc=gbm
ro.hardware.egl=mesa
ro.hardware.vulkan=intel
ro.hardware.camera=v4l2
ro.opengles.version=196609
waydroid.system_ota=https://ota.waydro.id/system/lineage/waydroid_x86_64/VANILLA.json
waydroid.vendor_ota=https://ota.waydro.id/vendor/waydroid_x86_64/MAINLINE.json
waydroid.tools_version=1.4.2
ro.vndk.lite=true
waydroid.host.user=thomas
waydroid.host.uid=1000
waydroid.host.gid=1000
waydroid.host_data_path=/home/thomas/.local/share/waydroid/data
waydroid.xdg_runtime_dir=/run/user/1000
waydroid.pulse_runtime_path=/run/user/1000/pulse
waydroid.wayland_display=wayland-0
waydroid.background_start=false
waydroid.stub_sensors_hal=1

/var/lib/waydroid/waydroid_base.prop

sys.use_memfd=true
debug.stagefright.ccodec=0
ro.hardware.gralloc=gbm
ro.hardware.egl=mesa
ro.hardware.vulkan=intel
ro.hardware.camera=v4l2
ro.opengles.version=196609
waydroid.system_ota=https://ota.waydro.id/system/lineage/waydroid_x86_64/VANILLA.json
waydroid.vendor_ota=https://ota.waydro.id/vendor/waydroid_x86_64/MAINLINE.json
waydroid.tools_version=1.4.2
ro.vndk.lite=true

/var/lib/waydroid/waydroid.log waydroid.log

sudo waydroid shell -- logcat -d | tee logcat.txt logcat.txt

sudo dmesg | tee dmesg.txt dmesg.txt

drzraf commented 4 months ago

Same behavior confirmed. Only logcat entries after running: waydroid app intent android.intent.action.MAIN foobar://login/abc

06-22 06:18:59.090   239  1670 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startActivity:993 org.lineageos.platform.internal.WayDroidService$2.launchIntent:388 lineageos.waydroid.IPlatform$Stub.onTransact:244 android.os.Binder.execTransactInternal:1159 android.os.Binder.execTransact:1123 
06-22 06:18:59.090   239  1670 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startActivity:1005 android.app.ContextImpl.startActivity:994 org.lineageos.platform.internal.WayDroidService$2.launchIntent:388 lineageos.waydroid.IPlatform$Stub.onTransact:244 android.os.Binder.execTransactInternal:1159 
06-22 06:18:59.090   239  1670 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN dat=foobar://login/abc flg=0x10000000} from uid 1000

But no reaction from the UI.

Anyway, as a workaround, using adb shell am start specifying the -d -a -c arguments does the trick.

tuxor1337 commented 4 months ago

Here are related reports on the LineageOS issue tracker:

The suggested workaround there is to install a new browser (in most cases Firefox for Android) and set it as default. I will try this as soon as possible and report back.

tuxor1337 commented 4 months ago

In fact, setting a different browser as the default solves this issue. I simply installed the FOSS Browser from F-Droid and set it as the default browser in the settings. Even though this browser doesn't come with its own browser engine, and it just uses the built-in android WebView functionality, it solves the problem. (Note that, with this particular browser, you have to activate cookies or switch to the trusted profile to use many login forms.)

I'm closing this since, even if you would consider it as a bug, it would be a bug in LineageOS, and should be solved upstream.

drzraf commented 4 months ago

I don't think this should be closed. waydroid app intent should work independently of the browser chosen, so I think there is an actual underlying problem.

tuxor1337 commented 4 months ago

This issue was never about waydroid app intent. This issue is about how WebView handles app-defined schemes. In fact, the command waydroid app intent works very well for me and serves as a workaround for this issue.

I suggest to open a new issue if you have problems with waydroid app intent.