User space driver in Android Things
Devfest Kyoto 2018
#devfest18
自己紹介
Takuya Kubota�@kubotaku1119
#devfest18
User space driver
in Android Things
#devfest18
Extends the core Android framework with additional APIs
Android Things Framework
#devfest18
Google Play Services
#devfest18
Management console
#devfest18
https://developer.android.com/things/hardware/
#devfest18
User space driver
#devfest18
Out of sight until needed�Out of mind until utilized�https://mui.jp
#devfest18
Out of sight until needed�Out of mind until utilized�https://mui.jp
#devfest18
#devfest18
#devfest18
Hardware Component
#devfest18
Hardware Component
Android Things
#devfest18
Hardware Component
Android Things
Peripheral I/O APIs
#devfest18
Hardware Component
#devfest18
Hardware Component
Original Listener
#devfest18
Hardware Component
#devfest18
Hardware Component
Original Listener
#devfest18
Touch Eventは通常、
システムからViewに通知される
#devfest18
Listenerのせいで
Viewが活用できなぁああい!!!
※某ハリウッド俳優のテンションで読んでください
#devfest18
そこで
User space driverを使う
#devfest18
User space driver
#devfest18
User space driver
#devfest18
Hardware Component
#devfest18
private void initialize() {
// Input Driver生成と登録� mDriver = InputDriver.builder()� .setName(DRIVER_NAME)� .setAxisConfiguration(MotionEvent.AXIS_X, 0, 255, 0, 0)� .setAxisConfiguration(MotionEvent.AXIS_Y, 0, 255, 0, 0)� .build();�� UserDriverManager manager = UserDriverManager.getInstance();� manager.registerInputDriver(mDriver);
}
// A state change has occurred�private void triggerEvent(int x, int y, boolean pressed) {
// Eventを発行(MotionEventとして通知される)� InputDriverEvent event = new InputDriverEvent();� event.setPosition(MotionEvent.AXIS_X, x);� event.setPosition(MotionEvent.AXIS_Y, y);� event.setContact(pressed);�� mDriver.emit(event);�}
https://developer.android.com/things/sdk/drivers/input
#devfest18
デモ
#devfest18
まとめ
#devfest18
Coming Soon!!!
#devfest18
Coming Soon!!!
#devfest18
Thank you
#devfest18