Have adbconnection handle DDMS packets if agent not loaded
If DDMS was being used on a userdebug or eng build it would cause the
libjdwp agent to be loaded on various system processes, most notably
system_server. This would cause a massive performance hit as it tries
to force system_server to jit but, due to security policies, it is
forced to interpreter instead.
To fix this we make it so that (so long as no debugger commands are
issued) DDMS commands are handled without loading the JDWP agent. When
a non-DDMS command is issued we will load and initialize the JDWP
agent which will take over handling DDMS traffic from then on.
This will ensure that in the common (for userdebug) use-case where
processes only encounter DDMS commands the process will not need to
load the full debugger.
Test: ./test.py --host -j50
Test: ./art/tools/run-libjdwp-tests.sh --mode=device
Test: Run ddms monitor on host,
adb shell stop &&
adb shell setprop dalvik.vm.jdwp-provider adbconnection
adb shell start;
Ensure that device does not start to jank
Test: Run ddms monitor on host,
adb shell stop &&
adb shell setprop dalvik.vm.jdwp-provider adbconnection
adb shell start;
Turn off ddms monitor.
Ensure that device does not start to jank
Test: Build and run
Test: use ddms monitor.
Test: Use Android Studio.
Test: Build and debug debuggable app (bandhook-kotlin)
Test: Build and debug non-debuggable app on userdebug build
(bandhook-kotlin)
Test: Debug running system process on userdebug build
(com.android.packageinstaller)
Bug: 62821960
Bug: 72456312
Bug: 72457427
Change-Id: Ib8d2af6c76bd2fac5a4b27e730695b2d016d3583
6 files changed