Commit 58a81eb
authored
[Xamarin.Android.Build.Tasks] Fix up ForegroundService.ToString() (#8412)
Fixes: #8409
Context: #8272
The [`//service/@android:foregroundServiceType`][0] attribute can be
generated based on the value of the
`Android.App.ServiceAttribute.ForegroundServiceType` property:
[Service(ForegroundServiceType=ForegroundService.TypeCamera)]
partial class MyService : Service {
}
which will result in an `AndroidManifest.xml` fragment such as:
<service android:foregroundServiceType="camera" android:name="crc64….MyService" />
However, a number of `ForegroundService` enum values have been added
without corresponding updates to `ServiceAttribute` XML generation.
Consequently, using "recently added" values such as
`ForegroundService.TypeHealth` would result in those values *not*
being added to the generated `//service/@android:foregroundServiceType`.
Update `ManifestDocumentElement.cs` to update
`ToString(ForegroundService)` so that all current `ForegroundService`
enum values are supported. This will allow:
[Service(ForegroundServiceType=
ForegroundService.TypeCamera | // previously supported
ForegroundService.TypeMicrophone)] // new hawtness
partial class MyService : Service {
}
to properly emit:
<service android:foregroundServiceType="camera|microphone" android:name="crc64….MyService" />
[0]: https://developer.android.com/guide/topics/manifest/service-element#foregroundservicetype1 parent 6945132 commit 58a81eb
File tree
3 files changed
+46
-5
lines changed- src/Xamarin.Android.Build.Tasks
- Tests/Xamarin.Android.Build.Tests
- Utilities
- Utilities
3 files changed
+46
-5
lines changedLines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
908 | 908 | | |
909 | 909 | | |
910 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
911 | 938 | | |
912 | 939 | | |
913 | 940 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
387 | | - | |
388 | | - | |
| 386 | + | |
389 | 387 | | |
390 | | - | |
| 388 | + | |
391 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
392 | 406 | | |
393 | 407 | | |
394 | 408 | | |
| |||
0 commit comments