Fix lock visiting for synchronized native methods.

The `GetGenericJniSynchronizationObject()` function was used
in the wrong context. As documented, it can be used only for
a method with a GenericJni frame and also on the top of the
stack. When visiting locks, we can have a non-GenericJni
method frame as well as a method deeper in the stack.
Replace the wrong use with specialized code.

(cherry picked from commit 654f01cd509ca11eae22177d4e764f1241fb3a53)

Test: Added regression test to 178-app-image-native-methods
Test: testrunner.py --host --debug --ndebug
Bug: 172332525
Bug: 189235039
Merged-In: Ia26f0b980c04a766e31b1588a1c011bcf46c90d8
Change-Id: I48af0e2838cda4774b8129927ea04cee9cf3a9f8
4 files changed