diff --git a/media/lib/tvremote/Android.bp b/media/lib/tvremote/Android.bp index 5f101a3141c8c..c5d14191c6c80 100644 --- a/media/lib/tvremote/Android.bp +++ b/media/lib/tvremote/Android.bp @@ -20,5 +20,8 @@ java_sdk_library { api_packages: ["com.android.media.tv.remoteprovider"], dex_preopt: { enabled: false, - } + }, + static_libs: [ + "android-support-annotations" + ], } diff --git a/media/lib/tvremote/java/com/android/media/tv/remoteprovider/TvRemoteProvider.java b/media/lib/tvremote/java/com/android/media/tv/remoteprovider/TvRemoteProvider.java index 9a3b350f1f391..969b5a4a978ed 100644 --- a/media/lib/tvremote/java/com/android/media/tv/remoteprovider/TvRemoteProvider.java +++ b/media/lib/tvremote/java/com/android/media/tv/remoteprovider/TvRemoteProvider.java @@ -18,13 +18,19 @@ package com.android.media.tv.remoteprovider; import android.annotation.FloatRange; import android.annotation.NonNull; +import android.annotation.SuppressAutoDoc; import android.content.Context; import android.media.tv.ITvRemoteProvider; import android.media.tv.ITvRemoteServiceInput; import android.os.IBinder; import android.os.RemoteException; +import android.support.annotation.IntDef; import android.util.Log; +import android.view.KeyEvent; +import android.view.MotionEvent; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.LinkedList; import java.util.Objects; @@ -43,6 +49,63 @@ import java.util.Objects; public abstract class TvRemoteProvider { + /** @hide */ + @IntDef({ + KeyEvent.KEYCODE_BUTTON_A, + KeyEvent.KEYCODE_BUTTON_B, + KeyEvent.KEYCODE_BUTTON_X, + KeyEvent.KEYCODE_BUTTON_Y, + KeyEvent.KEYCODE_BUTTON_L1, + KeyEvent.KEYCODE_BUTTON_L2, + KeyEvent.KEYCODE_BUTTON_R1, + KeyEvent.KEYCODE_BUTTON_R2, + KeyEvent.KEYCODE_BUTTON_SELECT, + KeyEvent.KEYCODE_BUTTON_START, + KeyEvent.KEYCODE_BUTTON_MODE, + KeyEvent.KEYCODE_BUTTON_THUMBL, + KeyEvent.KEYCODE_BUTTON_THUMBR, + KeyEvent.KEYCODE_DPAD_UP, + KeyEvent.KEYCODE_DPAD_DOWN, + KeyEvent.KEYCODE_DPAD_LEFT, + KeyEvent.KEYCODE_DPAD_RIGHT, + KeyEvent.KEYCODE_BUTTON_1, + KeyEvent.KEYCODE_BUTTON_2, + KeyEvent.KEYCODE_BUTTON_3, + KeyEvent.KEYCODE_BUTTON_4, + KeyEvent.KEYCODE_BUTTON_5, + KeyEvent.KEYCODE_BUTTON_6, + KeyEvent.KEYCODE_BUTTON_7, + KeyEvent.KEYCODE_BUTTON_8, + KeyEvent.KEYCODE_BUTTON_9, + KeyEvent.KEYCODE_BUTTON_10, + KeyEvent.KEYCODE_BUTTON_11, + KeyEvent.KEYCODE_BUTTON_12, + KeyEvent.KEYCODE_BUTTON_13, + KeyEvent.KEYCODE_BUTTON_14, + KeyEvent.KEYCODE_BUTTON_15, + KeyEvent.KEYCODE_BUTTON_16, + KeyEvent.KEYCODE_ASSIST, + KeyEvent.KEYCODE_VOICE_ASSIST, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface GamepadKeyCode { + } + + /** @hide */ + @IntDef({ + MotionEvent.AXIS_X, + MotionEvent.AXIS_Y, + MotionEvent.AXIS_Z, + MotionEvent.AXIS_RZ, + MotionEvent.AXIS_LTRIGGER, + MotionEvent.AXIS_RTRIGGER, + MotionEvent.AXIS_HAT_X, + MotionEvent.AXIS_HAT_Y, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface GamepadAxis { + } + /** * The {@link Intent} that must be declared as handled by the service. * The service must also require the {@link android.Manifest.permission#BIND_TV_REMOTE_SERVICE} @@ -357,10 +420,13 @@ public abstract class TvRemoteProvider { *