Convert country code to Layoutinfo (Language tag + Layout type)
Instead of passing country code to InputDevice.java, convert it
to Language tag and Layout type on native side and pass that
forward instead.
We can later add support for HID language tag, that would give
us better layout information than country code. This HID
language tag is for Keyboard devices so, we set this country
code derived language tag also for Keyboards only, even though
country code could be specified for all types of devices.
Moreover, we are using language tag and layout type for setting
layout related info for Virtual keyboard devices too, making
using country code redundant.
Test: atest inputflinger_tests
Bug: 259530132
Change-Id: I8eca5537a5bb44d0b8b056947cc317ac82a0901f
diff --git a/libs/input/Android.bp b/libs/input/Android.bp
index 8ddd18d..8f41cc1 100644
--- a/libs/input/Android.bp
+++ b/libs/input/Android.bp
@@ -26,7 +26,6 @@
filegroup {
name: "inputconstants_aidl",
srcs: [
- "android/hardware/input/InputDeviceCountryCode.aidl",
"android/os/IInputConstants.aidl",
"android/os/InputEventInjectionResult.aidl",
"android/os/InputEventInjectionSync.aidl",
diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp
index fb6c590..87333f2 100644
--- a/libs/input/InputDevice.cpp
+++ b/libs/input/InputDevice.cpp
@@ -26,7 +26,6 @@
#include <input/InputEventLabels.h>
using android::base::StringPrintf;
-using android::hardware::input::InputDeviceCountryCode;
namespace android {
@@ -178,7 +177,6 @@
mAlias(other.mAlias),
mIsExternal(other.mIsExternal),
mHasMic(other.mHasMic),
- mCountryCode(other.mCountryCode),
mKeyboardLayoutInfo(other.mKeyboardLayoutInfo),
mSources(other.mSources),
mKeyboardType(other.mKeyboardType),
@@ -197,7 +195,7 @@
void InputDeviceInfo::initialize(int32_t id, int32_t generation, int32_t controllerNumber,
const InputDeviceIdentifier& identifier, const std::string& alias,
- bool isExternal, bool hasMic, InputDeviceCountryCode countryCode) {
+ bool isExternal, bool hasMic) {
mId = id;
mGeneration = generation;
mControllerNumber = controllerNumber;
@@ -205,7 +203,6 @@
mAlias = alias;
mIsExternal = isExternal;
mHasMic = hasMic;
- mCountryCode = countryCode;
mSources = 0;
mKeyboardType = AINPUT_KEYBOARD_TYPE_NONE;
mHasVibrator = false;
diff --git a/libs/input/android/hardware/input/InputDeviceCountryCode.aidl b/libs/input/android/hardware/input/InputDeviceCountryCode.aidl
deleted file mode 100644
index 6bb1a60..0000000
--- a/libs/input/android/hardware/input/InputDeviceCountryCode.aidl
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2022 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.hardware.input;
-
-/**
- * Constant for HID country code declared by a HID device. These constants are declared as AIDL to
- * be used by java and native input code.
- *
- * @hide
- */
-@Backing(type="int")
-enum InputDeviceCountryCode {
- /**
- * Used as default value where country code is not set in the device HID descriptor
- */
- INVALID = -1,
-
- /**
- * Used as default value when country code is not supported by the HID device. The HID
- * descriptor sets "00" as the country code in this case.
- */
- NOT_SUPPORTED = 0,
-
- /**
- * Arabic
- */
- ARABIC = 1,
-
- /**
- * Belgian
- */
- BELGIAN = 2,
-
- /**
- * Canadian (Bilingual)
- */
- CANADIAN_BILINGUAL = 3,
-
- /**
- * Canadian (French)
- */
- CANADIAN_FRENCH = 4,
-
- /**
- * Czech Republic
- */
- CZECH_REPUBLIC = 5,
-
- /**
- * Danish
- */
- DANISH = 6,
-
- /**
- * Finnish
- */
- FINNISH = 7,
-
- /**
- * French
- */
- FRENCH = 8,
-
- /**
- * German
- */
- GERMAN = 9,
-
- /**
- * Greek
- */
- GREEK = 10,
-
- /**
- * Hebrew
- */
- HEBREW = 11,
-
- /**
- * Hungary
- */
- HUNGARY = 12,
-
- /**
- * International (ISO)
- */
- INTERNATIONAL = 13,
-
- /**
- * Italian
- */
- ITALIAN = 14,
-
- /**
- * Japan (Katakana)
- */
- JAPAN = 15,
-
- /**
- * Korean
- */
- KOREAN = 16,
-
- /**
- * Latin American
- */
- LATIN_AMERICAN = 17,
-
- /**
- * Netherlands (Dutch)
- */
- DUTCH = 18,
-
- /**
- * Norwegian
- */
- NORWEGIAN = 19,
-
- /**
- * Persian
- */
- PERSIAN = 20,
-
- /**
- * Poland
- */
- POLAND = 21,
-
- /**
- * Portuguese
- */
- PORTUGUESE = 22,
-
- /**
- * Russia
- */
- RUSSIA = 23,
-
- /**
- * Slovakia
- */
- SLOVAKIA = 24,
-
- /**
- * Spanish
- */
- SPANISH = 25,
-
- /**
- * Swedish
- */
- SWEDISH = 26,
-
- /**
- * Swiss (French)
- */
- SWISS_FRENCH = 27,
-
- /**
- * Swiss (German)
- */
- SWISS_GERMAN = 28,
-
- /**
- * Switzerland
- */
- SWITZERLAND = 29,
-
- /**
- * Taiwan
- */
- TAIWAN = 30,
-
- /**
- * Turkish_Q
- */
- TURKISH_Q = 31,
-
- /**
- * UK
- */
- UK = 32,
-
- /**
- * US
- */
- US = 33,
-
- /**
- * Yugoslavia
- */
- YUGOSLAVIA = 34,
-
- /**
- * Turkish_F
- */
- TURKISH_F = 35,
-}
\ No newline at end of file