Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
110.26k stars 10.57k forks source link

ScrCpy is crashing and screen transitioning is not working on Android 14 #4238

Open TheLittleNaruto opened 1 year ago

TheLittleNaruto commented 1 year ago

Environment

Description We are observing a consistent crash when we are clicking anywhere on the screen. For example, if we click on Media Widget on Home Screen, it is crashing and only on relaunch of ScrCpy, we can see Media app otherwise it stays at same state. So screen transitioning is also not working.

Could not invoke method
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at com.genymobile.scrcpy.wrappers.InputManager.injectInputEvent(InputManager.java:36)
    at com.genymobile.scrcpy.Device.injectEvent(Device.java:169)
    at com.genymobile.scrcpy.Device.injectEvent(Device.java:173)
    at com.genymobile.scrcpy.Controller.injectTouch(Controller.java:215)
    at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:94)
    at com.genymobile.scrcpy.Controller.control(Controller.java:71)
    at com.genymobile.scrcpy.Server$2.run(Server.java:100)
    at java.lang.Thread.run(Thread.java:1012)
Caused by: android.os.DeadObjectException
    at android.os.BinderProxy.transactNative(Native Method)
    at android.os.BinderProxy.transact(BinderProxy.java:584)
    at android.hardware.input.IInputManager$Stub$Proxy.injectInputEvent(IInputManager.java:1533)
    ... 9 more
rom1v commented 1 year ago

Thank you for your report.

It looks the event injected by scrcpy makes the system crash (or at least the component on which you click). It looks like a bug in that component.

TheLittleNaruto commented 1 year ago

Thank you for quick response. For any component the behavior is same. [if by component you meant an app].

rom1v commented 1 year ago

OK, so it's the system itself.

Which device is it? Could you reproduce with another device with Android 14?

Could you check if there are more details in logcat?

adb logcat -c  # clear before running
# run scrcpy and click
adb logcat -d > logcat.txt
TheLittleNaruto commented 1 year ago

ScreenCpy_logs.txt

