Skip to content

Commit

Permalink
[Mono.Android] Bind Android 12 Beta 3 and API-31 enumification (dotne…
Browse files Browse the repository at this point in the history
…t#6089)

Context: https://developer.android.com/about/versions/12/overview
Context: https://android-developers.googleblog.com/search/label/Android12

Android 12 [Beta 3 has been released][0].

  * [API diff vs. Beta 2][1]
  * [API diff vs. API-30][2]

Given that these API's are believed to be final (-ish?), we have
performed enumification on this version.

We will mark this API level as stable in a future commit, as that
generally requires changing quite a few files.

There are some methods that are documented as taking constants which
we think would ideally be enumified, but the constants are not public.

	?,31,android/net/ipsec/ike,TunnelModeChildSessionParams$Builder,addInternalAddressRequest,addressFamily,
	?,31,android/net/ipsec/ike,TunnelModeChildSessionParams$Builder,addInternalDhcpServerRequest,addressFamily,
	?,31,android/net/ipsec/ike,TunnelModeChildSessionParams$Builder,addInternalDnsServerRequest,addressFamily,

`TunnelModeChildSessionParams.Builder.addInternal*Request()` methods
like [`TunnelModeChildSessionParams.Builder.addInternalAddressRequest(int)`][3]
are documented as taking `AF_INET` or `AF_INET6` values.

Perusing the [`TunnelModeChildSessionParams.java`][4] source, we see
that `AF_INET` is an
[`import static android.system.OsConstants.AF_INET`][5], which is
*not* a constant value.  As such, it *cannot* be enumified, and thus
none of these methods can be enumified.


	?,31,android/telephony,[Interface]TelephonyCallback$CallDisconnectCauseListener,onCallDisconnectCauseChanged,preciseDisconnectCause,

The `preciseDisconnectCause` parameter of
[`TelephonyCallback.CallDisconnectCauseListener.onCallDisconnectCauseChanged()][6]
is documented as being a value from
`android.telephony.PreciseDisconnectCause`.  However,
[`PreciseDisconnectCause` is `@hide`][7]; it can't be bound.


	?,31,android/telephony,[Interface]TelephonyCallback$DataActivationStateListener,onDataActivationStateChanged,state,

Similar to the `PreciseDisconnectCause` scenario, the `state` parameter in
[`TelephonyCallback.DataActivationStateListener.onDataActivationStateChanged()`][8]
is documented as being a
[`android.telephony.TelephonyManager.SIM_ACTIVATION_STATE_*`][9]
value, which is `@hide`, and thus cannot be bound.

[0]: https://android-developers.googleblog.com/2021/07/android-12-beta-3.html
[1]: https://developer.android.com/sdk/api_diff/31-incr/changes
[2]: https://developer.android.com/sdk/api_diff/31/changes
[3]: https://developer.android.com/reference/android/net/ipsec/ike/TunnelModeChildSessionParams.Builder#addInternalAddressRequest(int)
[4]: https://android.googlesource.com/platform/frameworks/opt/net/ike/+/9dbc4348a97db2076e6841669525d733bbacc287/src/java/android/net/ipsec/ike/TunnelModeChildSessionParams.java#19
[5]: https://developer.android.com/reference/android/system/OsConstants#AF_INET
[6]: https://developer.android.com/reference/android/telephony/TelephonyCallback.CallDisconnectCauseListener#onCallDisconnectCauseChanged(int,%20int)
[7]: https://android.googlesource.com/platform/frameworks/base/+/300c70d67617d01b3b0383742d275ab945a9ed80/telephony/java/android/telephony/PreciseDisconnectCause.java#23
[8]: https://developer.android.com/reference/android/telephony/TelephonyCallback.DataActivationStateListener?hl=en#onDataActivationStateChanged(int)
[9]: https://android.googlesource.com/platform/frameworks/base/+/0c13fd19ecbb60c328a95e3c1620e03c7c8826cd/telephony/java/android/telephony/TelephonyManager.java#4921
  • Loading branch information
jpobst authored Aug 9, 2021
1 parent 1f45773 commit 8843808
Show file tree
Hide file tree
Showing 5 changed files with 10,198 additions and 8,099 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public AndroidToolchain ()
new AndroidPlatformComponent ("platform-28_r04", apiLevel: "28", pkgRevision: "4"),
new AndroidPlatformComponent ("platform-29_r01", apiLevel: "29", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-30_r01", apiLevel: "30", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-S_r05", apiLevel: "S", pkgRevision: "5"),
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "S", pkgRevision: "1"),

new AndroidToolchainComponent ("sources-30_r01", destDir: Path.Combine ("platforms", $"android-30", "src"), pkgRevision: "1", dependencyType: AndroidToolchainComponentType.BuildDependency),

Expand Down
21 changes: 21 additions & 0 deletions src/Mono.Android/Android.Telephony/AccessNetworkTypes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Android.Telephony
{
#if ANDROID_31
// These constants were added in API-28 and were missed in enumification.
// Make an enum now because some new API-31 methods use them.
public enum AccessNetworkTypes
{
Unknown = 0,
Geran = 1,
Utran = 2,
Eutran = 3,
Cdma2000 = 4,
Iwlan = 5,
Ngran = 6
}
#endif
}
Loading

0 comments on commit 8843808

Please sign in to comment.