Skip to content

Commit 15c7f92

Browse files
committed
First step towards support for Android-O Preview API.
The changes are big due to the structural changes in Android SDK, particularly that "android" command line tool is gone and they had to be rewritten. Samples that depended on "create" or "update" command had to be checked in as already-created state so that they don't have to bring further dependencies. Changes in the library (Mono.Android) itself is not very big at all.
1 parent 955c651 commit 15c7f92

File tree

54 files changed

+514
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+514
-113
lines changed

Configuration.props

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<MonoSgenBridgeVersion Condition=" '$(MonoSgenBridgeVersion)' == '' ">5</MonoSgenBridgeVersion>
3232
<HOME Condition=" '$(HOME)' == '' ">$(HOMEDRIVE)$(HOMEPATH)</HOME>
3333
<AndroidApiLevel Condition=" '$(AndroidApiLevel)' == '' ">25</AndroidApiLevel>
34+
<AndroidPlatformId Condition=" '$(AndroidPlatformId)' == '' ">$(AndroidApiLevel)</AndroidPlatformId>
3435
<AndroidPreviousFrameworkVersion Condition=" '$(AndroidPreviousFrameworkVersion)' == '' ">v1.0</AndroidPreviousFrameworkVersion>
3536
<AndroidLatestFrameworkVersion>v7.1</AndroidLatestFrameworkVersion>
3637
<AndroidFrameworkVersion Condition=" '$(AndroidFrameworkVersion)' == '' ">$(AndroidLatestFrameworkVersion)</AndroidFrameworkVersion>
@@ -56,7 +57,8 @@
5657
<AllSupported32BitTargetAndroidAbis>armeabi;armeabi-v7a;x86</AllSupported32BitTargetAndroidAbis>
5758
<AllSupported64BitTargetAndroidAbis>arm64-v8a;x86_64</AllSupported64BitTargetAndroidAbis>
5859
<AllSupportedTargetAndroidAbis>$(AllSupported32BitTargetAndroidAbis);$(AllSupported64BitTargetAndroidAbis)</AllSupportedTargetAndroidAbis>
59-
<XABuildToolsVersion>25.0.1</XABuildToolsVersion>
60+
<XABuildToolsVersion>26-rc1</XABuildToolsVersion>
61+
<XABuildToolsFolder Configuration="'$(XABuildToolsFolder)' == ''">26.0.0-rc1</XABuildToolsFolder>
6062
</PropertyGroup>
6163
<PropertyGroup>
6264
<_MingwPrefixTail Condition=" '$(HostOS)' == 'Darwin' ">.static</_MingwPrefixTail>
@@ -80,7 +82,9 @@
8082
<PropertyGroup>
8183
<AdbToolPath Condition=" '$(AdbToolPath)' == '' ">$(AndroidSdkFullPath)\platform-tools</AdbToolPath>
8284
<AdbToolExe Condition=" '$(AdbToolExe)' == '' ">adb</AdbToolExe>
85+
<AvdManagerToolExe Condition=" '$(AvdManagerToolExe)' == '' ">avdmanager</AvdManagerToolExe>
8386
<AndroidToolPath Condition=" '$(AndroidToolPath)' == '' ">$(AndroidSdkFullPath)\tools</AndroidToolPath>
87+
<AndroidToolsBinPath Condition=" '$(AndroidToolsBinPath)' == '' ">$(AndroidToolPath)\bin</AndroidToolsBinPath>
8488
<AndroidToolExe Condition=" '$(AndroidToolExe)' == '' ">android</AndroidToolExe>
8589
<EmulatorToolPath Condition=" '$(EmulatorToolPath)' == '' ">$(AndroidSdkFullPath)\tools</EmulatorToolPath>
8690
<EmulatorToolExe Condition=" '$(EmulatorToolExe)' == '' ">emulator</EmulatorToolExe>

build-tools/android-toolchain/android-toolchain.mdproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
_UnzipFiles;
2323
_CreateNdkToolchains;
2424
_CreateMxeToolchains;
25+
_AcceptAndroidSdkLicenses;
2526
</BuildDependsOn>
2627
</PropertyGroup>
2728
<ItemGroup>
@@ -44,4 +45,4 @@
4445
<ItemGroup>
4546
<None Include="packages.config" />
4647
</ItemGroup>
47-
</Project>
48+
</Project>

