mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
connect() resolves the Discord app through DiscordSocialSdkInit.getEngineActivity() and hands the result straight to Context.getPackageManager() with no null check. That static was only ever set by DiscordAuthActivity, which runs during sign-in -- so every launch with a cached token started the SDK with it null, and :discord died with an NPE. Android restarted the service, which started again and died again. The app process never saw any of it, because the protocol is poll-only: the UI just sat on "Connecting" forever. Binding the SDK only during sign-in was wrong independently of that. The SDK's statics are per-process and Android restarts :discord whenever it likes, so the binding has to be re-established on demand rather than assumed to survive. Handing the Activity over is now separate from opening the browser: DiscordAuthActivity takes an EXTRA_AUTHORIZE flag and always binds, and the service will not call start() until a binding exists, launching the invisible Activity itself when there is none.