I was thinking of another path for the solution. Directly connect your keyboard and mouse to the mobile phone e.g. through Type-C USB-C Male to USB-A Female Adapter OTG Cable. Then, a cursor will appear on the Android screen, much like a PC screen. You may use a KVM to quickly switch the keyboard and mouse between the PC and mobile.
One can change a complex software problem into a simple hardware problem.