build-tools/android-toolchain/android-toolchain.projitems

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,39 @@
1313
-->
1414
<AndroidSdkItem Include="build-tools_r$(XABuildToolsVersion)-linux.zip">
1515
<HostOS>Linux</HostOS>
16-
<DestDir>build-tools\$(XABuildToolsVersion)</DestDir>
16+
<DestDir>build-tools\$(XABuildToolsFolder)</DestDir>
1717
</AndroidSdkItem>
18-
<AndroidSdkItem Include="platform-tools_r23-linux.zip">
18+
<AndroidSdkItem Include="platform-tools_r26.0.0-rc1-linux.zip">
1919
<HostOS>Linux</HostOS>
2020
<DestDir>platform-tools</DestDir>
2121
</AndroidSdkItem>
22-
<AndroidSdkItem Include="tools_r24.4.1-linux.zip">
22+
<AndroidSdkItem Include="sdk-tools-linux-3859397.zip">
2323
<HostOS>Linux</HostOS>
2424
<DestDir>tools</DestDir>
2525
</AndroidSdkItem>
26+
<AndroidSdkItem Include="emulator-linux-3887480.zip">
27+
<HostOS>Linux</HostOS>
28+
<DestDir>emulator</DestDir>
29+
</AndroidSdkItem>
2630
<AndroidNdkItem Include="android-ndk-r11c-darwin-x86_64.zip">
2731
<HostOS>Darwin</HostOS>
2832
</AndroidNdkItem>
2933
<AndroidSdkItem Include="build-tools_r$(XABuildToolsVersion)-macosx.zip">
3034
<HostOS>Darwin</HostOS>
31-
<DestDir>build-tools\$(XABuildToolsVersion)</DestDir>
35+
<DestDir>build-tools\$(XABuildToolsFolder)</DestDir>
3236
</AndroidSdkItem>
33-
<AndroidSdkItem Include="platform-tools_r23-macosx.zip">
37+
<AndroidSdkItem Include="platform-tools_r26.0.0-rc1-darwin.zip">
3438
<HostOS>Darwin</HostOS>
3539
<DestDir>platform-tools</DestDir>
3640
</AndroidSdkItem>
37-
<AndroidSdkItem Include="tools_r24.4.1-macosx.zip">
41+
<AndroidSdkItem Include="sdk-tools-darwin-3859397.zip">
3842
<HostOS>Darwin</HostOS>
3943
<DestDir>tools</DestDir>
4044
</AndroidSdkItem>
45+
<AndroidSdkItem Include="emulator-darwin-3887480.zip">
46+
<HostOS>Darwin</HostOS>
47+
<DestDir>emulator</DestDir>
48+
</AndroidSdkItem>
4149
<AndroidSdkItem Include="android-2.3.3_r02-linux.zip">
4250
<HostOS></HostOS>
4351
<DestDir>platforms\android-10</DestDir>
@@ -86,14 +94,18 @@
8694
<HostOS></HostOS>
8795
<DestDir>platforms\android-25</DestDir>
8896
</AndroidSdkItem>
97+
<AndroidSdkItem Include="platform-O_r01.zip">
98+
<HostOS></HostOS>
99+
<DestDir>platforms\android-O</DestDir>
100+
</AndroidSdkItem>
89101
<AndroidSdkItem Include="android_m2repository_r16.zip">
90102
<HostOS></HostOS>
91103
<DestDir>extras\android\m2repository</DestDir>
92104
</AndroidSdkItem>
93-
<AndroidSdkItem Include="sysimg_x86-21_r03.zip">
105+
<AndroidSdkItem Include="sysimg_x86-21_r04.zip">
94106
<HostOS></HostOS>
95107
<RelUrl>sys-img/android/</RelUrl>
96-
<DestDir>system-images\android-21\x86</DestDir>
108+
<DestDir>system-images\android-21\default\x86</DestDir>
97109
</AndroidSdkItem>
98110
</ItemGroup>
99111
<ItemGroup>

