miatoll: Import Keyhandler from Davinci

https://github.com/ArianK16a/android_device_xiaomi_davinci

This tells Inputdispatcher to ignore inputs from our Fingerprint scanner, as that seems to be causing ANRs
This commit is contained in:
Ramii ahmed 2021-01-28 17:22:22 -08:00 committed by Aryan Gupta
parent 39e358f4e3
commit b0daca0e93
6 changed files with 76 additions and 0 deletions

View File

@ -206,6 +206,9 @@ BOARD_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/vendor
# Side FP key for InputDispatcher to skip
TARGET_INPUTDISPATCHER_SKIP_EVENT_KEY := 96
# Side FP key for InputDispatcher to skip
TARGET_INPUTDISPATCHER_SKIP_EVENT_KEY := 96
# Verified Boot
BOARD_AVB_ENABLE := true
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag

View File

@ -230,6 +230,10 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.consumerir.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.consumerir.xml
# KeyHandler
PRODUCT_PACKAGES += \
KeyHandler
# Light
PRODUCT_PACKAGES += \
android.hardware.light@2.0-service.xiaomi_sm6250

21
keyhandler/Android.mk Normal file
View File

@ -0,0 +1,21 @@
#
# Copyright (C) 2021 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := KeyHandler
LOCAL_CERTIFICATE := platform
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
include $(BUILD_PACKAGE)

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2021 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:sharedUserId="android.uid.system"
package="org.lineageos.keyhandler">
</manifest>

View File

@ -0,0 +1,4 @@
# Keep keyhandler constructor
-keep public class * implements com.android.internal.os.DeviceKeyHandler {
public <init>(android.content.Context);
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2021 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.lineageos.keyhandler;
import android.content.Context;
import android.util.Log;
import android.view.KeyEvent;
import com.android.internal.os.DeviceKeyHandler;
public class KeyHandler implements DeviceKeyHandler {
private static final String TAG = "KeyHandler";
private static final int KEYCODE_SIDE_FP = 96;
public KeyHandler(Context context) {
Log.i(TAG, "KeyHandler constructor called");
}
public KeyEvent handleKeyEvent(KeyEvent event) {
int scanCode = event.getScanCode();
Log.i(TAG, "handleKeyEvent=" + scanCode);
switch (scanCode) {
case KEYCODE_SIDE_FP:
return null;
default:
return event;
}
}
}