28

Crashlytics is reporting NullPointerException related to Auto Fill as shown below:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method
'boolean com.android.server.autofill.RemoteFillService$PendingRequest.cancel()' on a null object reference
  at android.os.Parcel.readException(Parcel.java:1965)
  at android.os.Parcel.readException(Parcel.java:1905)
  at android.app.IActivityManager$Stub$Proxy.reportAssistContextExtras(IActivityManager.java:8297)
  at android.app.ActivityThread.handleRequestAssistContextExtras(ActivityThread.java:3210)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
  at android.os.Handler.dispatchMessage(Handler.java:105)
  at android.os.Looper.loop(Looper.java:164)
  at android.app.ActivityThread.main(ActivityThread.java:6944)
  at java.lang.reflect.Method.invoke(Method.java)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Caused by android.os.RemoteException: Remote stack trace:
  at com.android.server.autofill.RemoteFillService.cancelCurrentRequest(RemoteFillService.java:177)
  at com.android.server.autofill.Session.cancelCurrentRequestLocked(Session.java:465)
  at com.android.server.autofill.Session.access$1000(Session.java:118)
  at com.android.server.autofill.Session$1.onHandleAssistData(Session.java:322)
  at com.android.server.am.ActivityManagerService.reportAssistContextExtras(ActivityManagerService.java:14713)

However, the stack does not include anything from my app yet crash is happening on my side.

ozbek
  • 20,955
  • 5
  • 61
  • 84
Sanjay Kumar
  • 1,135
  • 14
  • 27

1 Answers1

13

This is not an issue with your app but with specific Android OEMs. Seems to be happening more frequently on Samsung Devices and not seen on Pixel Devices. Here is an issue report to Google which is closed as 'Won't Fix'. https://issuetracker.google.com/issues/123311621

Since the crash is happening because of autofill. I would recommend disabling autofill for the specific view by setting importanForAutofill as false/no. https://developer.android.com/reference/android/R.attr.html#importantForAutofill

Gelo
  • 320
  • 2
  • 9
  • 1
    Can you back your claim that setting `importanForAutofill` to `no` will avoid this crash? Have you successfully reproduced the crash and tested the avoidance with that setting? Or at least eliminated the crash on your remote user devices? – ozbek Jun 10 '19 at 03:12
  • I was not able to reproduce the crash. I did however tested using an edittext with autofill then disabled the autofill by calling importantForAutofill on my oncreate. It worked on disabling autofill. As for the crash let me try to test it more on my side. – Gelo Jun 10 '19 at 12:11
  • Hello. I would like to know if you use TextInputLayout in you application. If so can you paste a copy of the layout file that has this. – Gelo Jun 11 '19 at 02:18
  • It is a super interactive app and there are bunch of them, but here is one: https://gist.github.com/ozbek/6e1cf0a878efbffa383e87ffd2cdb4bb – ozbek Jun 11 '19 at 03:09
  • I have received crash reports from Google devices too (Pixel 2 XL and Pixel 3, both running Android 9). – manfcas Oct 08 '19 at 13:36