Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a729a81a authored by Jin Seok Park's avatar Jin Seok Park
Browse files

Make APIs that dispatch KeyEvent as system service @SystemApi

Bug: 160577019
Test: m update-api
Change-Id: Iea6096d68ede324006e939495dcff2a01c9c21a6
parent 2ea424ea
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -45,6 +45,13 @@ package android.media.session {
    field public static final int FLAG_EXCLUSIVE_GLOBAL_PRIORITY = 65536; // 0x10000
  }

  public final class MediaSessionManager {
    method public void dispatchMediaKeyEventAsSystemService(@NonNull android.view.KeyEvent);
    method public boolean dispatchMediaKeyEventAsSystemService(@NonNull android.media.session.MediaSession.Token, @NonNull android.view.KeyEvent);
    method public void dispatchVolumeKeyEventAsSystemService(@NonNull android.view.KeyEvent, int);
    method public void dispatchVolumeKeyEventAsSystemService(@NonNull android.media.session.MediaSession.Token, @NonNull android.view.KeyEvent);
  }

}

package android.net {
+10 −2
Original line number Diff line number Diff line
@@ -523,7 +523,8 @@ public final class MediaSessionManager {
     * @param keyEvent The KeyEvent to send.
     * @hide
     */
    public void dispatchMediaKeyEventAsSystemService(KeyEvent keyEvent) {
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public void dispatchMediaKeyEventAsSystemService(@NonNull KeyEvent keyEvent) {
        dispatchMediaKeyEventInternal(true, keyEvent, false);
    }

@@ -548,6 +549,7 @@ public final class MediaSessionManager {
     * @return {@code true} if the event was sent to the session, {@code false} otherwise
     * @hide
     */
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public boolean dispatchMediaKeyEventAsSystemService(@NonNull MediaSession.Token sessionToken,
            @NonNull KeyEvent keyEvent) {
        if (sessionToken == null) {
@@ -586,10 +588,15 @@ public final class MediaSessionManager {
     * Should be only called by the {@link com.android.internal.policy.PhoneWindow} or
     * {@link android.view.FallbackEventHandler} when the foreground activity didn't consume the key
     * from the hardware devices.
     * <p>
     * Valid stream types include {@link AudioManager.PublicStreamTypes} and
     * {@link AudioManager#USE_DEFAULT_STREAM_TYPE}.
     *
     * @param keyEvent The KeyEvent to send.
     * @param keyEvent volume key event
     * @param streamType type of stream
     * @hide
     */
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public void dispatchVolumeKeyEventAsSystemService(@NonNull KeyEvent keyEvent, int streamType) {
        dispatchVolumeKeyEventInternal(true, keyEvent, streamType, false);
    }
@@ -614,6 +621,7 @@ public final class MediaSessionManager {
     * @param keyEvent volume key event
     * @hide
     */
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public void dispatchVolumeKeyEventAsSystemService(@NonNull MediaSession.Token sessionToken,
            @NonNull KeyEvent keyEvent) {
        if (sessionToken == null) {
+7 −0
Original line number Diff line number Diff line
@@ -45,6 +45,13 @@ package android.media.session {
    field public static final int FLAG_EXCLUSIVE_GLOBAL_PRIORITY = 65536; // 0x10000
  }

  public final class MediaSessionManager {
    method public void dispatchMediaKeyEventAsSystemService(@NonNull android.view.KeyEvent);
    method public boolean dispatchMediaKeyEventAsSystemService(@NonNull android.media.session.MediaSession.Token, @NonNull android.view.KeyEvent);
    method public void dispatchVolumeKeyEventAsSystemService(@NonNull android.view.KeyEvent, int);
    method public void dispatchVolumeKeyEventAsSystemService(@NonNull android.media.session.MediaSession.Token, @NonNull android.view.KeyEvent);
  }

}

package android.os {