Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntentFilterAttribute is missing PathSuffix and PathAdvancePattern #8235

Closed
Digifais opened this issue Aug 3, 2023 · 4 comments · Fixed by #8261
Closed

IntentFilterAttribute is missing PathSuffix and PathAdvancePattern #8235

Digifais opened this issue Aug 3, 2023 · 4 comments · Fixed by #8261
Assignees
Labels
Area: Mono.Android Issues with the Android API binding (Mono.Android.dll).
Milestone

Comments

@Digifais
Copy link

Digifais commented Aug 3, 2023

Android application type

Classic Xamarin.Android (MonoAndroid12.0, etc.), .NET Android (net7.0-android, etc.)

Affected platform version

Xamarin.Android 13.2.0.6, .NET 7.0.306

Description

IntentFilterAttribute is missing PathSuffix and PathAdvancePattern, which were introduced in API 31. Cfr: https://developer.android.com/guide/topics/manifest/data-element#path

Steps to Reproduce

Add an IntentFilterAttribute to any activity and you see that those two data element attributes are not exposed.

Did you find any workaround?

You can manually add this to your Android Manifest instead of using an IntentFilterAttribute.

Relevant log output

No response

@Digifais Digifais added Area: Mono.Android Issues with the Android API binding (Mono.Android.dll). needs-triage Issues that need to be assigned. labels Aug 3, 2023
@jpobst
Copy link
Contributor

jpobst commented Aug 3, 2023

@dellis1972 @jonathanpeppers

It looks like this is split between Mono.Android and Xamarin.Android.Build.Tasks, is this something you guys normally handle?

‎src/Mono.Android/Android.App/IntentFilterAttribute.cs
src/Xamarin.Android.Build.Tasks/Mono.Android/IntentFilterAttribute.Partial.cs

@jonathanpeppers
Copy link
Member

I don't think anyone is doing anything for these. The build tasks part is what emits the XML during the build.

How do we make it part of the binding process for new API levels? /cc @jonpryor

@jpobst
Copy link
Contributor

jpobst commented Aug 3, 2023

It looks like we have this:
https://github.com/xamarin/xamarin-android/tree/main/build-tools/manifest-attribute-codegen

Perhaps I can look at extending it to generate the code we need.

@jpobst jpobst removed the needs-triage Issues that need to be assigned. label Aug 3, 2023
@jpobst
Copy link
Contributor

jpobst commented Aug 7, 2023

Given the timelines for .NET 8, I think I will forgo writing a tool to do this for now, and manually add these requested attributes using this as a guide: #3810

For .NET 9 we should probably look at developing a tool to automatically pull in new attributes and generate the needed code.

@jpobst jpobst added this to the .NET 8 milestone Aug 7, 2023
jonpryor pushed a commit that referenced this issue Aug 18, 2023
Fixes: #8235

Context: #8272

Add the following properties to `IntentFilterAttribute` to allow
the various `AndroidManifest.xml` [`<data/>`][0] attributes to
be generated:

  - `IntentFilterAttribute.DataPathSuffix` generates
    [`//intent-filter/data/@pathSuffix`][1].
  - `IntentFilterAttribute.DataPathSuffixes` generates
    [`//intent-filter/data/@pathSuffix`][1].
  - `IntentFilterAttribute.DataPathAdvancedPattern` generates
    [`//intent-filter/data/@pathAdvancedPattern`][1].
  - `IntentFilterAttribute.DataPathAdvancedPatterns` generates
    [`//intent-filter/data/@pathAdvancedPattern`][1].

Note that while we have a script to detect new elements added to
`AndroidManifest.xml`, the code must be written manually.

TODO: Issue #8272 to automate this code generation.

[0]: https://developer.android.com/guide/topics/manifest/data-element
[1]: https://developer.android.com/guide/topics/manifest/data-element#path
jonathanpeppers pushed a commit that referenced this issue Aug 22, 2023
Fixes: #8235

Context: #8272

Add the following properties to `IntentFilterAttribute` to allow
the various `AndroidManifest.xml` [`<data/>`][0] attributes to
be generated:

  - `IntentFilterAttribute.DataPathSuffix` generates
    [`//intent-filter/data/@pathSuffix`][1].
  - `IntentFilterAttribute.DataPathSuffixes` generates
    [`//intent-filter/data/@pathSuffix`][1].
  - `IntentFilterAttribute.DataPathAdvancedPattern` generates
    [`//intent-filter/data/@pathAdvancedPattern`][1].
  - `IntentFilterAttribute.DataPathAdvancedPatterns` generates
    [`//intent-filter/data/@pathAdvancedPattern`][1].

Note that while we have a script to detect new elements added to
`AndroidManifest.xml`, the code must be written manually.

TODO: Issue #8272 to automate this code generation.

[0]: https://developer.android.com/guide/topics/manifest/data-element
[1]: https://developer.android.com/guide/topics/manifest/data-element#path
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Mono.Android Issues with the Android API binding (Mono.Android.dll).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants