Limit ripple alpha to 50%

Many themes appear to have forgotten to set
the alphas value on the color state list they
pass to RippleDrawable. The previous implementation
always divided the alpha by 2 which resulted in
the accidentally opaque color being 50% opacity instead.

To match that behavior without adding back the
unusual divide by 2 we simply cap the alpha to 128.

Similarly we surpress the hover & focus events if
a press is already in progress, which prevents a funky
background flicker on views with FOCUSABLE_AUTO that
gain focus part way through a click event.

Also fixes a bug where rapid tapping resulted in the
hardware animation appearing to not play as it had
a start value of 0 instead of paint.getAlpha()
Software animation already has this correct behavior,
so no changes needed for the fallback path.

Bug: 72173993
Test: tested hangouts, pin entry
Change-Id: I7110779234422e82cdd5d737aa00c1280b13760c
3 files changed