Fix verifier/linker IncompatibleClassChangeError with hidden API

The verifier and class linker will attempt to find a method with
the wrong type if it could not be found with the original type,
i.e an interface method on a regular class and vice versa.

This logic did not previously take hidden API restrictions into
account and would result in bogus error messages to the user or
debug crashes.

Bug: 64382372
Bug: 77464273
Test: art/test.py -r -t 674-hiddenapi
Change-Id: If8327a70dd73b90249da3d9e505f0c6f89838f8e
9 files changed