Skip to content
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

Java.Lang.IllegalStateException when resuming the App from an Android Autofill Service #18121

Closed
dinisvieira opened this issue Oct 18, 2023 · 3 comments
Labels
migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 t/bug Something isn't working

Comments

@dinisvieira
Copy link

Description

When using an android app that has an Autofill Service if we create an intent for "Autofilling" a field that opens the app again the app crashes on base.OnCreate();
This only seems to happen when using a "non-shell" implementation.

The Activity used for that Intent doesn't seem to matter. On the reproduction sample two different activities can be chosen for opening the app from the Autofill Service but they both crash on base.OnCreate().

Steps to Reproduce

  • Clone attached public repo
  • Run app
  • Press "Click Me" button
  • On the Autofill service screen choose "Test Fill Service"
  • Without closing the app open a browser
  • Open a site with a text input field and tap on that input to get focus and an option overlay should appear
  • Click the option "Click to Crash!"
  • App will crash on Activity base.OnCreate()

Doing the same steps with MainPage = new AppShell() doesn't crash the app.

Link to public reproduction project repository

https://github.com/dinisvieira/autofill-service-crash-repro/tree/main

Version with bug

8.0.0-rc.2.9373

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 10 and up (at least)

Did you find any workaround?

Using new AppShell() doesn't crash but this is not an option for us. We are migrating an entire "non-shell" app from Xamarin Forms.

Relevant log output

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
	at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1632)
	at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1672)
	at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:341)
	at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:306)
	at com.autofill.test.MainActivity.n_onCreate(Native Method)
	at com.autofill.test.MainActivity.onCreate(MainActivity.java:45)
	at android.app.Activity.performCreate(Activity.java:8657)
	at android.app.Activity.performCreate(Activity.java:8636)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4165)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4340)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2584)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8810)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
@dinisvieira dinisvieira added the t/bug Something isn't working label Oct 18, 2023
@mattleibow
Copy link
Member

May be related #18159

@DharunAR
Copy link

If this issue cannot be fixed immediately. Do we have any workaround for this issue? I am facing the similar problem which I have reported under #18159.

This is blocking our development migration from Xamarin to MAUI.

@samhouts samhouts added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Oct 20, 2023
@PureWeen
Copy link
Member

PureWeen commented Nov 6, 2023

Duplicate of #11501

@PureWeen PureWeen marked this as a duplicate of #11501 Nov 6, 2023
@PureWeen PureWeen closed this as completed Nov 6, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants