-
Notifications
You must be signed in to change notification settings - Fork 127
Description
Using the connect method from the remote library hangs without any callback.
Looking at the logs you can see that:
12:05:04.571 1891-4330 ActivityTaskManager pid-1891 Background activity launch blocked! [callingPackage: com.spotify.music; callingPackageTargetSdk: 35; callingUid: 10345; callingPid: 4379; appSwitchState: 2; callingUidHasAnyVisibleWindow: false; callingUidProcState: BOUND_TOP; isCallingUidPersistentSystemProcess: false; forcedBalByPiSender: BSP.NONE; intent: Intent { act=com.spotify.appauthorization.sso.action.ACTIVITY cat=[android.intent.category.DEFAULT] flg=0x10000000 pkg=com.spotify.music cmp=com.spotify.music/com.spotify.appauthorization.sso.internalauth.AuthorizationActivityInternalProxy (has extras) }; callerApp: ProcessRecord{5cb10ff 4379:com.spotify.music/u0a345}; inVisibleTask: false; balAllowedByPiCreator: BSP.ALLOW_BAL; balAllowedByPiCreatorWithHardening: BSP.ALLOW_BAL; resultIfPiCreatorAllowsBal: BAL_BLOCK; hasRealCaller: true; isCallForResult: false; isPendingIntent: false; autoOptInReason: notPendingIntent; realCallingPackage: com.spotify.music; realCallingPackageTargetSdk: 35; realCallingUid: 10345; realCallingPid: 4379; realCallingUidHasAnyVisibleWindow: false; realCallingUidProcState: BOUND_TOP; isRealCallingUidPersistentSystemProcess: false; originatingPendingIntent: null; realCallerApp: ProcessRecord{5cb10ff 4379:com.spotify.music/u0a345}; realInVisibleTask: false; balAllowedByPiSender: BSP.ALLOW_BAL; resultIfPiSenderAllowsBal: BAL_BLOCK]
Essentially the OS is blocking the Spotify app from starting the auth activity from the background.
An easy workaround that also proves this is the issue is to connect to Spotify (e.g from a service) while the Spotify app is in the foreground, which works fine.
I assume it used to work since android allows background activity starts if your app has a service that is bounded from a foreground app.
BUT, on OS 14 google added this restriction:
Starting from Android 14, if the app bound to the service is targeting Android 14 or higher, it no longer allows the app that has the service to start a background activity by default. The app has to pass the flag Context.BIND_ALLOW_ACTIVITY_STARTS to allow the bound service app to start background activities.
I suspect it has something to do with this limitation added on OS 14, but someone from the Spotify team needs to verify this.