Skip to content

Conversation

@cillyvms
Copy link

@cillyvms cillyvms commented Sep 4, 2025

ItWasntMeWhoFarted on discord reported a crash on startup on a Pixel 3 https://pastebin.com/raw/6F79yg9u message link

My analysis from discord:
It's likely caused by the compat registerReceiver calling getApplicationContext (only on Android 12 or lower), which is initialized only after Application's attachBaseContext has finished
There was a change in january which made the compat registerReceiver always use getApplicationContext, which likely caused this regression during an AppCompat update https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:core/core/src/main/java/androidx/core/content/ContextCompat.java;l=649;bpv=1;bpt=0;drc=c283d06f837a2b93b8123d07b7ad5611ba36d9d4;dlc=5c86afb33905d66b89a29ce66362859bc48651e5

Moving the PackageStates.init() call out of attachBaseContext and to onCreate fixes this, although the comment raises a concern that the RpcProvider may run before Applications's onCreate has finished, but in my testing the calls to the provider only come through after onCreate. Are there other reasons why this code was run in attachBaseContext?

@thestinger
Copy link
Member

Your analysis isn't quite right. We've fixed this with #433 by avoiding the buggy AndroidX AppCompat API.

@thestinger thestinger closed this Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants