如何在 TvInputService 覆盖视图中接收输入事件
How to receive input events in TvInputService overlay view
Tv Input Framework (TIF) documentaition 说:
Only system TV Inputs are eligible to receive InputEvents
, and only if they have the RECEIVE_INPUT_EVENT
system permission. The TV Input is responsible to determine which InputEvent
s to consume and should allow the TV App to handle the keys it does not need to consume.
这个RECEIVE_INPUT_EVENT
好像是系统权限。
尝试通过 adb
启用它失败:
$ adb shell pm grant com.example.mytvinput \
com.android.tv.permission.RECEIVE_INPUT_EVENT
Operation not allowed: java.lang.SecurityException: Permission
com.android.tv.permission.RECEIVE_INPUT_EVENT is not a changeable permission type
Android Open Source Project (AOSP) sources indicate that RECEIVE_INPUT_EVENT
permission is signatureOrSystem
type, which in turn is defined by Android Permission documentation 为:
A permission that the system grants only to applications that are in the Android system image or that are signed with the same certificate as the application that declared the permission.
如何为消耗输入(例如 HbbTv)的 Android 电视输入服务开发覆盖?
是否必须将开发的 Tv Input 编译成 android 图像才能开发它?
您应该在 /system/priv-app
中安装您的应用程序。
/system/priv-app
是需要比其他应用程序更多权限的应用程序的特殊位置。
循序渐进
要启动具有可写系统分区的模拟器,您应该使用 -writable-system
标志。
./emulator -writable-system -avd Oreo_Android_TV_1080p_API_26
下一步重新挂载 /system
分区
adb root
adb remount
接下来将您的应用程序移动到 /system/priv-app
并重新启动
adb shell mv /data/app/com.example.myinput /system/priv-app/com.example.myinput
来源
Android Emulator Command Line doc, explaining -writable-service flag
What is the difference between system apps and privileged apps on Android?
Tv Input Framework (TIF) documentaition 说:
Only system TV Inputs are eligible to receive
InputEvents
, and only if they have theRECEIVE_INPUT_EVENT
system permission. The TV Input is responsible to determine whichInputEvent
s to consume and should allow the TV App to handle the keys it does not need to consume.
这个RECEIVE_INPUT_EVENT
好像是系统权限。
尝试通过 adb
启用它失败:
$ adb shell pm grant com.example.mytvinput \
com.android.tv.permission.RECEIVE_INPUT_EVENT
Operation not allowed: java.lang.SecurityException: Permission
com.android.tv.permission.RECEIVE_INPUT_EVENT is not a changeable permission type
Android Open Source Project (AOSP) sources indicate that RECEIVE_INPUT_EVENT
permission is signatureOrSystem
type, which in turn is defined by Android Permission documentation 为:
A permission that the system grants only to applications that are in the Android system image or that are signed with the same certificate as the application that declared the permission.
如何为消耗输入(例如 HbbTv)的 Android 电视输入服务开发覆盖?
是否必须将开发的 Tv Input 编译成 android 图像才能开发它?
您应该在 /system/priv-app
中安装您的应用程序。
/system/priv-app
是需要比其他应用程序更多权限的应用程序的特殊位置。
循序渐进
要启动具有可写系统分区的模拟器,您应该使用 -writable-system
标志。
./emulator -writable-system -avd Oreo_Android_TV_1080p_API_26
下一步重新挂载 /system
分区
adb root
adb remount
接下来将您的应用程序移动到 /system/priv-app
并重新启动
adb shell mv /data/app/com.example.myinput /system/priv-app/com.example.myinput
来源
Android Emulator Command Line doc, explaining -writable-service flag
What is the difference between system apps and privileged apps on Android?