@@ -166,39 +166,6 @@ default void onForegroundServiceStartNotAllowedException() {}
166166 /** The action for {@link Intent} filter that must be declared by the service. */
167167 public static final String SERVICE_INTERFACE = "androidx.media3.session.MediaSessionService" ;
168168
169- /**
170- * The action of an {@link Intent} sent to this service by itself when it is already running, but
171- * wishes to move into the foreground state.
172- *
173- * <p>This action is not intended for starting the service from anywhere except custom foreground
174- * service handling. Most apps will never need to send this action themselves.
175- *
176- * <p>If an {@link Intent} with this action is received in a subclass' {@link
177- * #onStartCommand(Intent, int, int)} method, the intent should be passed to the superclass
178- * (MediaSessionService) implementation. No further action is required to handle it.
179- */
180- @ UnstableApi
181- public static final String ACTION_START_SELF =
182- "androidx.media3.session.MediaSessionService.ACTION_START_SELF" ;
183-
184- /**
185- * The action of an {@link Intent} sent to this service by the system when a custom notification
186- * or session action was clicked.
187- *
188- * <p>If an {@link Intent} with this action is received in a subclass' {@link
189- * #onStartCommand(Intent, int, int)} method, the intent should be passed to the superclass
190- * (MediaSessionService) implementation.
191- *
192- * <p>This {@link Intent} is not intended to be intercepted by subclasses. If subclasses wish to
193- * handle custom notification actions, {@link
194- * MediaNotification.Provider#handleCustomCommand(MediaSession, String, Bundle)} or {@link
195- * MediaSession.Callback#onCustomCommand(MediaSession, ControllerInfo, SessionCommand, Bundle)}
196- * are appropriate.
197- */
198- @ UnstableApi
199- public static final String ACTION_CUSTOM_NOTIFICATION_ACTION =
200- "androidx.media3.session.CUSTOM_NOTIFICATION_ACTION" ;
201-
202169 /**
203170 * The default timeout for a session to stay in a foreground service state after it paused,
204171 * stopped, failed or ended.
@@ -240,6 +207,27 @@ default void onForegroundServiceStartNotAllowedException() {}
240207 */
241208 @ UnstableApi public static final int SHOW_NOTIFICATION_FOR_IDLE_PLAYER_AFTER_STOP_OR_ERROR = 3 ;
242209
210+ /**
211+ * The action of an {@link Intent} sent to this service by itself when it is already running, but
212+ * wishes to move into the foreground state.
213+ *
214+ * <p>To start the service, an app must build a {@link MediaController} or a {@link MediaBrowser}
215+ * that binds to the service instead. Starting the service with {@link
216+ * Context#startForegroundService(Intent)} is highly discouraged.
217+ */
218+ @ UnstableApi
219+ protected static final String ACTION_START_SELF =
220+ "androidx.media3.session.MediaSessionService.ACTION_START_SELF" ;
221+
222+ /**
223+ * The action of an {@link Intent} sent to this service by the system from the media controls
224+ * notification in case the {@link android.app.PendingIntent} was build by {@link
225+ * DefaultMediaNotificationProvider} that uses {@link DefaultActionFactory}.
226+ */
227+ @ UnstableApi
228+ protected static final String ACTION_CUSTOM_NOTIFICATION_ACTION =
229+ "androidx.media3.session.CUSTOM_NOTIFICATION_ACTION" ;
230+
243231 private static final String TAG = "MSessionService" ;
244232
245233 private final Object lock ;
@@ -472,18 +460,8 @@ public IBinder onBind(@Nullable Intent intent) {
472460 /**
473461 * Called when a component calls {@link android.content.Context#startService(Intent)}.
474462 *
475- * <p>The default implementation handles the following events:
476- *
477- * <ul>
478- * <li>incoming media button events with the {@link Intent} action {@link
479- * Intent#ACTION_MEDIA_BUTTON}
480- * <li>custom notification actions with {@link Intent} action {@link
481- * #ACTION_CUSTOM_NOTIFICATION_ACTION}
482- * <li>foreground service state changes with {@link Intent} action {@link #ACTION_START_SELF}
483- * </ul>
484- *
485- * <p>Override this method if this service also needs to handle actions other than those mentioned
486- * above.
463+ * <p>Apps normally don't need to override this method. If you think you need to override this
464+ * method, <a href="https://github.com/androidx/media/issues">file a bug on GitHub</a>.
487465 *
488466 * <p>This method will be called on the main thread.
489467 */
0 commit comments