forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 0
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
merge main into foldable #3
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Two parts to this fix: 1. Make sure static assets are located relative to the running app (and not the current directory) 2. Update targets to ensure static assets are available prior to publish
* Close stream instead of dispose and fix unit test * - cleanup
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…crashes (dotnet#3692) Fixes dotnet#2526 * Return a blank Label when LoadTemplate is null to prevent HotReload crashes Fixes dotnet#2526 * Update test
Xamarin.Forms had `FormsViewGroup.java`, which is still used for .NET MAUI's renderer compatiblity. The idea, is you could call a single method that sets many values. This would cross from C# into Java once, instead of several times: public void sendBatchUpdate ( float pivotX, float pivotY, int visibility, boolean enabled, float opacity, float rotation, float rotationX, float rotationY, float scaleX, float scaleY, float translationX, float translationY){ setPivotX (pivotX); setPivotY (pivotY); if (getVisibility () != visibility) setVisibility (visibility); if (isEnabled () != enabled) setEnabled (enabled); setAlpha (opacity); setRotation (rotation); setRotationX (rotationX); setRotationY (rotationY); setScaleX (scaleX); setScaleY (scaleY); setTranslationX (translationX); setTranslationY (translationY); } One of the drawbacks here was having to subclass `FormsViewGroup`, as this could have easily been a `static` method for flexibility. I wrote a benchmark for this idea, and still appears to help dramatically in .NET 6: https://github.com/jonathanpeppers/android-pipe To keep this idea going, let's create `maui.aar` and `ViewHelper.java`: * `set()` sets many values at once. * `requestLayoutIfNeeded()` checks `isInLayout()` and calls `requestLayout()`. * `removeFromParent()` does various checks and calls `removeView()`. * `setPivotXIfNeeded()` (or Y) compares the existing value before setting it. ~~ Results ~~ Running the `Benchmarks.Droid.csproj` on a Pixel 5: > ./bin/dotnet/dotnet build src/Core/tests/Benchmarks.Droid/Benchmarks.Droid.csproj -t:Benchmark -c Release | Method | Mean | Error | StdDev | Gen 0 | Allocated | |-------------------- |-----------:|---------:|---------:|-------:|----------:| | --Border | 323.2 µs | 0.82 µs | 0.68 µs | 0.9766 | 5 KB | | ++Border | 242.3 µs | 1.34 µs | 1.25 µs | 0.9766 | 5 KB | | --ContentView | 354.6 µs | 2.61 µs | 2.31 µs | 1.4648 | 6 KB | | ++ContentView | 258.3 µs | 0.49 µs | 0.43 µs | 1.4648 | 6 KB | | --ActivityIndicator | 486.1 µs | 1.41 µs | 1.18 µs | 0.9766 | 5 KB | | ++ActivityIndicator | 380.3 µs | 1.40 µs | 1.31 µs | 0.9766 | 5 KB | | --Label | 630.8 µs | 3.02 µs | 2.83 µs | 0.9766 | 5 KB | | ++Label | 648.8 µs | 6.14 µs | 5.74 µs | 0.9766 | 5 KB | | --Entry | 2,169.2 µs | 18.02 µs | 16.85 µs | - | 12 KB | | ++Entry | 1,998.2 µs | 17.01 µs | 15.07 µs | - | 12 KB | -- is *before*, with `git checkout head~1 src\Core\src` on this branch. ++ is using the code changes on this branch as-is. Attaching each of these handlers to native controls is about 30% improved. Running the `Maui.Controls.Sample.SingleProject` app: .\bin\dotnet\dotnet build .\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj -c Release -t:Install -f net6.0-android The average of 10 runs on a Pixel 5: Before: Displayed +1s821ms Displayed +1s770ms Displayed +1s840ms Displayed +1s766ms Displayed +1s795ms Displayed +1s775ms Displayed +1s763ms Displayed +1s764ms Displayed +1s767ms Displayed +1s762ms Average(ms): 1782.3 Std Err(ms): 8.7 Std Dev(ms): 27.5118156434649 After: Displayed +1s768ms Displayed +1s770ms Displayed +1s764ms Displayed +1s747ms Displayed +1s757ms Displayed +1s778ms Displayed +1s751ms Displayed +1s784ms Displayed +1s770ms Displayed +1s769ms Average(ms): 1765.8 Std Err(ms): 3.62644607172244 Std Dev(ms): 11.4678293984132 I think this improves startup by ~17ms for this app. Apps with more views + handlers on startup will have a larger improvement. Co-authored-by: E.Z. Hart <[email protected]>
* Update dependencies from https://github.com/xamarin/xamarin-android build main-c96d9f496675d177687273fb20bc65f6e5dc73cd-1 Microsoft.Android.Sdk.Windows From Version 31.0.101-preview.12.126 -> To Version 31.0.101-preview.12.128 * Update dependencies from https://github.com/xamarin/xamarin-android build main-99523feab02e8622a3357e9e6a025f5afc44c970-1 Microsoft.Android.Sdk.Windows From Version 31.0.101-preview.12.126 -> To Version 31.0.101-preview.12.129 Dependency coherency updates Microsoft.NETCore.App.Ref,Microsoft.Extensions.Primitives,Microsoft.Extensions.Hosting,Microsoft.Extensions.Hosting.Abstractions,Microsoft.Extensions.DependencyInjection.Abstractions,Microsoft.Extensions.DependencyInjection,Microsoft.Extensions.Configuration.Abstractions,Microsoft.Extensions.Configuration.Binder,Microsoft.Extensions.Configuration,Microsoft.Extensions.Logging.Abstractions,Microsoft.Extensions.Logging,Microsoft.Extensions.Logging.Console,Microsoft.Extensions.Logging.Debug,Microsoft.Extensions.Configuration.CommandLine,Microsoft.Extensions.Configuration.EnvironmentVariables,Microsoft.Extensions.Configuration.FileExtensions,Microsoft.Extensions.Configuration.Json,Microsoft.Extensions.Configuration.UserSecrets,Microsoft.Extensions.FileProviders.Abstractions,Microsoft.Extensions.FileProviders.Composite,Microsoft.Extensions.FileProviders.Physical,Microsoft.Extensions.FileSystemGlobbing,Microsoft.Extensions.Logging.Configuration,Microsoft.Extensions.Logging.EventLog,Microsoft.Extensions.Logging.EventSource,Microsoft.Extensions.Options,Microsoft.Extensions.Options.ConfigurationExtensions,System.CodeDom,System.Runtime.CompilerServices.Unsafe,System.Diagnostics.DiagnosticSource,System.Diagnostics.EventLog,System.IO.Pipelines,System.Text.Encodings.Web,System.Text.Json From Version 6.0.0 -> To Version 6.0.1-mauipre.1.21602.7 (parent: Microsoft.Dotnet.Sdk.Internal * Update dependencies from https://github.com/xamarin/xamarin-android build main-c35b718d580a6c8b8164906d4295343c036209b2-1 Microsoft.Android.Sdk.Windows From Version 31.0.101-preview.12.126 -> To Version 31.0.101-preview.12.133 Dependency coherency updates Microsoft.NETCore.App.Ref,Microsoft.Dotnet.Sdk.Internal From Version 6.0.0 -> To Version 6.0.1-mauipre.1.21602.7 (parent: Microsoft.Dotnet.Sdk.Internal * Update dependencies from https://github.com/xamarin/xamarin-android build main-e298c4a853b2cf58c52d19a398cf09be0d7e4431-1 Microsoft.Android.Sdk.Windows From Version 31.0.101-preview.12.126 -> To Version 31.0.101-preview.12.136 Dependency coherency updates Microsoft.NETCore.App.Ref,Microsoft.Dotnet.Sdk.Internal From Version 6.0.0 -> To Version 6.0.1-mauipre.1.21602.7 (parent: Microsoft.Dotnet.Sdk.Internal * Update dependencies from https://github.com/xamarin/xamarin-android build main-60e983c6161242e0322e64c52d113e8cef2d61aa-1 Microsoft.Android.Sdk.Windows From Version 31.0.101-preview.12.126 -> To Version 31.0.101-preview.12.141 Dependency coherency updates Microsoft.NETCore.App.Ref,Microsoft.Dotnet.Sdk.Internal From Version 6.0.0 -> To Version 6.0.1-mauipre.1.21602.7 (parent: Microsoft.Dotnet.Sdk.Internal Co-authored-by: Jonathan Peppers <[email protected]>
* Try with a delay * - execute on main thread * - wait * Update Screenshot_Tests.cs
* Fix keyboard navigation with modal pages * - use RootView of the NavRootManager
* FlyoutPage APIs * - gesture enabled * - fix text * - cleanup * - fix up click listeners with drawer layout
We have a beautiful .NET 6 API we can use instead, that doesn't call into Java (no JNI!): https://docs.microsoft.com/dotnet/api/system.operatingsystem.isandroidversionatleast Usage of `Build.VERSION.SdkInt` came from both Xamarin.Forms and Xamarin.Essentials. We were caching the result of the value, but still doing that work twice. We can also use the pattern: OperatingSystem.IsAndroidVersionAtLeast((int)BuildVersionCodes.JellyBean) `BuildVersionCodes` is a regular C# enum, and so the C# compiler will strip this information away leaving just an integer in the final IL. I used either an integer or the enum, depending on what the existing code did. Additionally, I went through any existing code checking old API levels and removed it. The minimum API level for .NET 6 (dotnet/runtime & xamarin-android) is 21. So any code looking for API levels 21 or lower, could just be removed. I also removed code I found such as: public static int? TargetSdkVersion(this Context self) { return (int?)self?.ApplicationInfo?.TargetSdkVersion; } This was only used in one place, and was checking API 17, so I just removed it. ~~ Results ~~ Testing a `Release` build of `Maui.Controls.Sample.SingleProject.csproj` on a Pixel 5 device: Before: 12-16 14:41:19.289 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s739ms 12-16 14:41:24.468 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s713ms 12-16 14:41:29.867 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s917ms 12-16 14:41:34.905 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s765ms 12-16 14:41:40.132 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s719ms 12-16 14:41:45.431 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s768ms 12-16 14:41:50.608 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s716ms 12-16 14:41:55.878 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s754ms 12-16 14:42:01.157 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s754ms 12-16 14:42:06.315 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s713ms Average(ms): 1755.8 Std Err(ms): 19.1803139819046 Std Dev(ms): 60.6534784199921 After: 12-16 14:45:35.208 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s737ms 12-16 14:45:40.448 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s743ms 12-16 14:45:45.663 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s715ms 12-16 14:45:50.931 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s741ms 12-16 14:45:56.161 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s712ms 12-16 14:46:01.426 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s768ms 12-16 14:46:06.574 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s699ms 12-16 14:46:11.867 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s779ms 12-16 14:46:16.979 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s694ms 12-16 14:46:22.229 1741 1935 I ActivityTaskManager: Displayed com.microsoft.maui.sample/crc64dac46b470c4e9200.MainActivity: +1s728ms Average(ms): 1731.6 Std Err(ms): 8.79924239163047 Std Dev(ms): 27.8256476414596 This appears to maybe save ~24ms on startup for this app?
* Update WinUI to customize AppBarTitle * - set title for window * - code cleanup * - cleanup * - fix up * - fix android toolbar
* Retrieve Interaction mode from Handle * Add calls for orientation * - finish up the rest of the static caller cleanups * Update Platform.uwp.cs * Add app.manifest to essentials sample for better DPI Co-authored-by: Redth <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.