Build android.test.base/legacy against SDK

android.test.legacy is now build against SDK, thus available to apps
build with SDK.

In doing so, android.test.mock.stubs had to be built with SDK (because
it is used by android.test.legacy). However, this wasn't trivial.

The problem was that some classes in test-mock implemented abstract
methods of platform classes. Even though they are marked as @hide,
doclava automatically emit them to the stub file because otherwise the
class in the stub file does not implement some abstract methods from its
parent class, which in turn makes the stub file non-compilable.

This CL solves the problem by introducing an adapter class in between
the class in test-mock and the class in the framework. The adapter class
implements abstract methods which are @hide and having reference to
types that aren't available to SDK. The abstract methods are removed
from the original class. Then doclava does not emit the abstract
methods.

Also by @hide'ing the adapter classes, they are not compiled when
building the stub library.

Bug: 30188076
Bug: 73339598
Test: m -j android.test.base
Test: m -j android.test.legacy
Test: m -j android.test.mock.stubs
are successful and do not show link-check warning
Merged-In: I8e432950e693ee3c6f0240852e62da6133d31571
Change-Id: I8e432950e693ee3c6f0240852e62da6133d31571
5 files changed