We present a theory describing the trapping and untrapping of quasiparticles
in the Andreev bound level of a single-channel weak link between two
superconductors. We calculate the rates of the transitions between even and odd
occupations of the Andreev level induced by absorption and emission of both
photons and phonons. We apply the theory to a recent experiment [Phys. Rev.
Lett. 106, 257003 (2011)] in which the dynamics of the trapping of
quasiparticles in the Andreev levels of superconducting atomic contacts coupled
to a Josephson junction was measured. We show that the plasma energy hνp
of the Josephson junction defines a rather abrupt transition between a fast
relaxation regime dominated by coupling to photons and a slow relaxation regime
dominated by coupling to phonons. With realistic parameters the theory provides
a semi-quantitative description of the experimental results.Comment: 11 pages, 9 figures. Accepted for publication in Physical Review