build-tools/android-toolchain/android-toolchain.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<Import Project="..\..\Configuration.props" />
44
<Import Project="android-toolchain.projitems" />
55
<Import Project="..\scripts\RequiredPrograms.targets" />
6+
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.AcceptAndroidSdkLicenses" />
67
<Target Name="_CopyBootstrapTasksAssembly"
78
Outputs="$(OutputPath)\Xamarin.Android.Tools.BootstrapTasks.dll">
89
<MSBuild
@@ -123,6 +124,9 @@
123124
<_AndroidMxeOutput Include="@(_AndroidMxeToolchain->'$(AndroidMxeFullPath)\%(Identity)\include\zlib.h')" />
124125
<_AndroidMxeOutput Include="@(_AndroidMxeToolchain->'$(AndroidMxeFullPath)\%(Identity)\lib\libz.a')" />
125126
</ItemGroup>
127+
<Target Name="_AcceptAndroidSdkLicenses">
128+
<AcceptAndroidSdkLicenses AndroidSdkDirectory="$(AndroidSdkDirectory)" />
129+
</Target>
126130
<Target Name="_CreateMxeToolchains"
127131
DependsOnTargets="_SetMxeToolchainMakefileTimeToLastCommitTimestamp"
128132
Condition=" '$(NeedMxe)' == 'true' And ($(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win32:')) Or $(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win64:')))"

build-tools/api-xml-adjuster/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ API_XML_TOOL = $(BUILDBIN)/api-xml-adjuster.exe
1414
RUNTIME = mono
1515
RUN_CLASS_PARSE = $(RUNTIME) $(CLASS_PARSE)
1616
RUN_API_XML_TOOL = $(RUNTIME) $(API_XML_TOOL)
17-
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25
17+
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 O
1818

1919
XML_OUTPUT_DIR = .
2020

@@ -81,6 +81,9 @@ docs-%.zip:
8181
docs-25_web.zip:
8282
curl -L https://dl.dropboxusercontent.com/u/493047/2016/docs-25-web.zip > $@ || exit 1
8383

84+
docs-O_web.zip:
85+
curl -L https://www.dropbox.com/s/3xr11fpd08xpolg/docs-O-web.zip?dl=0 > $@ || exit 1
86+
8487
# API level 10 is Android v2.3.3; it's API level 9 (Android v2.3) with a few
8588
# bugfixes which don't impact the documentation.
8689
$(DOCS_DIR)/docs-api-10: docs-2.3_r01-linux.zip
@@ -119,3 +122,7 @@ $(DOCS_DIR)/docs-api-24: docs-24_r01.zip
119122

120123
$(DOCS_DIR)/docs-api-25: docs-25_web.zip # Google hadn't published docs component yet!
121124
$(call extract-docs,$<,docs)
125+
126+
docs-api-O: docs-O_web.zip # No preview docs yet
127+
$(call extract-docs,$<,docs)
128+

build-tools/dependencies/dependencies.projitems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</RequiredProgram>
5959
<RequiredProgram Include="$(ManagedRuntime)" Condition=" '$(ManagedRuntime)' != '' ">
6060
<MinimumVersion>4.9.3</MinimumVersion>
61-
<MaximumVersion>5.1.99</MaximumVersion>
61+
<MaximumVersion>5.3.99</MaximumVersion>
6262
<CurrentVersionCommand>$(MSBuildThisFileDirectory)..\scripts\mono-version</CurrentVersionCommand>
6363
<DarwinMinimumUrl>https://bosstoragemirror.blob.core.windows.net/wrench/mono-2017-02/c5/c52c4bd713e19339a5859e73a99dbb4cc21c6d3f/$(_DarwinMonoFramework)</DarwinMinimumUrl>
6464
<DarwinInstall>installer -pkg "$(AndroidToolchainCacheDirectory)\$(_DarwinMonoFramework)" -target /</DarwinInstall>

build-tools/scripts/BuildEverything.mk

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ ZIP_OUTPUT = $(ZIP_OUTPUT_BASENAME).zip
1515

1616

1717
# $(ALL_API_LEVELS) and $(ALL_FRAMEWORKS) must be kept in sync w/ each other
18-
ALL_API_LEVELS = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
19-
# this was different when API Level 21 was "L". Same could happen in the future.
20-
ALL_PLATFORM_IDS = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
18+
ALL_API_LEVELS = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
19+
# this was different from ALL_API_LEVELS when API Level 26 was "O". Same could happen in the future.
20+
ALL_PLATFORM_IDS = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 O
2121
# supported api levels
22-
ALL_FRAMEWORKS = _ _ _ _ _ _ _ _ _ v2.3 _ _ _ _ v4.0.3 v4.1 v4.2 v4.3 v4.4 v4.4.87 v5.0 v5.1 v6.0 v7.0 v7.1
23-
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25
22+
ALL_FRAMEWORKS = _ _ _ _ _ _ _ _ _ v2.3 _ _ _ _ v4.0.3 v4.1 v4.2 v4.3 v4.4 v4.4.87 v5.0 v5.1 v6.0 v7.0 v7.1 v7.99.0
23+
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26
2424
STABLE_API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24
2525

2626
FRAMEWORKS = $(foreach a, $(API_LEVELS), $(word $(a),$(ALL_FRAMEWORKS)))
@@ -100,7 +100,7 @@ framework-assemblies:
100100
if [ $$? -ne 0 ] ; then \
101101
rm -f bin/$(conf)/lib/xbuild-frameworks/MonoAndroid/$${CUR_VERSION}/RedistList/FrameworkList.xml; \
102102
fi; \
103-
$(MSBUILD) $(MSBUILD_FLAGS) src/Mono.Android/Mono.Android.csproj /p:Configuration=$(conf) $(_MSBUILD_ARGS) /p:AndroidApiLevel=$${a} /p:AndroidFrameworkVersion=$${CUR_VERSION} /p:AndroidPreviousFrameworkVersion=$${PREV_VERSION}; ) \
103+
$(MSBUILD) $(MSBUILD_FLAGS) src/Mono.Android/Mono.Android.csproj /p:Configuration=$(conf) $(_MSBUILD_ARGS) /p:AndroidApiLevel=$${a} /p:AndroidPlatformId=$(word $(a), $(ALL_PLATFORM_IDS)) /p:AndroidFrameworkVersion=$${CUR_VERSION} /p:AndroidPreviousFrameworkVersion=$${PREV_VERSION}; ) \
104104
PREV_VERSION=$${CUR_VERSION}; \
105105
done
106106
$(foreach conf, $(CONFIGURATIONS), \
@@ -115,7 +115,7 @@ opentk-jcw:
115115
$(foreach a, $(API_LEVELS), \
116116
$(foreach conf, $(CONFIGURATIONS), \
117117
touch bin/$(conf)/lib/xbuild-frameworks/MonoAndroid/*/OpenTK-1.0.dll; \
118-
$(MSBUILD) $(MSBUILD_FLAGS) src/OpenTK-1.0/OpenTK.csproj /t:GenerateJavaCallableWrappers /p:Configuration=$(conf) $(_MSBUILD_ARGS) /p:AndroidApiLevel=$(a) /p:AndroidFrameworkVersion=$(word $(a), $(ALL_FRAMEWORKS)); ))
118+
$(MSBUILD) $(MSBUILD_FLAGS) src/OpenTK-1.0/OpenTK.csproj /t:GenerateJavaCallableWrappers /p:Configuration=$(conf) $(_MSBUILD_ARGS) /p:AndroidApiLevel=$(a) /p:AndroidPlatformId=$(word $(a), $(ALL_PLATFORM_IDS)) /p:AndroidFrameworkVersion=$(word $(a), $(ALL_FRAMEWORKS)); ))
119119

120120
_BUNDLE_ZIPS_INCLUDE = \
121121
$(ZIP_OUTPUT_BASENAME)/bin/Debug \

build-tools/scripts/JavaCallableWrappers.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<PropertyGroup>
2626
<_Target>-source $(JavacSourceVersion) -target $(JavacSourceVersion)</_Target>
2727
<_D>-d "$(IntermediateOutputPath)jcw\bin"</_D>
28-
<_AndroidJar>"$(AndroidToolchainDirectory)\sdk\platforms\android-$(AndroidApiLevel)\android.jar"</_AndroidJar>
28+
<_AndroidJar>"$(AndroidToolchainDirectory)\sdk\platforms\android-$(AndroidPlatformId)\android.jar"</_AndroidJar>
2929
<_MonoAndroidJar>$(OutputPath)mono.android.jar</_MonoAndroidJar>
3030
</PropertyGroup>
3131
<Exec

build-tools/scripts/UnitTestApks.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
AndroidSdkHome="$(AndroidSdkDirectory)"
2727
SdkVersion="21"
2828
ImageName="$(_TestImageName)"
29-
ToolExe="$(AndroidToolExe)"
30-
ToolPath="$(AndroidToolPath)"
29+
ToolExe="$(AvdManagerToolExe)"
30+
ToolPath="$(AndroidToolsBinPath)"
3131
/>
3232
<StartAndroidEmulator
3333
Condition=" '$(_ValidAdbTarget)' != 'True' "
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Diagnostics;
3+
using System.IO;
4+
using Microsoft.Build.Framework;
5+
using Microsoft.Build.Utilities;
6+
7+
namespace Xamarin.Android.BuildTools.PrepTasks
8+
{
9+
public class AcceptAndroidSdkLicenses : Task
10+
{
11+
[Required]
12+
public string AndroidSdkDirectory { get; set; }
13+
14+
public override bool Execute ()
15+
{
16+
var licdir = Path.Combine (Path.Combine (AndroidSdkDirectory, "licenses"));
17+
Directory.CreateDirectory (licdir);
18+
19+
var psi = new ProcessStartInfo (Path.Combine (AndroidSdkDirectory, "tools", "bin", "sdkmanager"), "--licenses") { UseShellExecute = false, RedirectStandardInput = true };
20+
var proc = Process.Start (psi);
21+
for (int i = 0; i < 10; i++)
22+
proc.StandardInput.WriteLine ('y');
23+
proc.WaitForExit ();
24+
25+
return true;
26+
}
27+
}
28+
}

build-tools/xa-prep-tasks/xa-prep-tasks.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\GitCommitsInRange.cs" />
4949
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\ReplaceFileContents.cs" />
5050
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\PrepareInstall.cs" />
51+
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\AcceptAndroidSdkLicenses.cs" />
5152
</ItemGroup>
5253
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
5354
<Import Project="xa-prep-tasks.targets" />

src/Mono.Android/Mono.Android.targets

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -107,31 +107,10 @@
107107
</ItemGroup>
108108
<Target Name="_GenerateMonoAndroidDex16"
109109
AfterTargets="GenerateJavaCallableWrappers"
110-
Condition="'$(JavacSourceVersion)' == '1.6'"
111110
Inputs="$(OutputPath)mono.android.jar"
112111
Outputs="$(OutputPath)mono.android.dex">
113112
<Exec
114-
Command="&quot;$(AndroidSdkDirectory)&quot;\build-tools\$(XABuildToolsVersion)\dx --dex --output=&quot;$(OutputPath)mono.android.dex&quot; &quot;$(OutputPath)mono.android.jar&quot;"
115-
/>
116-
</Target>
117-
<Target Name="_GenerateMonoAndroidDex18"
118-
AfterTargets="GenerateJavaCallableWrappers"
119-
Condition="'$(JavacSourceVersion)' == '1.8'"
120-
Inputs="$(OutputPath)mono.android.jar"
121-
Outputs="$(OutputPath)mono.android.dex">
122-
<MakeDir
123-
Directories="$(IntermediateOutputPath)__dex"
124-
/>
125-
<Exec
126-
Command="java -jar &quot;$(AndroidSdkDirectory)&quot;\build-tools\$(XABuildToolsVersion)\jack.jar --output-dex=&quot;$(IntermediateOutputPath)__dex&quot; -cp &quot;$(AndroidToolchainDirectory)\sdk\platforms\android-$(AndroidApiLevel)\android.jar&quot; @&quot;$(IntermediateOutputPath)jcw\classes.txt&quot;"
127-
/>
128-
<Copy
129-
SourceFiles="$(IntermediateOutputPath)__dex\classes.dex"
130-
DestinationFiles="$(OutputPath)mono.android.dex"
131-
/>
132-
<Touch Files="$(OutputPath)mono.android.dex" />
133-
<RemoveDir
134-
Directories="$(IntermediateOutputPath)__dex"
113+
Command="&quot;$(AndroidSdkDirectory)\build-tools\$(XABuildToolsFolder)\dx&quot; --dex --no-strict --output=&quot;$(OutputPath)mono.android.dex&quot; &quot;$(OutputPath)mono.android.jar&quot;"
135114
/>
136115
</Target>
137116
<Target Name="_GenerateFrameworkList"

src/Mono.Android/metadata

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@
11281128
<!-- name conflict resolution -->
11291129
<attr path="/api/package[@name='android.net.wifi']/class[@name='WifiConfiguration']/field[@name='status']" name="managedName">StatusField</attr>
11301130

1131-
<!-- Android M -->
1131+
<!-- Android M (API Level 23) -->
11321132

11331133
<!-- FIXME: there is another M-preview specific build error:
11341134

@@ -1141,7 +1141,7 @@
11411141

11421142
<attr path="/api/package[@name='android.app']/class[@name='Notification']/method[@name='getLargeIcon']" name="propertyName"></attr>
11431143

1144-
<!-- Android N Preview -->
1144+
<!-- Android N (API Level 24-25) -->
11451145

11461146
<attr path="/api/package[@name='java.util.function']" name="managedName">Java.Util.Functions</attr>
11471147
<attr path="/api/package[@name='java.util.stream']" name="managedName">Java.Util.Streams</attr>
@@ -1319,4 +1319,39 @@
13191319
<attr path="/api/package[@name='java.util.concurrent.atomic']/class[@name='AtomicLong']/method[@name='getAndDecrement']" name="propertyName"></attr>
13201320
<attr path="/api/package[@name='java.util.concurrent.atomic']/class[@name='AtomicLong']/method[@name='getAndIncrement']" name="propertyName"></attr>
13211321

1322+
1323+
<!-- Android O (API Level 26) -->
1324+
1325+
<attr path="/api/package[@name='android.view.autofill']" name="managedName">Android.Views.AutoFill</attr>
1326+
<attr path="/api/package[@name='android.view.textclassifier']" name="managedName">Android.Views.TextClassifiers</attr>
1327+
<attr path="/api/package[@name='java.nio.file']" name="managedName">Java.Nio.FileNio</attr>
1328+
<attr path="/api/package[@name='java.nio.file.attribute']" name="managedName">Java.Nio.FileNio.Attributes</attr>
1329+
<attr path="/api/package[@name='java.nio.file.spi']" name="managedName">Java.Nio.FileNio.Spi</attr>
1330+
1331+
<!-- FIXME: fix build and enable these packages -->
1332+
<remove-node path="/api/package[@name='java.time']" api-since="26" />
1333+
<remove-node path="/api/package[@name='java.time.chrono']" api-since="26" />
1334+
1335+
<!-- FIXME: fix build and enable these types -->
1336+
<remove-node path="/api/package[@name='java.nio.channels']/class[@name='AsynchronousFileChannel']" api-since="26" />
1337+
<remove-node path="/api/package[@name='java.nio.channels']/class[@name='AsynchronousSocketChannel']" api-since="26" />
1338+
<remove-node path="/api/package[@name='java.nio.channels']/class[@name='AsynchronousServerSocketChannel']" api-since="26" />
1339+
1340+
<!-- FIXME: fix build and enable this method -->
1341+
<remove-node path="/api/package[@name='android.text']/class[@name='TextUtils']/method[@name='listEllipsize']" api-since="26" />
1342+
1343+
1344+
<!-- interface default method -->
1345+
<remove-node path="/api/package[@name='java.lang.reflect']/interface[@name='AnnotatedElement']/method[@name='isAnnotationPresent']" api-since="26" />
1346+
1347+
<!-- This is possibly a new kind of problem that a class can have a pair of
1348+
methods where one returns a CharSequence and the other returns java.lang.String.
1349+
Such a pair will result in build error as both result in System.String
1350+
overloads (therefore duplicates in C# land).
1351+
We remove one with java.lang.String; with a System.String overload it should be fine for most of managed developers. -->
1352+
<remove-node path="/api/package[@name='android.text']/class[@name='BidiFormatter']/method[@name='unicodeWrap' and @return='java.lang.String']" api-since="26" />
1353+
1354+
<!-- interfaces that implement BasicFileAttributeView often have return value of a derived type. So change the managed return type. -->
1355+
<attr path="/api/package[@name='java.nio.file.attribute']/*[implements[@name='java.nio.file.attribute.BasicFileAttributeView']]/method[@name='readAttributes']" name="managedReturn">Java.Nio.FileNio.Attributes.IBasicFileAttributes</attr>
1356+
13221357
</metadata>

src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ internal static IEnumerable<string> GetFrameworkAssembliesToTreatAsUserAssemblie
435435
public static string GetPlatformApiLevelName (string platformApiLevel)
436436
{
437437
switch (platformApiLevel.Trim ()) {
438+
case "26":
439+
return "O";
438440
default:
439441
return platformApiLevel;
440442
}
@@ -445,6 +447,8 @@ public static string GetPlatformApiLevelName (string platformApiLevel)
445447
public static string GetPlatformApiLevel (string platformApiLevelName)
446448
{
447449
switch (platformApiLevelName.Trim ()) {
450+
case "O":
451+
return "26";
448452
default:
449453
return platformApiLevelName;
450454
}

0 commit comments

Comments
 (0)