[Media ML] Unhide dispatch key event APIs

When dispatching key events, PhoneWindowManager and AudioManager uses
MediaSessionLegacyHelper, which in turn uses MediaSessionManager.
This CL exposes the MediaSessionManager APIs as system API since
MediaSessionLegacyHelper will not be moved to mainline.

Bug: 176953066
Test: m update-api
Change-Id: Ib7b06f076904ea464c31314279a2ced451f4c46e
This commit is contained in:
Jin Seok Park
2021-01-07 15:51:57 +09:00
parent edb1ed6461
commit 7ffb73f8ff
2 changed files with 6 additions and 0 deletions

View File

@@ -109,8 +109,11 @@ package android.media.session {
public final class MediaSessionManager {
method public void addOnActiveSessionsChangedListener(@NonNull android.media.session.MediaSessionManager.OnActiveSessionsChangedListener, @Nullable android.content.ComponentName, int, @Nullable android.os.Handler);
method public void dispatchMediaKeyEvent(@NonNull android.view.KeyEvent);
method public void dispatchMediaKeyEvent(@NonNull android.view.KeyEvent, boolean);
method public void dispatchMediaKeyEventAsSystemService(@NonNull android.view.KeyEvent);
method public boolean dispatchMediaKeyEventToSessionAsSystemService(@NonNull android.view.KeyEvent, @NonNull android.media.session.MediaSession.Token);
method public void dispatchVolumeKeyEvent(@NonNull android.view.KeyEvent, int, boolean);
method public void dispatchVolumeKeyEventAsSystemService(@NonNull android.view.KeyEvent, int);
method public void dispatchVolumeKeyEventToSessionAsSystemService(@NonNull android.view.KeyEvent, @NonNull android.media.session.MediaSession.Token);
method @NonNull public java.util.List<android.media.session.MediaController> getActiveSessionsForUser(@Nullable android.content.ComponentName, int);

View File

@@ -547,6 +547,7 @@ public final class MediaSessionManager {
* @param keyEvent the key event to send
* @hide
*/
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public void dispatchMediaKeyEvent(@NonNull KeyEvent keyEvent) {
dispatchMediaKeyEventInternal(keyEvent, /*asSystemService=*/false, /*needWakeLock=*/false);
}
@@ -558,6 +559,7 @@ public final class MediaSessionManager {
* @param needWakeLock true if a wake lock should be held while sending the key
* @hide
*/
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public void dispatchMediaKeyEvent(@NonNull KeyEvent keyEvent, boolean needWakeLock) {
dispatchMediaKeyEventInternal(keyEvent, /*asSystemService=*/false, needWakeLock);
}
@@ -630,6 +632,7 @@ public final class MediaSessionManager {
* @param musicOnly true if key event should only be sent to music stream
* @hide
*/
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public void dispatchVolumeKeyEvent(@NonNull KeyEvent keyEvent, int streamType,
boolean musicOnly) {
dispatchVolumeKeyEventInternal(keyEvent, streamType, musicOnly, /*asSystemService=*/false);