Introduce profile rules to compose modules
Relnote:"""
Adds profile rules to the following compose modules:
androidx.compose.animation
androidx.compose.animation-core
androidx.compose.foundation
androidx.compose.foundation-layout
androidx.compose.material
androidx.compose.material-ripple
androidx.compose.runtime
androidx.compose.ui
androidx.compose.ui.geometry
androidx.compose.ui.graphics
androidx.compose.ui.text
androidx.compose.ui.text
androidx.compose.ui.unit
androidx.compose.ui.util
What are profile rules?
===
Profile rules for a library are specified in a text file `baseline-prof.txt` located in the `src/main` or equivalent directory. The file specifies a rule per line, where a rule in this case is a pattern for matching to methods or classes in the library. The syntax for these rules is a superset of the human-readable ART profile format that is used when using `adb shell profman --dump-classes-and-methods ...`. These rules take one of two forms to target either methods or classes.
A method rule will have the following pattern:
```
<FLAGS><CLASS_DESCRIPTOR>-><METHOD_SIGNATURE>
```
And a class rule will have the following pattern:
```
<CLASS_DESCRIPTOR>
```
Here `<FLAGS>` is one or more of the characters `H`, `S`, and `P` to indicate whether or not this method should be flagged as “Hot”, “Startup”, or “Post Startup”.
The `<CLASS_DESCRIPTOR>` is the descriptor for the class that the targeted method belongs to. For example, the class `androidx.compose.runtime.SlotTable` would have a descriptor of `Landroidx/compose/runtime/SlotTable;`.
The `<METHOD_SIGNATURE>` is the signature of the method, and includes the name, parameter types, and return types of the method. For example, the method `fun isPlaced(): Boolean` on `LayoutNode` has the signature `isValid()Z`.
These patterns can have wildcards (`**`, `*`, and `?`) in order to have a single rule encompass multiple methods or classes.
What do the rules do?
===
A method that has the flag `H` indicates that this method is a "hot" method, and should be compiled ahead of time.
A method that has the flag `S` indicates that it is a method which is called at startup, and should be compiled ahead of time to avoid the cost of compilation and interpreting the method at startup time.
A method that has the flag `P` indicates that it is a method which is called after startup.
A class that is present in this file indicates that it is used during startup and should be pre-allocated in the heap to avoid the cost of class loading.
How does this work?
===
Libraries can define these rules which will be packaged in AAR artifacts. When an APK is then built which includes these artifacts, these rules are merged together and the merged rules are used to build a compact binary ART profile that is specific to the APK. ART can then leverage this profile when the APK is installed on devices in order to ahead-of-time compile a specific subset of the application to improve the performance of the application, especially the first run. Note that this will have no effect on debuggable applications.
"""
Change-Id: I14ed64578d535320a40ed8d486f75715641b2762
diff --git a/gradle.properties b/gradle.properties
index fc4663d..220234a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -28,3 +28,6 @@
# Do not automatically include stdlib
kotlin.stdlib.default.dependency=false
+
+# Enable adding baseline-prof.txt files to AAR artifacts
+android.experimental.enableArtProfiles=true
\ No newline at end of file