Remove need for <queries> tag in macrobenchmarks

Fixes: 181061376
Test: SmallListStartupBenchmark

Request QUERY_ALL_PACKAGES for all macrobenchmarks to ensure we can
always query profileable / debuggable / default intent for a package.

Change-Id: I873ece5a5141bdf0e602a00b184742ff43f9c741
diff --git a/benchmark/docs/macrobenchmark.md b/benchmark/docs/macrobenchmark.md
index 1383bb7..1f74fd0 100644
--- a/benchmark/docs/macrobenchmark.md
+++ b/benchmark/docs/macrobenchmark.md
@@ -100,26 +100,6 @@
 }
 ```
 
-The macrobenchmark module needs to declare that it is going to `query` the app being benchmarked
-(called the *target* of the macrobenchmark). This is to account for
-[Package visibility restrictions](https://developer.android.com/about/versions/11/privacy/package-visibility)
-in Android 11.
-
-Add the following snippet to the module's `AndroidManifest.xml`.
-
-```xml
-<!-- This snippet needs be in `src/main/AndroidManifest.xml` for the macrobenchmark module -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.example.macrobenchmark">
-
-    <queries>
-        <!-- The macrobenchmark target package -->
-        <package android:name="com.example.macrobenchmark.target" />
-    </queries>
-    <!-- ... -->
-</manifest>
-```
-
 See the [sample macrobenchmark module](https://github.com/android/performance-samples/tree/macrobenchmark/MacrobenchmarkSample/macrobenchmark)
 for reference.
 
diff --git a/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml b/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
index 2f8615f..d0f8ec9 100644
--- a/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
+++ b/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
@@ -14,18 +14,4 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="androidx.benchmark.integration.macrobenchmark.test">
-
-    <!--
-    The Macro Benchmark Sample needs to launch activities in
-    `androidx.benchmark.integration.macrobenchmark.target` APK.
-
-    The Macro Benchmark Library uses `PackageManager` to query for activities. This requires
-     the test APK to declare that `androidx.benchmark.integration.macrobenchmark.target` be
-     visible to the APK (given Android 11's package visibility rules).
-    -->
-    <queries>
-        <package android:name="androidx.benchmark.integration.macrobenchmark.target" />
-    </queries>
-</manifest>
+<manifest package="androidx.benchmark.integration.macrobenchmark.test"/>
diff --git a/benchmark/macro/src/main/AndroidManifest.xml b/benchmark/macro/src/main/AndroidManifest.xml
index a599d46..bf2756d 100644
--- a/benchmark/macro/src/main/AndroidManifest.xml
+++ b/benchmark/macro/src/main/AndroidManifest.xml
@@ -14,4 +14,17 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<manifest package="androidx.benchmark.macro"/>
+<manifest xmlns:tools="http://schemas.android.com/tools"
+    package="androidx.benchmark.macro"
+    xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <!-- QUERY_ALL_PACKAGES is used to enable macrobenchmarks to read package information from
+    potential target packages, e.g. for querying debuggable, profileable, or default launch intent.
+
+    This could also be done by making each macrobenchmark specify a <queries/> tag, with the
+    target package, but this removes the need for documenting that setup step, and detecting
+    misconfiguration.
+    -->
+    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
+        tools:ignore="QueryAllPackagesPermission" />
+</manifest>
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml b/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
index 82ef367..0718de4 100644
--- a/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
@@ -14,18 +14,4 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="androidx.compose.integration.macrobenchmark.test">
-
-    <!--
-    The Macro Benchmark Sample needs to launch activities in
-    `androidx.compose.integration.macrobenchmark.target` APK.
-
-    The Macro Benchmark Library uses `PackageManager` to query for activities. This requires
-     the test APK to declare that `androidx.compose.integration.macrobenchmark.target` be visible to
-     the APK (given Android 11's package visibility rules).
-    -->
-    <queries>
-        <package android:name="androidx.compose.integration.macrobenchmark.target" />
-    </queries>
-</manifest>
+<manifest package="androidx.compose.integration.macrobenchmark.test"/>