Skip to content

Android.Telecom.InCallService SetAudioRoute(int route) #2472

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

Closed
lfarthing opened this issue Nov 30, 2018 · 1 comment · Fixed by #7711
Closed

Android.Telecom.InCallService SetAudioRoute(int route) #2472

lfarthing opened this issue Nov 30, 2018 · 1 comment · Fixed by #7711
Assignees
Labels
Area: Mono.Android Issues with the Android API binding (Mono.Android.dll). bug Component does not function as intended.
Milestone

Comments

@lfarthing
Copy link

This is in reference to #2437 which was marked as closed before having a discussion about it, I have upgraded to Mono.Android v9.0 however the accepted parameter for VideoQuality is still incorrect. The generated enum doesn't match the values that are required for this method.

https://developer.android.com/reference/android/telecom/CallAudioState

If I wanted to set the audio route as Speaker I would need to pass in an enum that has a value of 8. The correct parameter would be the enum Android.Telecom.CallAudioRoute.

@jonathanpeppers jonathanpeppers added Area: App Runtime Issues in `libmonodroid.so`. bug Component does not function as intended. labels Dec 3, 2018
@jonathanpeppers jonathanpeppers added this to the far future milestone Dec 4, 2018
@jonathanpeppers
Copy link
Member

I think this has likely been wrong since API 23 support was added: 85a8162

I can see a few methods we have "enumified":

> git grep setAudioRoute
build-tools/enumification-helpers/methodmap.ext.csv:23, android.telecom, InCallService, setAudioRoute, route, Android.Telecom.VideoQuality
build-tools/enumification-helpers/methodmap.ext.csv:26, android.telecom, Connection, setAudioRoute, route, Android.Telecom.CallAudioRoute

I think the proper binding would use Android.Telecom.CallAudioRoute enum instead of Android.Telecom.VideoQuality. We are already doing this for Android.Telecom.Connection.SetAudioRoute, so the methods should be the same.

However...

Since this API was shipped, we will have to add an overload using CallAudioRoute, and deprecate the old one.

For now you could use workaround such as:

//Not ideal
foo.SetAudioRoute ((VideoQuality)CallAudioRoute.Speaker);

jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Jul 14, 2021
Changes: JamesNK/Newtonsoft.Json@12.0.3...13.0.1

  * JamesNK/Newtonsoft.Json@ae9fe44e: Remove compiler package and update sourcelink (dotnet#2498)
  * JamesNK/Newtonsoft.Json@8ef66218: Remove prerelease for 13.0.1
  * JamesNK/Newtonsoft.Json@11331f50: Update SDK to 5.0.200 (dotnet#2495)
  * JamesNK/Newtonsoft.Json@c7e8abc0: Update to 13.0.1-beta2
  * JamesNK/Newtonsoft.Json@1745d7c1: Fix JTokenWriter when writing comment to an object (dotnet#2493)
  * JamesNK/Newtonsoft.Json@583eb120: Fix missing error when deserializing JToken with a contract type mismatch (dotnet#2494)
  * JamesNK/Newtonsoft.Json@b6dc05be: Change MaxDepth default to 64 (dotnet#2473)
  * JamesNK/Newtonsoft.Json@15525f1c: Fix JsonWriter.WriteToken to allow null with string token (dotnet#2472)
  * JamesNK/Newtonsoft.Json@926d2f0f: Enable embed untracked sources (dotnet#2471)
  * JamesNK/Newtonsoft.Json@0a56633b: Fixes dotnet#2372 - variable typos (dotnet#2465)
  * JamesNK/Newtonsoft.Json@5a35c77d: Update version to 13.0.1 (dotnet#2463)
  * JamesNK/Newtonsoft.Json@7e77bbe1: Change JsonReader and JsonSerializer default max depth to 128 (dotnet#2462)
  * JamesNK/Newtonsoft.Json@42139ea6: Add JsonSelectSettings and regex timeout
  * JamesNK/Newtonsoft.Json@95a6eb3a: jpath regex timeout support added for a single regex expression, global umbrella for all regex calls, and support for allowing regex calls to get compiled if necessary
  * JamesNK/Newtonsoft.Json@1403f5d3: Fix serializing nullable struct dictionaries (dotnet#2452)
  * JamesNK/Newtonsoft.Json@60be32f4: Use naming strategy when deserializing dictionary enum keys (dotnet#2448)
  * JamesNK/Newtonsoft.Json@ff5ffb28: Copy annotations when cloning elements (dotnet#2442)
  * JamesNK/Newtonsoft.Json@0cf47a46: Missing nullability annotation (dotnet#2438)
  * JamesNK/Newtonsoft.Json@6795ca55: Fixed tests to work in Moscow, Russia UTC+3 timezone. (dotnet#2416)
  * JamesNK/Newtonsoft.Json@c918ca86: Code Typo Fix: Universial => Universal (dotnet#2383)
  * JamesNK/Newtonsoft.Json@c298f3d6: Fix typo in SerializeTypeNameHandling sample (dotnet#2428)
  * JamesNK/Newtonsoft.Json@a222c8b6: Update to net50 and fix warnings (dotnet#2424)
  * JamesNK/Newtonsoft.Json@666d9760: Fix wrong define is used in StringUtils.ToLower() (dotnet#2304)
  * JamesNK/Newtonsoft.Json@a31156e9: Update NullValueHandlingIgnore.aml (dotnet#2226)
  * JamesNK/Newtonsoft.Json@936acbf6: Update version to 13.0.1-beta and remove portable builds (dotnet#2228)
  * JamesNK/Newtonsoft.Json@9be95e0f: Do not treat ignored field as missing member when deserializing from overriden json constructor (dotnet#2224)
jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Jul 15, 2021
Changes: JamesNK/Newtonsoft.Json@12.0.3...13.0.1

  * JamesNK/Newtonsoft.Json@ae9fe44e: Remove compiler package and update sourcelink (dotnet#2498)
  * JamesNK/Newtonsoft.Json@8ef66218: Remove prerelease for 13.0.1
  * JamesNK/Newtonsoft.Json@11331f50: Update SDK to 5.0.200 (dotnet#2495)
  * JamesNK/Newtonsoft.Json@c7e8abc0: Update to 13.0.1-beta2
  * JamesNK/Newtonsoft.Json@1745d7c1: Fix JTokenWriter when writing comment to an object (dotnet#2493)
  * JamesNK/Newtonsoft.Json@583eb120: Fix missing error when deserializing JToken with a contract type mismatch (dotnet#2494)
  * JamesNK/Newtonsoft.Json@b6dc05be: Change MaxDepth default to 64 (dotnet#2473)
  * JamesNK/Newtonsoft.Json@15525f1c: Fix JsonWriter.WriteToken to allow null with string token (dotnet#2472)
  * JamesNK/Newtonsoft.Json@926d2f0f: Enable embed untracked sources (dotnet#2471)
  * JamesNK/Newtonsoft.Json@0a56633b: Fixes dotnet#2372 - variable typos (dotnet#2465)
  * JamesNK/Newtonsoft.Json@5a35c77d: Update version to 13.0.1 (dotnet#2463)
  * JamesNK/Newtonsoft.Json@7e77bbe1: Change JsonReader and JsonSerializer default max depth to 128 (dotnet#2462)
  * JamesNK/Newtonsoft.Json@42139ea6: Add JsonSelectSettings and regex timeout
  * JamesNK/Newtonsoft.Json@95a6eb3a: jpath regex timeout support added for a single regex expression, global umbrella for all regex calls, and support for allowing regex calls to get compiled if necessary
  * JamesNK/Newtonsoft.Json@1403f5d3: Fix serializing nullable struct dictionaries (dotnet#2452)
  * JamesNK/Newtonsoft.Json@60be32f4: Use naming strategy when deserializing dictionary enum keys (dotnet#2448)
  * JamesNK/Newtonsoft.Json@ff5ffb28: Copy annotations when cloning elements (dotnet#2442)
  * JamesNK/Newtonsoft.Json@0cf47a46: Missing nullability annotation (dotnet#2438)
  * JamesNK/Newtonsoft.Json@6795ca55: Fixed tests to work in Moscow, Russia UTC+3 timezone. (dotnet#2416)
  * JamesNK/Newtonsoft.Json@c918ca86: Code Typo Fix: Universial => Universal (dotnet#2383)
  * JamesNK/Newtonsoft.Json@c298f3d6: Fix typo in SerializeTypeNameHandling sample (dotnet#2428)
  * JamesNK/Newtonsoft.Json@a222c8b6: Update to net50 and fix warnings (dotnet#2424)
  * JamesNK/Newtonsoft.Json@666d9760: Fix wrong define is used in StringUtils.ToLower() (dotnet#2304)
  * JamesNK/Newtonsoft.Json@a31156e9: Update NullValueHandlingIgnore.aml (dotnet#2226)
  * JamesNK/Newtonsoft.Json@936acbf6: Update version to 13.0.1-beta and remove portable builds (dotnet#2228)
  * JamesNK/Newtonsoft.Json@9be95e0f: Do not treat ignored field as missing member when deserializing from overriden json constructor (dotnet#2224)

The `PackagingTest.NetStandardReferenceTest()` test is updated to no
longer list `Microsoft.CSharp.dll` as an expected file, as with
`Newtonsoft.Json.dll` v13.0.1, our build now consumes the
netstandard2.0-profile version, not the netstandard1.3 version, and
the netstandard 2.0 version doesn't require `Microsoft.CSharp.dll`.
jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Jul 15, 2021
Changes: JamesNK/Newtonsoft.Json@12.0.3...13.0.1

  * JamesNK/Newtonsoft.Json@ae9fe44e: Remove compiler package and update sourcelink (dotnet#2498)
  * JamesNK/Newtonsoft.Json@8ef66218: Remove prerelease for 13.0.1
  * JamesNK/Newtonsoft.Json@11331f50: Update SDK to 5.0.200 (dotnet#2495)
  * JamesNK/Newtonsoft.Json@c7e8abc0: Update to 13.0.1-beta2
  * JamesNK/Newtonsoft.Json@1745d7c1: Fix JTokenWriter when writing comment to an object (dotnet#2493)
  * JamesNK/Newtonsoft.Json@583eb120: Fix missing error when deserializing JToken with a contract type mismatch (dotnet#2494)
  * JamesNK/Newtonsoft.Json@b6dc05be: Change MaxDepth default to 64 (dotnet#2473)
  * JamesNK/Newtonsoft.Json@15525f1c: Fix JsonWriter.WriteToken to allow null with string token (dotnet#2472)
  * JamesNK/Newtonsoft.Json@926d2f0f: Enable embed untracked sources (dotnet#2471)
  * JamesNK/Newtonsoft.Json@0a56633b: Fixes dotnet#2372 - variable typos (dotnet#2465)
  * JamesNK/Newtonsoft.Json@5a35c77d: Update version to 13.0.1 (dotnet#2463)
  * JamesNK/Newtonsoft.Json@7e77bbe1: Change JsonReader and JsonSerializer default max depth to 128 (dotnet#2462)
  * JamesNK/Newtonsoft.Json@42139ea6: Add JsonSelectSettings and regex timeout
  * JamesNK/Newtonsoft.Json@95a6eb3a: jpath regex timeout support added for a single regex expression, global umbrella for all regex calls, and support for allowing regex calls to get compiled if necessary
  * JamesNK/Newtonsoft.Json@1403f5d3: Fix serializing nullable struct dictionaries (dotnet#2452)
  * JamesNK/Newtonsoft.Json@60be32f4: Use naming strategy when deserializing dictionary enum keys (dotnet#2448)
  * JamesNK/Newtonsoft.Json@ff5ffb28: Copy annotations when cloning elements (dotnet#2442)
  * JamesNK/Newtonsoft.Json@0cf47a46: Missing nullability annotation (dotnet#2438)
  * JamesNK/Newtonsoft.Json@6795ca55: Fixed tests to work in Moscow, Russia UTC+3 timezone. (dotnet#2416)
  * JamesNK/Newtonsoft.Json@c918ca86: Code Typo Fix: Universial => Universal (dotnet#2383)
  * JamesNK/Newtonsoft.Json@c298f3d6: Fix typo in SerializeTypeNameHandling sample (dotnet#2428)
  * JamesNK/Newtonsoft.Json@a222c8b6: Update to net50 and fix warnings (dotnet#2424)
  * JamesNK/Newtonsoft.Json@666d9760: Fix wrong define is used in StringUtils.ToLower() (dotnet#2304)
  * JamesNK/Newtonsoft.Json@a31156e9: Update NullValueHandlingIgnore.aml (dotnet#2226)
  * JamesNK/Newtonsoft.Json@936acbf6: Update version to 13.0.1-beta and remove portable builds (dotnet#2228)
  * JamesNK/Newtonsoft.Json@9be95e0f: Do not treat ignored field as missing member when deserializing from overriden json constructor (dotnet#2224)

The `PackagingTest.NetStandardReferenceTest()` test is updated, as
the list of implicitly referenced assemblies changed:

  * `Microsoft.CSharp.dll` is no longer referenced
  * `System.Data.dll` is now referenced.

It appears that the primary cause of this change is that with
`Newtonsoft.Json` 12.0.3, the .NET Standard 1.3-profile assemblies
were included into the app, while with 13.0.1, the .NET Standard-2.0
profile assemblies are instead used.
jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Jul 16, 2021
Changes: JamesNK/Newtonsoft.Json@12.0.3...13.0.1

  * JamesNK/Newtonsoft.Json@ae9fe44e: Remove compiler package and update sourcelink (dotnet#2498)
  * JamesNK/Newtonsoft.Json@8ef66218: Remove prerelease for 13.0.1
  * JamesNK/Newtonsoft.Json@11331f50: Update SDK to 5.0.200 (dotnet#2495)
  * JamesNK/Newtonsoft.Json@c7e8abc0: Update to 13.0.1-beta2
  * JamesNK/Newtonsoft.Json@1745d7c1: Fix JTokenWriter when writing comment to an object (dotnet#2493)
  * JamesNK/Newtonsoft.Json@583eb120: Fix missing error when deserializing JToken with a contract type mismatch (dotnet#2494)
  * JamesNK/Newtonsoft.Json@b6dc05be: Change MaxDepth default to 64 (dotnet#2473)
  * JamesNK/Newtonsoft.Json@15525f1c: Fix JsonWriter.WriteToken to allow null with string token (dotnet#2472)
  * JamesNK/Newtonsoft.Json@926d2f0f: Enable embed untracked sources (dotnet#2471)
  * JamesNK/Newtonsoft.Json@0a56633b: Fixes dotnet#2372 - variable typos (dotnet#2465)
  * JamesNK/Newtonsoft.Json@5a35c77d: Update version to 13.0.1 (dotnet#2463)
  * JamesNK/Newtonsoft.Json@7e77bbe1: Change JsonReader and JsonSerializer default max depth to 128 (dotnet#2462)
  * JamesNK/Newtonsoft.Json@42139ea6: Add JsonSelectSettings and regex timeout
  * JamesNK/Newtonsoft.Json@95a6eb3a: jpath regex timeout support added for a single regex expression, global umbrella for all regex calls, and support for allowing regex calls to get compiled if necessary
  * JamesNK/Newtonsoft.Json@1403f5d3: Fix serializing nullable struct dictionaries (dotnet#2452)
  * JamesNK/Newtonsoft.Json@60be32f4: Use naming strategy when deserializing dictionary enum keys (dotnet#2448)
  * JamesNK/Newtonsoft.Json@ff5ffb28: Copy annotations when cloning elements (dotnet#2442)
  * JamesNK/Newtonsoft.Json@0cf47a46: Missing nullability annotation (dotnet#2438)
  * JamesNK/Newtonsoft.Json@6795ca55: Fixed tests to work in Moscow, Russia UTC+3 timezone. (dotnet#2416)
  * JamesNK/Newtonsoft.Json@c918ca86: Code Typo Fix: Universial => Universal (dotnet#2383)
  * JamesNK/Newtonsoft.Json@c298f3d6: Fix typo in SerializeTypeNameHandling sample (dotnet#2428)
  * JamesNK/Newtonsoft.Json@a222c8b6: Update to net50 and fix warnings (dotnet#2424)
  * JamesNK/Newtonsoft.Json@666d9760: Fix wrong define is used in StringUtils.ToLower() (dotnet#2304)
  * JamesNK/Newtonsoft.Json@a31156e9: Update NullValueHandlingIgnore.aml (dotnet#2226)
  * JamesNK/Newtonsoft.Json@936acbf6: Update version to 13.0.1-beta and remove portable builds (dotnet#2228)
  * JamesNK/Newtonsoft.Json@9be95e0f: Do not treat ignored field as missing member when deserializing from overriden json constructor (dotnet#2224)

The `PackagingTest.NetStandardReferenceTest()` test is updated, as
the list of implicitly referenced assemblies changed:

  * `Microsoft.CSharp.dll` is no longer referenced
  * `System.Data.dll` is now referenced.

It appears that the primary cause of this change is that with
`Newtonsoft.Json` 12.0.3, the .NET Standard 1.3-profile assemblies
were included into the app, while with 13.0.1, the .NET Standard-2.0
profile assemblies are instead used.
jonpryor added a commit that referenced this issue Jul 16, 2021
Changes: JamesNK/Newtonsoft.Json@12.0.3...13.0.1

  * JamesNK/Newtonsoft.Json@ae9fe44e: Remove compiler package and update sourcelink (#2498)
  * JamesNK/Newtonsoft.Json@8ef66218: Remove prerelease for 13.0.1
  * JamesNK/Newtonsoft.Json@11331f50: Update SDK to 5.0.200 (#2495)
  * JamesNK/Newtonsoft.Json@c7e8abc0: Update to 13.0.1-beta2
  * JamesNK/Newtonsoft.Json@1745d7c1: Fix JTokenWriter when writing comment to an object (#2493)
  * JamesNK/Newtonsoft.Json@583eb120: Fix missing error when deserializing JToken with a contract type mismatch (#2494)
  * JamesNK/Newtonsoft.Json@b6dc05be: Change MaxDepth default to 64 (#2473)
  * JamesNK/Newtonsoft.Json@15525f1c: Fix JsonWriter.WriteToken to allow null with string token (#2472)
  * JamesNK/Newtonsoft.Json@926d2f0f: Enable embed untracked sources (#2471)
  * JamesNK/Newtonsoft.Json@0a56633b: Fixes #2372 - variable typos (#2465)
  * JamesNK/Newtonsoft.Json@5a35c77d: Update version to 13.0.1 (#2463)
  * JamesNK/Newtonsoft.Json@7e77bbe1: Change JsonReader and JsonSerializer default max depth to 128 (#2462)
  * JamesNK/Newtonsoft.Json@42139ea6: Add JsonSelectSettings and regex timeout
  * JamesNK/Newtonsoft.Json@95a6eb3a: jpath regex timeout support added for a single regex expression, global umbrella for all regex calls, and support for allowing regex calls to get compiled if necessary
  * JamesNK/Newtonsoft.Json@1403f5d3: Fix serializing nullable struct dictionaries (#2452)
  * JamesNK/Newtonsoft.Json@60be32f4: Use naming strategy when deserializing dictionary enum keys (#2448)
  * JamesNK/Newtonsoft.Json@ff5ffb28: Copy annotations when cloning elements (#2442)
  * JamesNK/Newtonsoft.Json@0cf47a46: Missing nullability annotation (#2438)
  * JamesNK/Newtonsoft.Json@6795ca55: Fixed tests to work in Moscow, Russia UTC+3 timezone. (#2416)
  * JamesNK/Newtonsoft.Json@c918ca86: Code Typo Fix: Universial => Universal (#2383)
  * JamesNK/Newtonsoft.Json@c298f3d6: Fix typo in SerializeTypeNameHandling sample (#2428)
  * JamesNK/Newtonsoft.Json@a222c8b6: Update to net50 and fix warnings (#2424)
  * JamesNK/Newtonsoft.Json@666d9760: Fix wrong define is used in StringUtils.ToLower() (#2304)
  * JamesNK/Newtonsoft.Json@a31156e9: Update NullValueHandlingIgnore.aml (#2226)
  * JamesNK/Newtonsoft.Json@936acbf6: Update version to 13.0.1-beta and remove portable builds (#2228)
  * JamesNK/Newtonsoft.Json@9be95e0f: Do not treat ignored field as missing member when deserializing from overriden json constructor (#2224)

The `PackagingTest.NetStandardReferenceTest()` test is updated, as
the list of implicitly referenced assemblies changed:

  * `Microsoft.CSharp.dll` is no longer referenced
  * `System.Data.dll` is now referenced.

It appears that the primary cause of this change is that with
`Newtonsoft.Json` 12.0.3, the .NET Standard 1.3-profile assemblies
were included into the app, while with 13.0.1, the .NET Standard-2.0
profile assemblies are instead used.
@jpobst jpobst added Area: Mono.Android Issues with the Android API binding (Mono.Android.dll). and removed Area: App Runtime Issues in `libmonodroid.so`. labels Sep 6, 2022
@jpobst jpobst modified the milestones: Under Consideration, .NET 8 Oct 28, 2022
@jpobst jpobst self-assigned this Dec 1, 2022
jonpryor pushed a commit that referenced this issue Jan 18, 2023
…7711)

Fixes: #2472

Context: https://github.com/xamarin/monodroid/commit/ebb6d5dfdf2800aa3a39e3445667170695df2c75

Enumification of API-23 in xamarin/monodroid@ebb6d5df incorrectly
enumified [`android.telecom.InCallService.setAudioRoute(int)`][0],
enumifying the `int` parameter as `Android.Telecom.VideoQuality`
instead of `Android.Telecom.CallAudioRoute`.

Fix this by changing `src/Mono.Android/methodmap.csv` to use
`Android.Telecom.CallAudioRoute`, which results in the binding:

	namespace Android.Telecom {
	    partial class InCallServices {
	        [global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android23.0")]
	        [Register ("setAudioRoute", "(I)V", "", ApiSince = 23)]
	        public unsafe void SetAudioRoute ([global::Android.Runtime.GeneratedEnum] Android.Telecom.CallAudioRoute route) => …
	    }
	}

For backwards compatibility, we need to add an `[Obsolete]` overload
containing the incorrect enumification:

	namespace Android.Telecom {
	    partial class InCallServices {
	        [Obsolete ("Incorrect enum parameter, use the overload that takes a CallAudioRoute paramter instead.")]
	        [global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android23.0")]
	        public void SetAudioRoute ([global::Android.Runtime.GeneratedEnum] Android.Telecom.VideoQuality route) =>
	            SetAudioRoute ((CallAudioRoute) route);
	    }
	}

The change to `acceptable-breakages*.txt` is due to the `[Register]`
attribute being moved from the old overload to the corrected overload.

[0]: https://developer.android.com/reference/android/telecom/InCallService#setAudioRoute(int)
@ghost ghost locked as resolved and limited conversation to collaborators Feb 17, 2023
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). bug Component does not function as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants