Build MediaProviderLegacy with "system_current".

As a recent bug just reminded us, we can't have MediaProviderLegacy
depending on hidden APIs delivered through the APEX, since they're
unstable and can change at any time.

This requires a slight pivot of our original design strategy, where
the only shared code between the legacy and modern providers is the
DatabaseHelper logic.  This requires some side-stepping to ensure
that DatabaseHelper and its dependencies safely build against
"system_current".

We also adjust DatabaseHelper to only log metrics when running as
the real production database, to avoid noise from the legacy provider
and unit tests.

These changes also helped uncover that our unit tests were
technically running against MediaProviderLegacy, which no longer
holds the bulk of the code that needs to be tested.  It's tricky to
get an accurate instrumentation target because our tests live in
AOSP, but a device may have either the AOSP or Mainline version of
the module.  Thus we pull everything directly into MediaProviderTests
to ensure that we can run tests against it.

Bug: 146670970
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: Ib257793f5d8a12eb83e18b0eed6284e25d7c011c
diff --git a/tests/AndroidTest.xml b/tests/AndroidTest.xml
index d05ca2a..c4e5dcc 100644
--- a/tests/AndroidTest.xml
+++ b/tests/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Runs Tests for MediaProvder.">
     <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
         <option name="test-file-name" value="MediaProviderTests.apk" />
+        <option name="install-arg" value="-g" />
     </target_preparer>
 
     <option name="test-suite-tag" value="apct" />