brave-browser: Crash (sometimes) when tapping on a text field (autofill related?) (NPE)

Description

When you tap on the text field on some sites (like archive.is, brave search, many other sites), the browser can suddenly crash. This doesnt happen everytime, but it does happen often enough to be annoying.

Logcat:

FATAL EXCEPTION: main
Process: com.brave.browser, PID: 23514
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.autofill.AutofillId.setSessionId(int)' on a null object reference
	at android.os.Parcel.createExceptionOrNull(Parcel.java:2383)
	at android.os.Parcel.createException(Parcel.java:2361)
	at android.os.Parcel.readException(Parcel.java:2344)
	at android.os.Parcel.readException(Parcel.java:2286)
	at android.app.IActivityTaskManager$Stub$Proxy.reportAssistContextExtras(IActivityTaskManager.java:5434)
	at android.app.ActivityThread.handleRequestAssistContextExtras(ActivityThread.java:3925)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2171)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:236)
	at android.app.ActivityThread.main(ActivityThread.java:8097)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
Caused by: android.os.RemoteException: Remote stack trace:
	at com.android.server.autofill.Session$AssistDataReceiverImpl.onHandleAssistData(Session.java:463)
	at com.android.server.wm.ActivityTaskManagerService.reportAssistContextExtras(ActivityTaskManagerService.java:3542)
	at android.app.IActivityTaskManager$Stub.onTransact(IActivityTaskManager.java:2506)
	at android.os.Binder.execTransactInternal(Binder.java:1154)
	at android.os.Binder.execTransact(Binder.java:1123)

Steps to reproduce

  1. Open a site like archive.is in a new tab. Tap on any text field.
  2. Probably won’t crash immediately. Keep browsing the web in another tab, occasionally coming back to this tab to tap on a text field.
  3. At some point tapping on the text field will cause it to crash. (On libgen.rs, I got this crash quite reliably after a minute or so.)

Actual result

Crash to launcher/home screen

Expected result

No crash

Reproduces how often

Intermittent issue

Brave version

1.69.164

Device

  • Brand/model: Xiaomi Redmi 10A (MIUI 12.5.16)
  • Android version: 11

Channel information

  • release (stable)
  • beta
  • nightly

Reproducibility

  • with Brave Shields disabled
  • with Brave Rewards disabled
  • in the latest version of Chrome

Miscellaneous information

Keyboard: Microsoft SwiftKey 9.10.44

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Here’s a fix for now:

  • Go to brave://flags to change the following flags
  • Enable #suppress-autofill-via-accessibility (Suppress Autofill Using the Android Accessibility API)
  • Enable #enable-autofill-virtual-view-structure (Enable the setting to provide a virtual view structure for Autofill)
  • Restart Brave
  • Now there should be a new “Autofill services” menu item in Brave Settings. Tap on it and change it to “Autofill using another service”
  • Restart Brave again.

After doing these steps, Brave does not crash anymore on my device and Bitwarden’s Autofill service works too.

@SergeyZhukovsky

On phone (arm64 build) both v1.78.51 and v1.78.52 are still broken, but on Waydroid (x86 and x64 builds) I couldn’t reproduce the issue on v1.78.52 anymore, only v1.78.51 seems to be affected there.