diff options
author | Vitalii Tomkiv <vitalit@google.com> | 2016-07-26 11:07:48 -0700 |
---|---|---|
committer | Vitalii Tomkiv <vitalit@google.com> | 2016-08-04 14:41:00 -0700 |
commit | 2bd06925a1010a225102212b66784434b369fd87 (patch) | |
tree | 05fc79bedd7457c4e8be8b5de6ad62a58ff4de3f /car-default-input-service | |
parent | a89dc821cb8aabec4045487c6c8b5603b8fcb89a (diff) | |
download | Car-2bd06925a1010a225102212b66784434b369fd87.tar.gz |
Refactor CarInputService to allow customization of input button
handling.
This CL adds ICarInput service, and overlay config to specify service
that should handle inputs. If input is not handled it will fall back to
default implementation.
Change-Id: I71f1fbac780ab34901f6a3d0951e0a2efb02a61c
Diffstat (limited to 'car-default-input-service')
-rw-r--r-- | car-default-input-service/Android.mk | 34 | ||||
-rw-r--r-- | car-default-input-service/AndroidManifest.xml | 27 | ||||
-rw-r--r-- | car-default-input-service/proguard.flags | 2 | ||||
-rw-r--r-- | car-default-input-service/res/drawable-hdpi/ic_launcher.png | bin | 0 -> 9397 bytes | |||
-rw-r--r-- | car-default-input-service/res/drawable-ldpi/ic_launcher.png | bin | 0 -> 2729 bytes | |||
-rw-r--r-- | car-default-input-service/res/drawable-mdpi/ic_launcher.png | bin | 0 -> 5237 bytes | |||
-rw-r--r-- | car-default-input-service/res/drawable-xhdpi/ic_launcher.png | bin | 0 -> 14383 bytes | |||
-rw-r--r-- | car-default-input-service/res/values/strings.xml | 18 | ||||
-rw-r--r-- | car-default-input-service/src/android/car/input/service/DefaultInputService.java | 41 |
9 files changed, 122 insertions, 0 deletions
diff --git a/car-default-input-service/Android.mk b/car-default-input-service/Android.mk new file mode 100644 index 0000000000..59ef91c8ad --- /dev/null +++ b/car-default-input-service/Android.mk @@ -0,0 +1,34 @@ +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# + +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := android.car.input.service + +# Each update should be signed by OEMs +LOCAL_CERTIFICATE := platform +LOCAL_PRIVILEGED_MODULE := true + +LOCAL_PROGUARD_FLAG_FILES := proguard.flags +LOCAL_PROGUARD_ENABLED := disabled + +LOCAL_JAVA_LIBRARIES += android.car + +include $(BUILD_PACKAGE) diff --git a/car-default-input-service/AndroidManifest.xml b/car-default-input-service/AndroidManifest.xml new file mode 100644 index 0000000000..0e15e7d17a --- /dev/null +++ b/car-default-input-service/AndroidManifest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.car.input.service" + android:versionCode="1" + android:versionName="1.0"> + <application android:label="@string/app_name" android:icon="@drawable/ic_launcher" + android:directBootAware="true"> + <service android:name=".DefaultInputService" + android:permission="android.car.permission.BIND_CAR_INPUT_SERVICE" + android:exported="false" + /> + </application> +</manifest> diff --git a/car-default-input-service/proguard.flags b/car-default-input-service/proguard.flags new file mode 100644 index 0000000000..565df26b8d --- /dev/null +++ b/car-default-input-service/proguard.flags @@ -0,0 +1,2 @@ +-verbose +-keep @com.android.internal.annotations.VisibleForTesting class * diff --git a/car-default-input-service/res/drawable-hdpi/ic_launcher.png b/car-default-input-service/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000000..96a442e5b8 --- /dev/null +++ b/car-default-input-service/res/drawable-hdpi/ic_launcher.png diff --git a/car-default-input-service/res/drawable-ldpi/ic_launcher.png b/car-default-input-service/res/drawable-ldpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000000..99238729d8 --- /dev/null +++ b/car-default-input-service/res/drawable-ldpi/ic_launcher.png diff --git a/car-default-input-service/res/drawable-mdpi/ic_launcher.png b/car-default-input-service/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000000..359047dfa4 --- /dev/null +++ b/car-default-input-service/res/drawable-mdpi/ic_launcher.png diff --git a/car-default-input-service/res/drawable-xhdpi/ic_launcher.png b/car-default-input-service/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000000..71c6d760f0 --- /dev/null +++ b/car-default-input-service/res/drawable-xhdpi/ic_launcher.png diff --git a/car-default-input-service/res/values/strings.xml b/car-default-input-service/res/values/strings.xml new file mode 100644 index 0000000000..c4dbd4681b --- /dev/null +++ b/car-default-input-service/res/values/strings.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <string name="app_name">Car Default Input Service</string> +</resources> diff --git a/car-default-input-service/src/android/car/input/service/DefaultInputService.java b/car-default-input-service/src/android/car/input/service/DefaultInputService.java new file mode 100644 index 0000000000..2502525f0f --- /dev/null +++ b/car-default-input-service/src/android/car/input/service/DefaultInputService.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.car.input.service; + +import android.car.input.CarInputHandlingService; +import android.car.input.CarInputHandlingService.InputFilter; +import android.util.Log; +import android.view.KeyEvent; + +/** + * Default implementation of {@link CarInputHandlingService}. + * + * This implementation does nothing, just serves as showcase how input service should be + * implemented. + */ +public class DefaultInputService extends CarInputHandlingService { + private static final String TAG = DefaultInputService.class.getSimpleName(); + + public DefaultInputService() { + super(new InputFilter[0]); + } + + @Override + protected void onKeyEvent(KeyEvent event, int targetDisplay) { + // Implement your handling here + Log.i(TAG, "onKeyEvent(" + event + ", " + targetDisplay + ")"); + } +} |