1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.content.pm.parsing.cts.generator.api
18 
19 /**
20  * Used to annotate a triple quoted string literal in order to automatically build an APK host side
21  * so that tests don't need to configure individual test apps for each iteration.
22  *
23  * Note that this only supports actual string constants, with no inline format or variations. The
24  * string in the source file must exactly match the string that will be passed to [ApkGenerator],
25  * which will look up the appropriate APK by hash code.
26  *
27  * Sample usage:
28  * ```kotlin
29  * fun someTestMethod() {
30  *     @AndroidManifestXml
31  *     val xml = """
32  *         <manifest xmlns:android="http://schemas.android.com/apk/res/android">
33  *             <uses-sdk android:targetSdkVersion="30"/>
34  *             <application/>
35  *         </manifest>
36  *     """
37  *     val result = ApkGenerator.install(device, xml, tempFolder)
38  *     ...
39  * }
40  * ```
41  *
42  * **Note:** The string *cannot* end with [String.trimIndent] as this will alter the hash code.
43  */
44 @Target(
45     AnnotationTarget.EXPRESSION,
46     AnnotationTarget.LOCAL_VARIABLE,
47     AnnotationTarget.TYPE_PARAMETER,
48     AnnotationTarget.VALUE_PARAMETER,
49 )
50 @Retention(AnnotationRetention.SOURCE)
51 annotation class AndroidManifestXml
52