  We study heavy flavor evolution in the quark-gluon plasma matter and the
subsequent hadron gas created in ultrarelativistic heavy-ion collisions. The
motion of heavy quarks inside the QGP is described using our modified Langevin
framework that incorporates both collisional and radiative energy loss
mechanisms; and the scatterings between heavy mesons and the hadron gas are
simulated with the UrQMD model. We find that the hadronic interaction further
suppresses the $D$ meson $R_\mathrm{AA}$ at high $p_\mathrm{T}$ and enhances
its $v_2$. And our calculations provide good descriptions of experimental data
from both RHIC and LHC. In addition, we explore the heavy-flavor-tagged angular
correlation functions and find them to be a potential candidate for
distinguishing different energy loss mechanisms of heavy quarks inside the QGP.
