Fix Class.getDeclaringClass bug

(cherry-picked from commit 10197124acd5d6ec4c082a4763932952ee3529ad)

Bug: https://code.google.com/p/android/issues/detail?id=61003
Change-Id: Ie97d12acd7a8897c336c183dac8837769e1b9c5a