Refactor DialpadFragment's DtmfKeyListener

This change is the refactoring on DtmfKeyListener and adding
tests. The class is an overridden version of DialerKeyListener, but it also
supports direct onKeyDown and onKeyUp hooks from the DialpadFragment. There was
a lot of duplicated code between these hooks and the overridden methods so the
code was refactored to share more logic. The interesting part of this change is
using EMPTY_SPANNABLE to call into super type methods instead of having to copy
the implementation.

This change may also help with OutOfMemoryExceptions because the DtmfKeyListener
is promoted from a non-static inner class to a top level class. It no longer
maintains an implicit reference to the DialpadFragment, holding onto the
DialpadPresenter instead.

To support testing this code, the ShadowCall had to be updated since it didn't
support checking when a Dtmf tone was playing.

Bug: 69133398
Test: DtmfKeyListenerTest, InCallActivityTest
PiperOrigin-RevId: 177092841
Change-Id: I368083c71982e14db0ad936432a3a5bdf0dde5ee
2 files changed