Repository navigation
Fix: ServiceAttribute is missing foregroundServiceType - #3810
Conversation
05661b4 to
f24dd6e
Compare
f8d3adf to
1b40e7e
Compare
3afae18 to
1a9bdf8
Compare
f16f94c to
39bcbb8
Compare
|
This should also add a test, probably by just using the new attribute in Regardless, there's a fundamental problem: the These do map (poorly) with the
static string ToString (ForegroundService value)
{
switch (value) {
case ForegroundService.TypeConnectedDevice: return "connectedDevice";
...
default:
throw new ArgumentException ($"Unsupported ForegroundService value '{value}'.", nameof(value));
}
}
static readonly Dictionary<Type, Func<object, ICustomAttributeProvider, IAssemblyResolver, int, string>> ValueConverters = new Dictionary<Type, Func<object, ICustomAttributeProvider, IAssemblyResolver, int, string>> () {
// ...
{ typeof (ForegroundService), (value, p, r, v) => ToString ((ForegroundService) value) },
};This should ensure that the generated |
b8bce10 to
5d6c4ff
Compare
3d386d4 to
d7580ef
Compare
| case ForegroundService.TypeConnectedDevice: return "connectedDevice"; | ||
| case ForegroundService.TypeDataSync: return "dataSync"; | ||
| case ForegroundService.TypeLocation: return "location"; | ||
| case ForegroundService.TypeManifest: return "manifest"; |
There was a problem hiding this comment.
Oddly, manifest isn't a documented value at: https://developer.android.com/guide/topics/manifest/service-element
I'm not sure what to make of that. Perhaps it shouldn't be supported, and should hit the default case?
There was a problem hiding this comment.
Good catch!
I opened Android Studio and it is not an option on the given list. So I guess it is not supported and should hit default case.
There was a problem hiding this comment.
This is something to keep in mind if/when you get around to auto-producing these custom attributes based on the manifest XML: the XML may contain values which are not documented and which Android Studio doesn't "support".
I'm not sure if this can be fully automated.
(Though even partial automation would presumably be an improvement.)
d7580ef to
1e24630
Compare
|
Does this allow for multiple foreground service types? |
Fixes: dotnet#3712 API-29 added a new [`//service/@android:foregroundServiceType`][0] attribute to `AndroidManifest.xml`, but we forgot to bind this attribute as an `Android.App.ServiceAttribute.ForegroundServiceType` property so that the attribute could be *generated*. Add a `ServiceAttribute.ForegroundServiceType` property, which when set will emit the `//service/@android:foregroundServiceType` attribute within `AndroidManifest.xml`. [0]: https://developer.android.com/guide/topics/manifest/service-element#foregroundservicetype
Fixes: #3712 API-29 added a new [`//service/@android:foregroundServiceType`][0] attribute to `AndroidManifest.xml`, but we forgot to bind this attribute as an `Android.App.ServiceAttribute.ForegroundServiceType` property so that the attribute could be *generated*. Add a `ServiceAttribute.ForegroundServiceType` property, which when set will emit the `//service/@android:foregroundServiceType` attribute within `AndroidManifest.xml`. [0]: https://developer.android.com/guide/topics/manifest/service-element#foregroundservicetype
Our tools currently do not automatically add new manifest properties.
Manually adding ForegroundServiceType property to ServiceAttribute class
Tracking issue: #3712