Skip to content

Commit 8843808

Browse files
authored
[Mono.Android] Bind Android 12 Beta 3 and API-31 enumification (dotnet#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
1 parent 1f45773 commit 8843808

File tree

5 files changed

+10198
-8099
lines changed

5 files changed

+10198
-8099
lines changed

build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public AndroidToolchain ()
6262
new AndroidPlatformComponent ("platform-28_r04", apiLevel: "28", pkgRevision: "4"),
6363
new AndroidPlatformComponent ("platform-29_r01", apiLevel: "29", pkgRevision: "1"),
6464
new AndroidPlatformComponent ("platform-30_r01", apiLevel: "30", pkgRevision: "1"),
65-
new AndroidPlatformComponent ("platform-S_r05", apiLevel: "S", pkgRevision: "5"),
65+
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "S", pkgRevision: "1"),
6666

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Android.Telephony
6+
{
7+
#if ANDROID_31
8+
// These constants were added in API-28 and were missed in enumification.
9+
// Make an enum now because some new API-31 methods use them.
10+
public enum AccessNetworkTypes
11+
{
12+
Unknown = 0,
13+
Geran = 1,
14+
Utran = 2,
15+
Eutran = 3,
16+
Cdma2000 = 4,
17+
Iwlan = 5,
18+
Ngran = 6
19+
}
20+
#endif
21+
}

0 commit comments

Comments
 (0)