[TrimmableTypeMap] Fix manifest builder gaps: SupportsGLTexture, UsesPermissionFlags, RoundIcon, dedup#11044
Draft
simonrozsival wants to merge 4 commits intodev/simonrozsival/scanner-manifest-attributesfrom
Conversation
- Add SupportsGLTextureAttribute scanning + <supports-gl-texture> emission - Add UsesPermissionFlags to UsesPermissionInfo + android:usesPermissionFlags emission - Add RoundIcon mapping for <permission>, <permission-group>, <permission-tree> - Add TODO comment for deferred BackupAgent/ManageSpaceActivity emission - Add scanner + generator tests for all three gaps - Add stub attributes + assembly-level usages in TestFixtures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add KnownAssemblyAttributes guard to skip non-manifest attributes - Add dedup for <permission-group> and <permission-tree> against template - Remove redundant #nullable enable from AssemblyLevelElementBuilder.cs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Closes feature gaps in the TrimmableTypeMap assembly-level manifest generation path so it matches the legacy ManifestDocument behavior (adds missing attribute scanning/emission and improves template dedup/perf).
Changes:
- Add scanning + manifest emission for
SupportsGLTexture,UsesPermissionFlags, and permissionRoundIconattributes. - Add assembly-level attribute filtering (
KnownAssemblyAttributes) to reduce scanning overhead. - Update unit tests/fixtures to cover new assembly-attribute scanning and manifest generation.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/TestFixtures/StubAttributes.cs | Adds stub attribute types used by scanning tests (UsesFeature/Permission/Library/MetaData/IntentFilter/SupportsGLTexture). |
| tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/TestFixtures/AssemblyAttributes.cs | Adds assembly-level attributes for scanner fixture coverage. |
| tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Scanner/AssemblyAttributeScanningTests.cs | New tests for assembly-level attribute scanning (including UsesPermissionFlags + SupportsGLTexture). |
| tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator/ManifestGeneratorTests.cs | Updates generator test helper to pass preloaded template; adds tests for new manifest emissions. |
| tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator/FixtureTestBase.cs | Caches both peers + scanned AssemblyManifestInfo for reuse across tests. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/UsesPermissionInfo.cs | Adds UsesPermissionFlags support to uses-permission model. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/UsesLibraryInfo.cs | Model for <uses-library>. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/UsesFeatureInfo.cs | Model for <uses-feature> including GLESVersion/Required. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/UsesConfigurationInfo.cs | Model for <uses-configuration>. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/SupportsGLTextureInfo.cs | Model for <supports-gl-texture>. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/PropertyInfo.cs | Model for <property>. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/PermissionTreeInfo.cs | Model for <permission-tree>. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/PermissionInfo.cs | Model for <permission>. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/PermissionGroupInfo.cs | Model for <permission-group>. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/MetaDataInfo.cs | Model for <meta-data> (record with required Name). |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/JavaPeerScanner.cs | Adds ScanAssemblyManifestInfo() and wires per-type ComponentAttribute into peers. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/JavaPeerInfo.cs | Clarifies comment for ComponentAttribute. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/IntentFilterInfo.cs | Model for intent filters (actions/categories/properties). |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/ComponentInfo.cs | Public component attribute model used for manifest generation. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/AssemblyManifestInfo.cs | Aggregates assembly-level manifest info lists + application properties. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/AssemblyIndex.cs | Implements assembly attribute scanning, known-attribute guard, and intent-filter/meta-data ordering fix. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/ManifestModel.cs | Removes legacy manifest model types (replaced by scanner records). |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/ManifestGenerator.cs | Changes Generate() to accept optional preloaded template XDocument and refactors default manifest creation. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/AssemblyLevelElementBuilder.cs | Emits new attributes/elements (RoundIcon, UsesPermissionFlags, supports-gl-texture) and adds dedup checks. |
tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator/FixtureTestBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/JavaPeerScanner.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/AssemblyLevelElementBuilder.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/AssemblyLevelElementBuilder.cs
Show resolved
Hide resolved
Replace the TODO with actual implementation: resolve managed type name strings from ApplicationProperties to JNI names via the scanned peers list, and emit android:backupAgent / android:manageSpaceActivity on the <application> element. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Dispose JavaPeerScanner in FixtureTestBase after scan completes - Remove unused typeDef/index params from ToComponentInfo - Use HashSet.Add() pattern for all dedup sets so cross-assembly duplicates are also prevented (not just template duplicates) - Fix squashed closing brace in permission-group block Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix gaps in the assembly-level manifest builder compared to the old
ManifestDocumentpath.Depends on #11035
Changes
SupportsGLTextureInforecord, scanner handling inScanAssemblyAttributes, and<supports-gl-texture>emission inAssemblyLevelElementBuilderUsesPermissionFlagsproperty toUsesPermissionInfo, extract in scanner, emit asandroid:usesPermissionFlagsandroid:roundIconmapping for<permission>,<permission-group>, and<permission-tree>elements<permission-group>and<permission-tree>against manifest templateParseNameAndPropertieswithKnownAssemblyAttributesHashSet to skip non-manifest attributes#nullable enablefromAssemblyLevelElementBuilder.csTests
SupportsGLTexture_ConstructorArg,UsesPermission_FlagsAssemblyLevel_SupportsGLTexture,AssemblyLevel_UsesPermissionFlags,AssemblyLevel_PermissionRoundIcon