Note: I may not be able to share logs due to some restrictions at my end. :( But I tested ScrCpy with Google's A14 Emulator and the behavior is same. Attaching the logs as per the instructions.

rom1v commented 1 year ago

You first get a native crash related to bluetooth, then everything dies in the system, so when you click with scrcpy you get a DeadObjectException.

08-17 16:27:00.182  8496  8496 F DEBUG   : Build fingerprint: 'google/sdk_gphone64_x86_64/emu64xa:14/UPB5.230623.003/10615560:userdebug/dev-keys'
08-17 16:27:00.183  8496  8496 F DEBUG   : Revision: '0'
08-17 16:27:00.184  8496  8496 F DEBUG   : ABI: 'x86_64'
08-17 16:27:00.184  8496  8496 F DEBUG   : Timestamp: 2023-08-17 16:26:49.397731900+0530
08-17 16:27:00.185  8496  8496 F DEBUG   : Process uptime: 0s
08-17 16:27:00.186  8496  8496 F DEBUG   : Cmdline: com.google.android.bluetooth
08-17 16:27:00.188  8496  8496 F DEBUG   : pid: 8372, tid: 8451, name: bt_stack_manage  >>> com.google.android.bluetooth <<<
08-17 16:27:00.190  8496  8496 F DEBUG   : uid: 1002
08-17 16:27:00.190  8496  8496 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
08-17 16:27:00.190  8496  8496 F DEBUG   : Abort message: 'assertion 'init_status == std::future_status::ready' failed - Can't start stack, last instance: starting Controller'
08-17 16:27:00.206  8496  8496 F DEBUG   :     rax 0000000000000000  rbx 00007f49f9221eb8  rcx 00007f4d1d71a610  rdx 0000000000000006
08-17 16:27:00.209  8496  8496 F DEBUG   :     r8  0000000000000001  r9  0000000000000001  r10 00007f49f9221ec0  r11 0000000000000203
08-17 16:27:00.215  8496  8496 F DEBUG   :     r12 00007f4b66affe90  r13 00007f4b66b00070  r14 00000000000020b4  r15 0000000000002103
08-17 16:27:00.216  8496  8496 F DEBUG   :     rdi 00000000000020b4  rsi 0000000000002103
08-17 16:27:00.216  8496  8496 F DEBUG   :     rbp 0000000000000001  rsp 00007f49f9221eb0  rip 00007f4d1d71a610
08-17 16:27:00.217  8496  8496 F DEBUG   : 22 total frames
08-17 16:27:00.220  8496  8496 F DEBUG   : backtrace:
08-17 16:27:00.220  8496  8496 F DEBUG   :       #00 pc 0000000000061610  /apex/com.android.runtime/lib64/bionic/libc.so (abort+192) (BuildId: fa337969c798946280caa45e2d71a2e7)
08-17 16:27:00.222  8496  8496 F DEBUG   :       #01 pc 00000000007fa563  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+115) (BuildId: 7bb8b7e51aa2973cf22167cc6c483bef)
08-17 16:27:00.230  8496  8496 F DEBUG   :       #02 pc 0000000000037abd  /apex/com.google.mainline.primary.libs@340721000/lib64/libbase.so/a5cce001552a532d111a59af51bbb6cc5e93475522f033f9807fa5f8ad346840deb8c6475491b3425ed7ef34094fb412761afd70b2205820f67d8a4c71c39832/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_0::__invoke(char const*)+61) (BuildId: d848a07685150bc1df3af6b95e4bc316)
08-17 16:27:00.240  8496  8496 F DEBUG   :       #03 pc 0000000000007fb2  /system/lib64/liblog.so (__android_log_assert+306) (BuildId: f2d120f04fa3ea2f6d481054934da0a6)
08-17 16:27:00.240  8496  8496 F DEBUG   :       #04 pc 0000000000c505f4  /apex/com.android.btservices/lib64/libbluetooth_jni.so (bluetooth::StackManager::StartUp(bluetooth::ModuleList*, bluetooth::os::Thread*)+740) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.240  8496  8496 F DEBUG   :       #05 pc 0000000000482bb6  /apex/com.android.btservices/lib64/libbluetooth_jni.so (bluetooth::shim::Stack::Start(bluetooth::ModuleList*)+214) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.245  8496  8496 F DEBUG   :       #06 pc 00000000004828f2  /apex/com.android.btservices/lib64/libbluetooth_jni.so (bluetooth::shim::Stack::StartEverything()+1650) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.251  8496  8496 F DEBUG   :       #07 pc 000000000048cc4d  /apex/com.android.btservices/lib64/libbluetooth_jni.so (ShimModuleStartUp()+13) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.251  8496  8496 F DEBUG   :       #08 pc 00000000006afa5b  /apex/com.android.btservices/lib64/libbluetooth_jni.so (module_start_up(module_t const*)+203) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.251  8496  8496 F DEBUG   :       #09 pc 00000000006ae7a2  /apex/com.android.btservices/lib64/libbluetooth_jni.so (init_stack_internal(bluetooth::core::CoreInterface*)+82) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.252  8496  8496 F DEBUG   :       #10 pc 00000000006ae688  /apex/com.android.btservices/lib64/libbluetooth_jni.so (event_init_stack(std::__1::promise<void>, bluetooth::core::CoreInterface*)+120) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.253  8496  8496 F DEBUG   :       #11 pc 00000000006ae702  /apex/com.android.btservices/lib64/libbluetooth_jni.so (base::internal::Invoker<base::internal::BindState<void (*)(std::__1::promise<void>, bluetooth::core::CoreInterface*), std::__1::promise<void>, base::internal::UnretainedWrapper<bluetooth::core::CoreInterface> >, void ()>::RunOnce(base::internal::BindStateBase*)+50) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.253  8496  8496 F DEBUG   :       #12 pc 0000000000cb9e8e  /apex/com.android.btservices/lib64/libbluetooth_jni.so (base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*)+206) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.256  8496  8496 F DEBUG   :       #13 pc 0000000000cb8fb9  /apex/com.android.btservices/lib64/libbluetooth_jni.so (base::MessageLoop::RunTask(base::PendingTask*)+201) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.256  8496  8496 F DEBUG   :       #14 pc 0000000000cb955a  /apex/com.android.btservices/lib64/libbluetooth_jni.so (base::MessageLoop::DoWork()+586) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.269   593  3016 W system_server: Long monitor contention with owner binder:593_A (1840) at int com.android.server.pm.permission.PermissionManagerServiceImpl.checkPermissionInternal(com.android.server.pm.pkg.AndroidPackage, boolean, java.lang.String, int)(PermissionManagerServiceImpl.java:981) waiters=0 in int com.android.server.pm.permission.PermissionManagerServiceImpl.checkPermissionInternal(com.android.server.pm.pkg.AndroidPackage, boolean, java.lang.String, int) for 179ms
08-17 16:27:00.276  8496  8496 F DEBUG   :       #15 pc 0000000000cbc1b2  /apex/com.android.btservices/lib64/libbluetooth_jni.so (base::MessagePumpDefault::Run(base::MessagePump::Delegate*)+34) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.349  8496  8496 F DEBUG   :       #16 pc 0000000000ce3300  /apex/com.android.btservices/lib64/libbluetooth_jni.so (base::RunLoop::Run()+48) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.351  8496  8496 F DEBUG   :       #17 pc 0000000000700fc2  /apex/com.android.btservices/lib64/libbluetooth_jni.so (bluetooth::common::MessageLoopThread::Run(std::__1::promise<void>)+306) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.353  8496  8496 F DEBUG   :       #18 pc 0000000000700b2b  /apex/com.android.btservices/lib64/libbluetooth_jni.so (bluetooth::common::MessageLoopThread::RunThread(bluetooth::common::MessageLoopThread*, std::__1::promise<void>)+43) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.354  8496  8496 F DEBUG   :       #19 pc 0000000000701533  /apex/com.android.btservices/lib64/libbluetooth_jni.so (void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bluetooth::common::MessageLoopThread*, std::__1::promise<void>), bluetooth::common::MessageLoopThread*, std::__1::promise<void> > >(void*)+83) (BuildId: 07f121772f0589874ca9fdd71c8d3406)
08-17 16:27:00.354  8496  8496 F DEBUG   :       #20 pc 00000000000cd06a  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+58) (BuildId: fa337969c798946280caa45e2d71a2e7)
08-17 16:27:00.355  8496  8496 F DEBUG   :       #21 pc 0000000000062d88  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+56) (BuildId: fa337969c798946280caa45e2d71a2e7)
Harshil-Angel commented 1 year ago

The specific error, "android.os.DeadObjectException," indicates that the remote object you're trying to communicate with has died or become disconnected. This could be due to various reasons, including issues with the connection, device responsiveness, or scrcpy itself.

TheLittleNaruto commented 1 year ago

@rom1v Just to update, we are seeing no issue when we are using external Display connected via HDMI and along with a mouse connected through adb port. Do you think it is still issue with native Bluetooth stack crash?