title: Android: How to do instrumented tests with mocked locations?
body: <p>For instrumented tests of location services I need mocked locations. But the current concept from Android seems to be not very practical.</p>
  <p>In order to be allowed to use mocked locations the test-package also needs the permission <code>android.permission.ACCESS_MOCK_LOCATION</code>. When added to a debug-manifest I get the hint, that this permission will only be granted to System-Apps. I have to add <code>tools:ignore=&quot;ProtectedPermissions&quot;</code> to the permission to suppress this warning. IMHO it makes no sense to issue such a warning for a property that is necessary for such tests.</p>
  <p>Then I need to select this test-package as mock-location provider for the test-device. Acceptable for a manual test. But do I really have to manually select this setting for every device I want to test my code on? (What about this firebase-test on a farm of test devices? There I can not make this setting.)</p>
  <p>And what if I have more than one app that tests mocked location? Currently I can not test both packages on the same device.</p>
  <p>Or am I missing something?</p>