OEM 맞춤 입력을 사용하여 새로운 비표준 Android 기능에 관한 새로운 자동차 입력 이벤트를 추가하세요. 비표준 입력 이벤트는 기존 Android KeyEvent로 매핑되지 않으며, 일반적이고 모든 Android 표시 경로에서 작동하도록 설계되었지만 OEM 관련 기능을 구현하도록 확장되지는 않습니다. 예를 들어, 핸들 컨트롤에 있는 버튼을 누르면 인텐트를 통해 자동차의 현재 위치가 적용된 지도 앱이 열립니다. 이 기능을 통해 운전자는 운전하는 동안 방해받지 않고 현재 위치를 시각적으로 확인할 수 있습니다.
이 도움말에서는 기존 Android KeyEvent를 재사용하여, 기능을 나타내는 데 사용할 수 있는 Android KeyEvent가 없을 때만 사용할 CustomInputEvent를 만드는 방법을 설명합니다.
OEM은 CarInputService에서 들어오는 CustomInputEvents를 처리하기 위한 Android 시스템 서비스를 제공합니다.
android.permission.INJECT_EVENTS 권한으로 표시된 서비스만 Car Input API(CarInputManager)에서 CustomInputEvents를 등록하고 수신할 수 있습니다. 이 Android 시스템 권한으로 서드 파티 서비스나 애플리케이션에 서명할 수 없습니다(OEM 서비스만 해당).
따라서 서드 파티 서비스나 애플리케이션은 Car Input API에 등록할 수 없습니다.
OEM Android 시스템 서비스는 SystemApi 및 공개 메서드에 액세스할 수 있습니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-09(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-09(UTC)"],[],[],null,["# OEM custom inputs\n\nUse OEM custom inputs to add new Car input events for new and non-standard\nAndroid features. Non-standard input events are not mapped by the existing\nAndroid `KeyEvent`, designed to be generic and to work on any Android surface\nbut not extended to implement OEM-specific features. For example, a button\nlocated on the steering wheel control that, when pressed, opens a maps app\n(through an intent) with the car's current location. This feature enables\ndrivers to visualize their current location without becoming distracted while\ndriving.\n\nThis article describes how to reuse an existing Android `KeyEvent` to\ncreate a `CustomInputEvent` for use *only* when no Android `KeyEvent` can\nbe used to represent the feature.\n\nHW_CUSTOM_INPUT\n---------------\n\nAn OEM custom input is represented by [HW_CUSTOM_INPUT](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/automotive/vehicle/2.0/types.hal) and\n[CustomInputEvent.java](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/car-lib/src/android/car/input). [HW_CUSTOM_INPUT](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/automotive/vehicle/2.0/types.hal) is the\nnative event, instantiated by the car hardware (Vehicle HAL). OEMs determine\nhow to instantiate this event. Access to [HW_CUSTOM_INPUT](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/automotive/vehicle/2.0/types.hal) is\nset as \\[read only\\], with `VehiclePropertyAccess:READ`.\n\nTo ensure the Vehicle HAL can always broadcast the latest available value, the\n[HW_CUSTOM_INPUT](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/automotive/vehicle/2.0/types.hal) notification is set as `ON_CHANGE`, with\n`VehiclePropertyChangeMode:ON_CHANGE`.\n\n[HW_CUSTOM_INPUT](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/automotive/vehicle/2.0/types.hal) values are composed of an array of generic\n`int32`, set as `GLOBAL` (with `VehicleArea:GLOBAL`) The three\ngeneric integers are:\n\n1. The first element represents the input code to be defined by the OEM.\n You can associate any semantic to the input code.\n\n | **Note:** If you don't need more than 10 input codes, then you can use the generic functions (see `INPUT_CODE_F1` to `INPUT_CODE_F10` constants defined in `CustomInputType`, see `types.hal` file) to help readability. Using the generic functions is completely optional.\n2. The second element stores the target display, such as the main display\n or cluster.\n\n3. The third element contains the number of times the event was repeated.\n For example, to indicate how many times a button was pressed.\n\nCustomInputEvent and Car Input API\n----------------------------------\n\n[InputHalService](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/service/src/com/android/car/hal/InputHalService.java) is the Car service that receives an incoming\n`HW_CUSTOM_INPUT` from the Vehicle HAL.\n\n[InputHalService](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/service/src/com/android/car/hal/InputHalService.java) converts the incoming `HW_CUSTOM_INPUT` into\nthe `CustomInputEvent`, a Java [parcelable](https://developer.android.com/reference/android/os/Parcelable) class located in\n[car-lib/src/android/car/input](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/car-lib/src/android/car/input), along with the respective\n[aidl interface](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/car-lib/src/android/car/input).\n\n[CarInputService](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/service/src/com/android/car/CarInputService.java), a core Car Input service, receives incoming\nCustomInputEvents and then sends them to any registered Android system service.\n\nTo register and receive incoming CustomInputEvents, system services must:\n\n- Implement [CarInputManager.CarInputCaptureCallback#onKeyEvents](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/service/src/com/android/car/CarInputService.java).\n\n- Register through [CarInputManager#requestInputEventCapture](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/service/src/com/android/car/CarInputService.java),\n passing `CarInputManager.INPUT_TYPE_CUSTOM_INPUT_EVENT` as the input\n type parameter.\n\n To unregister, services must invoke\n [CarInputManager#releaseInputEventCapture](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/service/src/com/android/car/CarInputService.java).\n\nThe following diagram illustrates the workflow of an OEM Custom Input event.\n\nOEM Android system services\n---------------------------\n\nOEMs provide their Android system service to handle incoming\nCustomInputEvents from `CarInputService`.\n\nOnly those services marked with the\n[android.permission.INJECT_EVENTS](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/res/AndroidManifest.xml;l=3303) privilege permission\ncan register and receive CustomInputEvents from the Car Input API\n([CarInputManager](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/car-lib/src/android/car/input/CarInputManager.java)). No third party service or application can\nbe signed with this Android system permission (only OEM services).\nTherefore, no third party service or application can register\nagainst the Car Input API.\n\nOEM Android system services can access `SystemApi` and public methods.\n\nReference implementation\n------------------------\n\nSee the reference implementation in\n[packages/services/Car/tests/SampleCustomInputService](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/tests/), which\nis provided as an example and a guideline. For example, to add a new button\nin the steering wheel control. When pressed, this new button starts the\nmaps app with the current car location.\n\nIn this example, the OEM selected `INPUT_CODE_F1` (the first `CustomInputEvent`\nconvenience function) to represent this new feature (opening the maps app with\nthe current car location).\n| **Note:** The input code range represented by `INPUT_CODE_F1` up to `INPUT_CODE_F10` constants is used for convenience only. OEMs cat set any value for input code.\n\nDuring start up, this service registers itself against `CarInputManager`\nthrough `requestInputEventCapture` (see the\n[reference implementation registration code](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/tests/SampleCustomInputService/src/com/android/car/custominput/sample/SampleCustomInputService.java).\n\nWhen receiving incoming CustomInputEvents, this service sends the intent\nto start the maps app. To learn how this is accomplished, see\n[CustomInputEventListener.java](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/tests/SampleCustomInputService/src/com/android/car/custominput/sample/CustomInputEventListener.java)."]]