Skip to content

Startup crash on Android 16: AutofillManager NPE inflating actionmain.xml (MaterialSwitch) #931

Description

@kasnder

Do you use TrackerControl from Google Play/F-Droid/other?
F-Droid

Describe the bug
ActivityMain fails to start with a NullPointerException inside the platform's AutofillManager construction, triggered while inflating actionmain.xml's MaterialSwitch (swEnabled, layout line 40).

System

  • ANDROID_VERSION=16
  • USER_APP_START_DATE=2026-08-29T08:32:25.061-04:00
  • USER_CRASH_DATE=2026-08-30T08:30:13.737-04:00
  • STACK_TRACE_HASH=cc2f9872
  • REPORT_ID=0d2a58e7-543b-4152-a394-85524eab6b53

Stack trace

java.lang.RuntimeException: Unable to start activity ComponentInfo{net.kollnig.missioncontrol.fdroid/eu.faircode.netguard.ActivityMain}
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:5040)
	...
Caused by: android.view.InflateException: Binary XML file line #40 in net.kollnig.missioncontrol.fdroid:layout/actionmain: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
	at android.view.LayoutInflater.createView(LayoutInflater.java:759)
	...
	at eu.faircode.netguard.ActivityMain.onCreate(SourceFile:243)
	...
Caused by: java.lang.NullPointerException: FileDescriptor must not be null
	at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:199)
	at android.os.ParcelFileDescriptor$2.createFromParcel(ParcelFileDescriptor.java:1164)
	...
	at android.util.MemoryIntArray.<init>(MemoryIntArray.java:89)
	...
	at android.provider.Settings$NameValueCache.getStringsForPrefixStripPrefix(Settings.java:4419)
	at android.provider.Settings$Config.getStrings(Settings.java:29123)
	at android.provider.SettingsConfigDataStore.getProperties(SettingsConfigDataStore.java:48)
	at android.provider.DeviceConfig.getProperties(DeviceConfig.java:1168)
	at android.provider.DeviceConfig.getBoolean(DeviceConfig.java:1263)
	at android.view.autofill.AutofillFeatureFlags.isFillDialogEnabled(AutofillFeatureFlags.java:446)
	at android.view.autofill.AutofillManager.<init>(AutofillManager.java:978)
	at android.app.SystemServiceRegistry$115.createService(SystemServiceRegistry.java:1704)
	...
	at android.widget.TextView.notifyListeningManagersAfterTextChanged(TextView.java:13654)
	at android.widget.TextView.setText(TextView.java:7961)
	at android.widget.TextView.setText(TextView.java:7729)
	at android.widget.TextView.<init>(TextView.java:2165)
	at android.widget.Button.<init>(Button.java:202)
	at android.widget.CompoundButton.<init>(CompoundButton.java:106)
	at androidx.appcompat.widget.SwitchCompat.<init>(SourceFile:1)
	at com.google.android.material.materialswitch.MaterialSwitch.<init>(SourceFile:11)
	... 28 more

Analysis

This is a platform-level bug, not app code. MaterialSwitchSwitchCompatCompoundButtonButtonTextView's constructor unconditionally calls setText(), which calls notifyListeningManagersAfterTextChanged()getSystemService(AUTOFILL_SERVICE). Constructing AutofillManager reads DeviceConfig, which on this device/build fails while creating a ParcelFileDescriptor from a MemoryIntArray with a null FileDescriptor — an OS-side bug, unrelated to actionmain.xml specifically. Any TextView-family widget inflated on an affected device would trigger it.

No app-side commit currently addresses this; actionmain.xml's MaterialSwitch (swEnabled, lines 33-40) is unchanged. The only realistic mitigation on our side would be wrapping setContentView() in ActivityMain.onCreate() (app/src/main/java/eu/faircode/netguard/ActivityMain.java:243) with a crash guard, though that would only avoid the crash rather than restore the UI, since inflation itself fails.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions