facebook / stetho

Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.
http://facebook.github.io/stetho/
MIT License
12.67k stars 1.13k forks source link

Support running Stetho in multi-user Android environments #719

Closed xapienz closed 3 months ago

xapienz commented 3 months ago

For supporting that, adding non-default user id to stetho socket name, so they can be distinguished.

Currently, Stetho uses socket address in form stetho_<package>_devtools_remote. If two instances of the same app are running (e.g. in dual app mode), one of them will open socket successfully, but the second app will fail:

$ adb logcat -s 'stetho:*'
07-11 15:04:34.942 28329 28580 I stetho  : Listening on @stetho_com.myapp_devtools_remote
07-11 15:04:57.951 29513 29827 E stetho  : Could not start Stetho server: main

Adding user id for non-default (non-0) user into socket address, so both sockets can be opened at the same time:

$ adb logcat -s 'stetho:*'
07-11 15:07:09.405 31796 32606 I stetho  : Listening on @stetho_com.myapp_devtools_remote
07-11 15:07:14.751 31954   654 I stetho  : Listening on @stetho_com.myapp_999_devtools_remote