Skip to content
Commit da74a628 authored by Piotr Jastrzebski's avatar Piotr Jastrzebski
Browse files

Register DDM handlers at the beginning of main method.

Compiler initializes RuntimeInit during compilation and stores an
initialized version of the class in oat file. Same thing happens to
DdmServer which handles DDM packets in JDWP thread started during JVM
creation. This means that after the creation of JVM all
DDM packets are handled by DdmServer.dispatch and since it's already
initialized during compilation it has all framework related handlers
already registered. If a packet arrives before AndroidRuntime.startReg
is called then framework native methods are not yet registered and the
processing of the packet fails with UnsatisfiedLinkError.

To fix this problem the registration of framework related DDM handlers
is moved to the beginning of ZygoteInit.main and RuntimeInit.main. This
means that the handlers won't be registered until main method is called
and that's guaranteed to be after AndroidRuntime.startReg is called. It
also guarantees that DDM packets will be properly handled as soon as
Java code is executed.

Bug: 18081539.
Change-Id: I9c674f53f3f62d58c46886e0b60698182e08f0c3
parent b4a5c04c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment