Skip to content

Commit

Permalink
Generate AOT Profilers for Non Shell based apps (#8941)
Browse files Browse the repository at this point in the history
* Add non shell pages to AOT stack

* - AOT Profiles

* - update aot from merge

* - rerun after merge

* - add delay

* - run on physical device

* - remove old page listener
  • Loading branch information
PureWeen authored Jul 28, 2022
1 parent b10f7ba commit 15df4ed
Show file tree
Hide file tree
Showing 8 changed files with 683 additions and 23 deletions.
Binary file modified .nuspec/maui.aotprofile
Binary file not shown.
619 changes: 608 additions & 11 deletions .nuspec/maui.aotprofile.txt

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions src/Controls/src/Core/Platform/Android/TabbedPageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@ class Listeners : ViewPager2.OnPageChangeCallback,
#pragma warning disable CS0618 // Type or member is obsolete
TabLayout.IOnTabSelectedListener,
#pragma warning restore CS0618 // Type or member is obsolete
ViewPager.IOnPageChangeListener,
NavigationBarView.IOnItemSelectedListener,
TabLayoutMediator.ITabConfigurationStrategy
{
Expand Down Expand Up @@ -835,16 +834,6 @@ void TabLayout.IOnTabSelectedListener.OnTabUnselected(TabLayout.Tab tab)
{
_tabbedPageManager.SetIconColorFilter(tab, false);
}
void ViewPager.IOnPageChangeListener.OnPageScrolled(int position, float positionOffset, int positionOffsetPixels)
{
}

void ViewPager.IOnPageChangeListener.OnPageScrollStateChanged(int state)
{
}

void ViewPager.IOnPageChangeListener.OnPageSelected(int position) =>
OnPageSelected(position);
}
}
}
20 changes: 20 additions & 0 deletions src/ProfiledAot/src/maui/AppFlyoutPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<FlyoutPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="maui.AppFlyoutPage"
xmlns:local="clr-namespace:maui"
Title="AppFlyoutPage">
<FlyoutPage.Detail>
<local:Tabs Title="Detail"></local:Tabs>
</FlyoutPage.Detail>
<FlyoutPage.Flyout>
<ContentPage Title="Flyout">
<VerticalStackLayout>
<Label Text="Flyout Item 1"></Label>
<Label Text="Flyout Item 2"></Label>
<Label Text="Flyout Item 3"></Label>
<Label Text="Flyout Item 4"></Label>
</VerticalStackLayout>
</ContentPage>
</FlyoutPage.Flyout>
</FlyoutPage>
9 changes: 9 additions & 0 deletions src/ProfiledAot/src/maui/AppFlyoutPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace maui;

public partial class AppFlyoutPage : FlyoutPage
{
public AppFlyoutPage()
{
InitializeComponent();
}
}
26 changes: 25 additions & 1 deletion src/ProfiledAot/src/maui/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,40 @@ namespace maui;
public partial class MainPage : ContentPage
{
int count = 0;
bool _isLoaded;
bool _startCompleted;

public MainPage()
{
InitializeComponent();
Start();

if (Application.Current.MainPage is not AppFlyoutPage)
{
Start();
this.Loaded += OnMainPageLoaded;
}
}

private async void Start()
{
CounterBtn.Text = await CommonMethods.Invoke();
_startCompleted= true;
LoadFlyoutPage();
}

void OnMainPageLoaded(object sender, EventArgs e)
{
_isLoaded = true;
LoadFlyoutPage();
}

async void LoadFlyoutPage()
{
if (_isLoaded && _startCompleted)
{
await Task.Delay(500);
Application.Current.MainPage = new AppFlyoutPage();
}
}

private void OnCounterClicked(object sender, EventArgs e)
Expand Down
8 changes: 8 additions & 0 deletions src/ProfiledAot/src/maui/Tabs.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="maui.Tabs"
xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
android:TabbedPage.ToolbarPlacement="Bottom"
Title="Tabs">
</TabbedPage>
13 changes: 13 additions & 0 deletions src/ProfiledAot/src/maui/Tabs.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace maui;

public partial class Tabs : TabbedPage
{
public Tabs()
{
InitializeComponent();

Children.Add(new NavigationPage(new MainPage()) { Title = "Tab 1" });
Children.Add(new NavigationPage(new MainPage()) { Title = "Tab 2" });
Children.Add(new NavigationPage(new MainPage()) { Title = "Tab 3" });
}
}

0 comments on commit 15df4ed

Please sign in to comment.