Add action to startSelfIntent to easily distinguish it as app#2833
Add action to startSelfIntent to easily distinguish it as app#2833nift4 wants to merge 2 commits intoandroidx:mainfrom
Conversation
| mainHandler = Util.createHandler(Looper.getMainLooper(), /* callback= */ this); | ||
| mainExecutor = (runnable) -> Util.postOrRun(mainHandler, runnable); | ||
| startSelfIntent = new Intent(mediaSessionService, mediaSessionService.getClass()); | ||
| startSelfIntent.setAction("androidx.media3.session.MediaNotificationManager.START_SELF_INTENT"); |
There was a problem hiding this comment.
Let's call this MediaSessionService. Agreed the origin is the MediaNotificationManager.
And the I think it would make sense to add this as a public constant to MediaSessionService, so that an app would be able to compare the action easily and then discard the intent as a no-op.
WDYT?
There was a problem hiding this comment.
Hi, thanks for the feedback. I agree with your idea and did it for this and the other missing Intent action.
7edcad7 to
b32a5ba
Compare
|
Thanks. I will take that.
Just as an aside. Above API 31 the only action that should arrive in As a developer I would actually never need to override this method I think. If you do that you can, but you would be responsible for doing this in a way that doesn't break the state handling of the service. If an app is sending such If it was about me, I'm going to adjust the documentation you added accordingly. Please refrain from pushing further changes. |
I was debugging start commands I shouldn't be recieving, and the startSelfIntent with empty action was sort of confusing because it wasn't immediately obvious where it came from. Adding a unique action string doesn't have any ill effects and allows easily identifying these intents in onStartCommand().
|
I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks! |
b32a5ba to
2bd532c
Compare
|
Hi @marcbaechinger, is there anything blocking the merge of this change in internal review? Thanks. |
|
Sorry for not giving you an update earlier. We have quite a few changes in I will see that there is an API which will let you detect start self Intents, but I don't think we will exactly follow this PR here. I suggest we keep the PR until we have submitted the changes I'm talking about. Thanks for your patience and sorry for the wait. |
I was debugging start commands I shouldn't be recieving, and the startSelfIntent with empty action was sort of confusing because it wasn't immediately obvious where it came from. Adding a unique action string doesn't have any ill effects and allows easily identifying these intents in onStartCommand().