Compare commits

..

No commits in common. "android-11.0" and "fix-spl" have entirely different histories.

317 changed files with 241 additions and 9707 deletions

2
.gitignore vendored
View File

@ -1,3 +1 @@
.*.swp
treble_*mk
AndroidProducts.mk

4
aex.mk
View File

@ -1,4 +0,0 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
$(call inherit-product, vendor/aosp/common.mk)
TARGET_BOOT_ANIMATION_RES := 1080

View File

@ -1 +0,0 @@
$(call inherit-product, vendor/amy/config/common.mk)

View File

@ -1,17 +0,0 @@
import /system/etc/init/zygote/init.${ro.zygote}.rc
on early-fs
mkdir /mnt/runtime/full 0755 root root
mkdir /mnt/runtime/full/self 0755 root root
mkdir /apex 0777 root root
mount tmpfs tmpfs /apex mode=0755,uid=0,gid=0
restorecon /apex
exec -- /system/bin/apexd --bootstrap
export ANDROID_RUNTIME_ROOT /apex/com.android.runtime
export ANDROID_TZDATA_ROOT /apex/com.android.tzdata
symlink /system/product /product
on fs
exec u:r:su:s0 -- /system/bin/umount -l /product
exec u:r:su:s0 -- /system/bin/rmdir /product
symlink /system/product /product

View File

@ -1,13 +0,0 @@
PRODUCT_COPY_FILES += \
device/phh/treble/apex-setup.rc:system/etc/init/apex-setup.rc \
PRODUCT_COPY_FILES += \
system/core/rootdir/init.zygote32.rc:system/etc/init/zygote/init.zygote32.rc \
system/core/rootdir/init.zygote32_64.rc:system/etc/init/zygote/init.zygote32_64.rc \
system/core/rootdir/init.zygote64_32.rc:system/etc/init/zygote/init.zygote64_32.rc \
system/core/rootdir/init.zygote64.rc:system/etc/init/zygote/init.zygote64.rc \
PRODUCT_COPY_FILES += \
frameworks/av/apex/mediaswcodec.rc:system/etc/init/mediaswcodec-treble.rc \
device/phh/treble/environ/init.treble-environ.rc:system/etc/init/init.treble-environ.rc \

174
base.mk
View File

@ -2,19 +2,16 @@
#TODO: Proper detection
PRODUCT_COPY_FILES := \
frameworks/native/data/etc/android.hardware.fingerprint.xml:system/etc/permissions/android.hardware.fingerprint.xml \
frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml \
frameworks/native/data/etc/android.hardware.telephony.ims.xml:system/etc/permissions/android.hardware.telephony.ims.xml \
frameworks/native/data/etc/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml \
frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml \
frameworks/native/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml \
frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml
#Use a more decent APN config
PRODUCT_COPY_FILES += \
device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml
BOARD_PLAT_PRIVATE_SEPOLICY_DIR += device/phh/treble/sepolicy
PRODUCT_PACKAGE_OVERLAYS += device/phh/treble/overlay
DEVICE_PACKAGE_OVERLAYS += device/phh/treble/overlay
$(call inherit-product, vendor/vndk/vndk.mk)
$(call inherit-product, vendor/hardware_overlay/overlay.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
@ -27,181 +24,28 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
ro.build.version.codename=$(PLATFORM_VERSION_CODENAME) \
ro.build.version.all_codenames=$(PLATFORM_VERSION_ALL_CODENAMES) \
ro.build.version.release=$(PLATFORM_VERSION) \
ro.build.version.security_patch=$(PLATFORM_SECURITY_PATCH) \
ro.adb.secure=0 \
ro.logd.auditd=true
#Huawei HiSuite (also other OEM custom programs I guess) it's of no use in AOSP builds
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
persist.sys.usb.config=adb \
ro.cust.cdrom=/dev/null
ro.adb.secure=0
#VNDK config files
PRODUCT_COPY_FILES += \
device/phh/treble/vndk-detect:system/bin/vndk-detect \
device/phh/treble/vndk.rc:system/etc/init/vndk.rc \
device/phh/treble/ld.config.26.txt:system/etc/ld.config.26.txt \
device/phh/treble/ld.config.27.txt:system/etc/ld.config.27.txt \
#USB Audio
PRODUCT_COPY_FILES += \
frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:system/etc/usb_audio_policy_configuration.xml \
device/phh/treble/files/fake_audio_policy_volume.xml:system/etc/fake_audio_policy_volume.xml \
frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:system/etc/usb_audio_policy_configuration.xml
# NFC:
# Provide default libnfc-nci.conf file for devices that does not have one in
# vendor/etc
PRODUCT_COPY_FILES += \
device/phh/treble/nfc/libnfc-nci.conf:system/phh/libnfc-nci-oreo.conf \
device/phh/treble/nfc/libnfc-nci-huawei.conf:system/phh/libnfc-nci-huawei.conf
# LineageOS build may need this to make NFC work
PRODUCT_PACKAGES += \
NfcNci \
device/phh/treble/nfc/libnfc-nci.conf:system/etc/libnfc-nci.conf
PRODUCT_COPY_FILES += \
device/phh/treble/rw-system.sh:system/bin/rw-system.sh \
device/phh/treble/phh-on-data.sh:system/bin/phh-on-data.sh \
device/phh/treble/phh-prop-handler.sh:system/bin/phh-prop-handler.sh \
device/phh/treble/fixSPL/getSPL.arm:system/bin/getSPL
PRODUCT_COPY_FILES += \
device/phh/treble/empty:system/phh/empty \
device/phh/treble/phh-on-boot.sh:system/bin/phh-on-boot.sh
PRODUCT_PACKAGES += \
treble-environ-rc \
PRODUCT_PACKAGES += \
bootctl \
vintf \
# Fix Offline Charging on Huawmeme
PRODUCT_PACKAGES += \
huawei-charger
PRODUCT_COPY_FILES += \
$(call find-copy-subdir-files,*,device/phh/treble/huawei_charger/files,system/etc/charger)
PRODUCT_COPY_FILES += \
device/phh/treble/twrp/twrp.rc:system/etc/init/twrp.rc \
device/phh/treble/twrp/twrp.sh:system/bin/twrp.sh \
device/phh/treble/twrp/busybox-armv7l:system/bin/busybox_phh
PRODUCT_PACKAGES += \
simg2img_simple \
lptools
ifneq (,$(wildcard external/exfat))
PRODUCT_PACKAGES += \
mkfs.exfat \
fsck.exfat
endif
PRODUCT_PACKAGES += \
android.hidl.manager-V1.0-java \
android.hardware.wifi.hostapd-V1.0-java \
vendor.huawei.hardware.biometrics.fingerprint-V2.1-java \
vendor.huawei.hardware.tp-V1.0-java \
vendor.qti.hardware.radio.am-V1.0-java \
vendor.qti.qcril.am-V1.0-java \
PRODUCT_COPY_FILES += \
device/phh/treble/interfaces.xml:system/etc/permissions/interfaces.xml
PRODUCT_COPY_FILES += \
device/phh/treble/files/samsung-gpio_keys.kl:system/phh/samsung-gpio_keys.kl \
device/phh/treble/files/samsung-sec_touchscreen.kl:system/phh/samsung-sec_touchscreen.kl \
device/phh/treble/files/samsung-sec_touchkey.kl:system/phh/samsung-sec_touchkey.kl \
device/phh/treble/files/oneplus6-synaptics_s3320.kl:system/phh/oneplus6-synaptics_s3320.kl \
device/phh/treble/files/huawei-fingerprint.kl:system/phh/huawei/fingerprint.kl \
device/phh/treble/files/samsung-sec_e-pen.idc:system/usr/idc/sec_e-pen.idc \
device/phh/treble/files/samsung-9810-floating_feature.xml:system/ph/sam-9810-flo_feat.xml \
device/phh/treble/files/mimix3-gpio-keys.kl:system/phh/mimix3-gpio-keys.kl \
device/phh/treble/files/nokia-soc_gpio_keys.kl:system/phh/nokia-soc_gpio_keys.kl \
device/phh/treble/files/lenovo-synaptics_dsx.kl:system/phh/lenovo-synaptics_dsx.kl \
device/phh/treble/files/oppo-touchpanel.kl:system/phh/oppo-touchpanel.kl \
device/phh/treble/files/google-uinput-fpc.kl:system/phh/google-uinput-fpc.kl \
device/phh/treble/files/moto-uinput-egis.kl:system/phh/moto-uinput-egis.kl \
device/phh/treble/files/daisy-buttonJack.kl:system/phh/daisy-buttonJack.kl \
device/phh/treble/files/daisy-uinput-fpc.kl:system/phh/daisy-uinput-fpc.kl \
device/phh/treble/files/daisy-uinput-goodix.kl:system/phh/daisy-uinput-goodix.kl \
device/phh/treble/files/nubia-nubia_synaptics_dsx.kl:system/phh/nubia-nubia_synaptics_dsx.kl \
device/phh/treble/files/unihertz-mtk-kpd.kl:system/phh/unihertz-mtk-kpd.kl \
device/phh/treble/files/unihertz-mtk-tpd.kl:system/phh/unihertz-mtk-tpd.kl \
device/phh/treble/files/unihertz-mtk-tpd-kpd.kl:system/phh/unihertz-mtk-tpd-kpd.kl \
device/phh/treble/files/unihertz-fingerprint_key.kl:system/phh/unihertz-fingerprint_key.kl \
device/phh/treble/files/zf6-goodixfp.kl:system/phh/zf6-goodixfp.kl \
device/phh/treble/files/zf6-googlekey_input.kl:system/phh/zf6-googlekey_input.kl \
device/phh/treble/files/teracube2e-mtk-kpd.kl:system/phh/teracube2e-mtk-kpd.kl \
SELINUX_IGNORE_NEVERALLOWS := true
# Universal NoCutoutOverlay
PRODUCT_PACKAGES += \
NoCutoutOverlay
PRODUCT_PACKAGES += \
lightsctl \
uevent
PRODUCT_COPY_FILES += \
device/phh/treble/files/adbd.rc:system/etc/init/adbd.rc
#MTK incoming SMS fix
PRODUCT_PACKAGES += \
mtk-sms-fwk-ready
# Helper to debug Xiaomi motorized camera
PRODUCT_PACKAGES += \
xiaomi-motor \
oneplus-motor
PRODUCT_PACKAGES += \
Stk
PRODUCT_PACKAGES += \
resetprop_phh
PRODUCT_COPY_FILES += \
device/phh/treble/phh-securize.sh:system/bin/phh-securize.sh \
device/phh/treble/files/ota.sh:system/bin/ota.sh \
PRODUCT_COPY_FILES += \
device/phh/treble/remove-telephony.sh:system/bin/remove-telephony.sh \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.secure_lock_screen.xml:system/etc/permissions/android.software.secure_lock_screen.xml \
device/phh/treble/files/android.software.controls.xml:system/etc/permissions/android.software.controls.xml \
PRODUCT_COPY_FILES += \
device/phh/treble/ld.config.26.txt:system/etc/ld.config.26.txt \
PRODUCT_PACKAGES += \
asus-motor
# Privapp-permissions whitelist for PhhTrebleApp
PRODUCT_COPY_FILES += \
device/phh/treble/privapp-permissions-me.phh.treble.app.xml:system/etc/permissions/privapp-permissions-me.phh.treble.app.xml
# Remote debugging
PRODUCT_COPY_FILES += \
device/phh/treble/remote/dbclient:system/bin/dbclient \
device/phh/treble/remote/phh-remotectl.rc:system/etc/init/phh-remotectl.rc \
device/phh/treble/remote/phh-remotectl.sh:system/bin/phh-remotectl.sh \
PRODUCT_PACKAGES += \
android.hardware.biometrics.fingerprint@2.1-service.oppo.compat \
android.hardware.biometrics.fingerprint@2.1-service.oplus.compat \
PRODUCT_PACKAGES += \
vr_hwc \
curl \
healthd \
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
debug.fdsan=warn_once \
# AOSP overlays
PRODUCT_PACKAGES += \
NavigationBarMode2ButtonOverlay
PRODUCT_PACKAGES += \
oplus-alert-slider
treble-environ-rc

View File

@ -21,12 +21,11 @@
#ifndef _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H
//#include <cutils/properties.h>
#include <cutils/properties.h>
#include <string.h>
static inline const char* BtmDefLocalName()
{
#if 0
static char product_device[PROPERTY_VALUE_MAX];
//Huawei-defined property
property_get("ro.config.marketing_name", product_device, "");
@ -36,16 +35,11 @@ static inline const char* BtmDefLocalName()
// Fallback to ro.product.model
return "";
#endif
return "hello";
}
static inline int BtmBypassExtraAclSetup() {
#if 0
static inline bool BtmBypassExtraAclSetup() {
int8_t prop = property_get_bool("persist.sys.bt_acl_bypass", false);
return prop == true;
#endif
return 1;
}
#define BTM_DEF_LOCAL_NAME BtmDefLocalName()

View File

@ -1,6 +1,3 @@
TARGET_SYSTEM_PROP := device/phh/treble/system.prop $(TARGET_SYSTEM_PROP)
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/phh/treble/bluetooth
TARGET_EXFAT_DRIVER := exfat
DEVICE_FRAMEWORK_MANIFEST_FILE := device/phh/treble/framework_manifest.xml
BOARD_ROOT_EXTRA_FOLDERS += bt_firmware sec_storage efs

View File

@ -1,265 +0,0 @@
cc_binary {
name: "lightsctl",
srcs: [
"lightsctl.cpp",
],
shared_libs: [
"android.hardware.light@2.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "op-fp",
srcs: [
"op-fp.cpp",
],
shared_libs: [
"vendor.oneplus.fingerprint.extension@1.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "uevent",
srcs: [
"uevent.cpp",
],
}
cc_binary {
name: "simg2img_simple",
srcs: [
"simg2img_simple.cpp",
],
host_supported: true,
}
cc_binary {
name: "vibrator-lge",
srcs: [
"vibrator-lge.cpp",
],
shared_libs: [
"vendor.lge.hardware.vibrator@1.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "mtk-sms-fwk-ready",
srcs: [
"mtk-sms-fwk-ready.cpp",
],
shared_libs: [
"vendor.mediatek.hardware.radio@2.6",
"libutils",
"libhidlbase",
],
init_rc: [
"mtk-sms-fwk-ready.rc"
],
}
cc_binary {
name: "xiaomi-display-feature",
srcs: [
"xiaomi-display-feature.cpp",
],
shared_libs: [
"vendor.xiaomi.hardware.displayfeature@1.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "xiaomi-fp",
srcs: [
"xiaomi-fp.cpp",
],
shared_libs: [
"vendor.xiaomi.hardware.fingerprintextension@1.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "lightsctl-sec",
srcs: [
"lightsctl-sec.cpp",
],
shared_libs: [
"vendor.samsung.hardware.light@2.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "lightsctl-seh",
srcs: [
"lightsctl-seh.cpp",
],
shared_libs: [
"vendor.samsung.hardware.light@3.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "xiaomi-motor",
srcs: [
"xiaomi-motor.cpp",
],
shared_libs: [
"vendor.xiaomi.hardware.motor@1.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "oneplus-motor",
srcs: [
"oneplus-motor.cpp",
],
shared_libs: [
"vendor.oneplus.hardware.motorcontrol@1.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "persistprops",
srcs: [
"persistent_properties.proto",
"persistprops.cpp",
],
static_executable: true,
proto: {
type: "lite",
static: true,
},
static_libs: [
"libprotobuf-cpp-lite"
],
}
cc_binary {
name: "lightsctl-huawei",
srcs: [
"lightsctl-huawei.cpp",
],
shared_libs: [
"vendor.huawei.hardware.light@2.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "asus-motor",
srcs: [
"asus-motor.cpp",
],
}
cc_binary {
name: "goodix-fp",
srcs: [
"goodix-fp.cpp",
],
shared_libs: [
"vendor.goodix.extend.service@2.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "lptools",
cflags: [
"-Werror",
"-Wextra",
],
device_supported: true,
shared_libs: [
"libbase",
"liblog",
"liblp",
"libsparse",
"libfs_mgr",
"libutils",
"libcutils",
"android.hardware.boot@1.1",
"libhidlbase",
],
static_libs: [
"libdm",
],
srcs: [
"lptools.cc",
],
cppflags: [
"-D_FILE_OFFSET_BITS=64",
],
}
cc_binary {
name: "lptools_static",
cflags: [
"-Werror",
"-Wextra",
"-DLPTOOLS_STATIC",
],
device_supported: true,
shared_libs: [
"libcrypto",
],
static_libs: [
"libbase",
"liblog",
"liblp",
"libsparse",
"libfs_mgr",
"libutils",
"libcutils",
"libdm",
"libext4_utils",
],
srcs: [
"lptools.cc",
],
cppflags: [
"-D_FILE_OFFSET_BITS=64",
],
}
cc_binary {
name: "sec-camera-list",
srcs: [
"sec-camera-list.cpp",
],
shared_libs: [
"vendor.samsung.hardware.camera.provider@3.0",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "oplus-alert-slider",
srcs: [
"oplus-alert-slider.cpp",
],
init_rc: [
"oplus-alert-slider.rc",
],
}

View File

@ -1,30 +0,0 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
typedef struct {
int dir;
int angle;
int speed;
} motorDrvManualConfig_t;
#define ASUS_MOTOR_NAME_SIZE 32
#define ASUS_MOTOR_DATA_SIZE 4
#define ASUS_MOTOR_DRV_DEV_PATH ("/dev/asusMotoDrv")
#define ASUS_MOTOR_DRV_IOC_MAGIC ('M')
#define ASUS_MOTOR_DRV_AUTO_MODE _IOW(ASUS_MOTOR_DRV_IOC_MAGIC, 1, int)
#define ASUS_MOTOR_DRV_MANUAL_MODE _IOW(ASUS_MOTOR_DRV_IOC_MAGIC, 2, motorDrvManualConfig_t)
int main(int argc, char **argv) {
if(argc != 2) return 1;
int fd = open("/dev/asusMotoDrv", O_RDWR);
motorDrvManualConfig_t cfg;
cfg.dir = atoi(argv[1]);
cfg.angle = 180;
cfg.speed = 4;
ioctl(fd, ASUS_MOTOR_DRV_MANUAL_MODE, &cfg);
}

View File

@ -1,17 +0,0 @@
#include <iostream>
#include <vendor/goodix/extend/service/2.0/IGoodixFPExtendService.h>
using ::vendor::goodix::extend::service::V2_0::IGoodixFPExtendService;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IGoodixFPExtendService::getService();
if(argc!=3) return 1;
int a = atoi(argv[1]);
int b = atoi(argv[2]);
auto ret = svc->goodixExtendCommand(a, b);
if(!ret.isOk()) {
std::cerr << "HWBinder call failed" << std::endl;
}
std::cout << "updateStatus returned " << toString(ret) << std::endl;
}

View File

@ -1,38 +0,0 @@
#include <iostream>
#include <vendor/huawei/hardware/light/2.0/ILight.h>
#include <android/hardware/light/2.0/types.h>
using ::vendor::huawei::hardware::light::V2_0::ILight;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = ILight::getService();
svc->HWgetSupportedTypes([](auto types) {
for(const auto& type: types) {
std::cout << "Got type " << type << std::endl;
}
});
uint32_t a = (uint32_t)strtoll(argv[1], NULL, 10);
android::hardware::light::V2_0::LightState state;
state.color = (uint32_t)strtoll(argv[2], NULL, 16);
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
state.brightnessMode = android::hardware::light::V2_0::Brightness::USER;
if(argc == 6) {
std::string flashArg(argv[3]);
if(flashArg == "NONE")
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
if(flashArg == "TIMED")
state.flashMode = android::hardware::light::V2_0::Flash::TIMED;
if(flashArg == "HARDWARE")
state.flashMode = android::hardware::light::V2_0::Flash::HARDWARE;
state.flashOnMs = atoi(argv[4]);
state.flashOffMs = atoi(argv[5]);
}
std::cout << "Set flash type to " << toString(state.flashMode) << std::endl;
svc->HWsetLight(a, state);
}

View File

@ -1,59 +0,0 @@
#include <iostream>
#include <vendor/samsung/hardware/light/2.0/ISecLight.h>
#include <vendor/samsung/hardware/light/2.0/types.h>
using ::vendor::samsung::hardware::light::V2_0::ISecLight;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = ISecLight::getService();
svc->getSupportedTypes([](auto types) {
for(const auto& type: types) {
std::cout << "Got type " << toString(type) << std::endl;
}
});
if(argc <= 1) return 0;
if(argc != 3 && argc != 6) return 1;
std::string typeArg(argv[1]);
vendor::samsung::hardware::light::V2_0::SecType type;
if(typeArg == "BACKLIGHT")
type = vendor::samsung::hardware::light::V2_0::SecType::BACKLIGHT;
if(typeArg == "KEYBOARD")
type = vendor::samsung::hardware::light::V2_0::SecType::KEYBOARD;
if(typeArg == "BUTTONS")
type = vendor::samsung::hardware::light::V2_0::SecType::BUTTONS;
if(typeArg == "BATTERY")
type = vendor::samsung::hardware::light::V2_0::SecType::BATTERY;
if(typeArg == "NOTIFICATIONS")
type = vendor::samsung::hardware::light::V2_0::SecType::NOTIFICATIONS;
if(typeArg == "ATTENTION")
type = vendor::samsung::hardware::light::V2_0::SecType::ATTENTION;
if(typeArg == "BLUETOOTH")
type = vendor::samsung::hardware::light::V2_0::SecType::BLUETOOTH;
if(typeArg == "WIFI")
type = vendor::samsung::hardware::light::V2_0::SecType::WIFI;
std::cout << "Set request type " << toString(type) << std::endl;
android::hardware::light::V2_0::LightState state;
state.color = (uint32_t)strtoll(argv[2], NULL, 16);
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
state.brightnessMode = android::hardware::light::V2_0::Brightness::USER;
if(argc == 6) {
std::string flashArg(argv[3]);
if(flashArg == "NONE")
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
if(flashArg == "TIMED")
state.flashMode = android::hardware::light::V2_0::Flash::TIMED;
if(flashArg == "HARDWARE")
state.flashMode = android::hardware::light::V2_0::Flash::HARDWARE;
state.flashOnMs = atoi(argv[4]);
state.flashOffMs = atoi(argv[5]);
}
std::cout << "Set flash type to " << toString(state.flashMode) << std::endl;
auto ret = svc->setLightSec(type, state);
std::cout << "Set light returned " << toString(ret) << std::endl;
}

View File

@ -1,62 +0,0 @@
#include <iostream>
#include <vendor/samsung/hardware/light/3.0/ISehLight.h>
#include <vendor/samsung/hardware/light/3.0/types.h>
using ::vendor::samsung::hardware::light::V3_0::ISehLight;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = ISehLight::getService();
svc->getSupportedTypes([](auto types) {
for(const auto& type: types) {
std::cout << "Got type " << toString(type) << std::endl;
}
});
if(argc <= 1) return 0;
if(argc != 4 && argc != 7) return 1;
std::string typeArg(argv[1]);
vendor::samsung::hardware::light::V3_0::SehType type;
if(typeArg == "BACKLIGHT")
type = vendor::samsung::hardware::light::V3_0::SehType::BACKLIGHT;
if(typeArg == "KEYBOARD")
type = vendor::samsung::hardware::light::V3_0::SehType::KEYBOARD;
if(typeArg == "BUTTONS")
type = vendor::samsung::hardware::light::V3_0::SehType::BUTTONS;
if(typeArg == "BATTERY")
type = vendor::samsung::hardware::light::V3_0::SehType::BATTERY;
if(typeArg == "NOTIFICATIONS")
type = vendor::samsung::hardware::light::V3_0::SehType::NOTIFICATIONS;
if(typeArg == "ATTENTION")
type = vendor::samsung::hardware::light::V3_0::SehType::ATTENTION;
if(typeArg == "BLUETOOTH")
type = vendor::samsung::hardware::light::V3_0::SehType::BLUETOOTH;
if(typeArg == "WIFI")
type = vendor::samsung::hardware::light::V3_0::SehType::WIFI;
if(typeArg == "SUB_BACKLIGHT")
type = vendor::samsung::hardware::light::V3_0::SehType::SUB_BACKLIGHT;
std::cout << "Set request type " << toString(type) << std::endl;
vendor::samsung::hardware::light::V3_0::SehLightState state;
state.color = (uint32_t)strtoll(argv[2], NULL, 16);
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
state.brightnessMode = android::hardware::light::V2_0::Brightness::USER;
state.extendedBrightness = (uint32_t)strtoll(argv[3], NULL, 0);
if(argc == 7) {
std::string flashArg(argv[4]);
if(flashArg == "NONE")
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
if(flashArg == "TIMED")
state.flashMode = android::hardware::light::V2_0::Flash::TIMED;
if(flashArg == "HARDWARE")
state.flashMode = android::hardware::light::V2_0::Flash::HARDWARE;
state.flashOnMs = atoi(argv[5]);
state.flashOffMs = atoi(argv[6]);
}
std::cout << "Set flash type to " << toString(state.flashMode) << std::endl;
auto ret = svc->sehSetLight(type, state);
std::cout << "Set light returned " << toString(ret) << std::endl;
}

View File

@ -1,59 +0,0 @@
#include <iostream>
#include <android/hardware/light/2.0/ILight.h>
#include <android/hardware/light/2.0/types.h>
using ::android::hardware::light::V2_0::ILight;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = ILight::getService();
svc->getSupportedTypes([](auto types) {
for(const auto& type: types) {
std::cout << "Got type " << toString(type) << std::endl;
}
});
if(argc <= 1) return 0;
if(argc != 3 && argc != 6) return 1;
std::string typeArg(argv[1]);
android::hardware::light::V2_0::Type type;
if(typeArg == "BACKLIGHT")
type = android::hardware::light::V2_0::Type::BACKLIGHT;
if(typeArg == "KEYBOARD")
type = android::hardware::light::V2_0::Type::KEYBOARD;
if(typeArg == "BUTTONS")
type = android::hardware::light::V2_0::Type::BUTTONS;
if(typeArg == "BATTERY")
type = android::hardware::light::V2_0::Type::BATTERY;
if(typeArg == "NOTIFICATIONS")
type = android::hardware::light::V2_0::Type::NOTIFICATIONS;
if(typeArg == "ATTENTION")
type = android::hardware::light::V2_0::Type::ATTENTION;
if(typeArg == "BLUETOOTH")
type = android::hardware::light::V2_0::Type::BLUETOOTH;
if(typeArg == "WIFI")
type = android::hardware::light::V2_0::Type::WIFI;
std::cout << "Set request type " << toString(type) << std::endl;
android::hardware::light::V2_0::LightState state;
state.color = (uint32_t)strtoll(argv[2], NULL, 16);
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
state.brightnessMode = android::hardware::light::V2_0::Brightness::USER;
if(argc == 6) {
std::string flashArg(argv[3]);
if(flashArg == "NONE")
state.flashMode = android::hardware::light::V2_0::Flash::NONE;
if(flashArg == "TIMED")
state.flashMode = android::hardware::light::V2_0::Flash::TIMED;
if(flashArg == "HARDWARE")
state.flashMode = android::hardware::light::V2_0::Flash::HARDWARE;
state.flashOnMs = atoi(argv[4]);
state.flashOffMs = atoi(argv[5]);
}
std::cout << "Set flash type to " << toString(state.flashMode) << std::endl;
auto ret = svc->setLight(type, state);
std::cout << "Set light returned " << toString(ret) << std::endl;
}

View File

@ -1,309 +0,0 @@
/*
* Copyright (C) 2018 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.
*/
#include <getopt.h>
#include <inttypes.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/types.h>
#include <sysexits.h>
#include <unistd.h>
#include <iostream>
#include <optional>
#include <regex>
#include <string>
#include <vector>
#include <chrono>
#include <android-base/parseint.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <cutils/android_get_control_file.h>
#include <fs_mgr.h>
#include <liblp/builder.h>
#include <liblp/liblp.h>
#include <fs_mgr_dm_linear.h>
#include <libdm/dm.h>
#ifndef LPTOOLS_STATIC
#include <android/hardware/boot/1.1/IBootControl.h>
#include <android/hardware/boot/1.1/types.h>
#endif
using namespace android;
using namespace android::fs_mgr;
class FileOrBlockDeviceOpener final : public PartitionOpener {
public:
android::base::unique_fd Open(const std::string& path, int flags) const override {
// Try a local file first.
android::base::unique_fd fd;
#ifdef __ANDROID__
fd.reset(android_get_control_file(path.c_str()));
if (fd >= 0) return fd;
#endif
fd.reset(open(path.c_str(), flags));
if (fd >= 0) return fd;
return PartitionOpener::Open(path, flags);
}
};
static FileOrBlockDeviceOpener opener;
std::unique_ptr<MetadataBuilder> makeBuilder() {
auto builder = MetadataBuilder::New(opener, "super", 0);
if(builder == nullptr) {
std::cout << "Failed creating super builder" << std::endl;
}
return builder;
}
void saveToDisk(std::unique_ptr<MetadataBuilder> builder) {
auto newMetadata = builder->Export();
int nSlots = 2;//pt->geometry.metadata_slot_count;
for(int slot=0; slot < nSlots; slot++) {
std::cout << "Saving the updated partition table " << UpdatePartitionTable(opener, "super", *newMetadata, slot) << " for slot " << slot << std::endl;
}
}
inline bool ends_with(std::string const & value, std::string const & ending)
{
if (ending.size() > value.size()) return false;
return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
}
std::string findGroup(std::unique_ptr<MetadataBuilder>& builder) {
auto groups = builder->ListGroups();
auto partitionName = "system" + ::android::base::GetProperty("ro.boot.slot_suffix", "");
for(auto groupName: groups) {
auto partitions = builder->ListPartitionsInGroup(groupName);
for (const auto& partition : partitions) {
if(partition->name() == partitionName) {
return groupName;
}
}
}
std::string maxGroup = "";
uint64_t maxGroupSize = 0;
for(auto groupName: groups) {
auto group = builder->FindGroup(groupName);
if(group->maximum_size() > maxGroupSize) {
maxGroup = groupName;
maxGroupSize = group->maximum_size();
}
}
return maxGroup;
}
int main(int argc, char **argv) {
if(argc<=1) {
std::cerr << "Usage: " << argv[0] << " <create|remove|resize|rename>" << std::endl;
exit(1);
}
auto builder = makeBuilder();
auto group = findGroup(builder);
std::cout << "Best group seems to be " << group << std::endl;
if(strcmp(argv[1], "create") == 0) {
if(argc != 4) {
std::cerr << "Usage: " << argv[0] << " create <partition name> <partition size>" << std::endl;
exit(1);
}
auto partName = argv[2];
auto size = strtoll(argv[3], NULL, 0);
auto partition = builder->FindPartition(partName);
if(partition != nullptr) {
std::cerr << "Partition " << partName << " already exists." << std::endl;
exit(1);
}
partition = builder->AddPartition(partName, group, 0);
auto result = builder->ResizePartition(partition, size);
std::cout << "Growing partition " << result << std::endl;
if(!result) return 1;
saveToDisk(std::move(builder));
std::string dmPath;
CreateLogicalPartitionParams params {
.block_device = "/dev/block/by-name/super",
.metadata_slot = 0,
.partition_name = partName,
.timeout_ms = std::chrono::milliseconds(10000),
.force_writable = true,
};
auto dmCreateRes = android::fs_mgr::CreateLogicalPartition(params, &dmPath);
std::cout << "Creating dm partition for " << partName << " answered " << dmCreateRes << " at " << dmPath << std::endl;
exit(0);
} else if(strcmp(argv[1], "remove") == 0) {
if(argc != 3) {
std::cerr << "Usage: " << argv[0] << " remove <partition name>" << std::endl;
exit(1);
}
auto partName = argv[2];
auto dmState = android::dm::DeviceMapper::Instance().GetState(partName);
if(dmState == android::dm::DmDeviceState::ACTIVE) {
android::fs_mgr::DestroyLogicalPartition(partName);
}
builder->RemovePartition(partName);
saveToDisk(std::move(builder));
exit(0);
} else if(strcmp(argv[1], "resize") == 0) {
if(argc != 4) {
std::cerr << "Usage: " << argv[0] << " resize <partition name> <newsize>" << std::endl;
exit(1);
}
auto partName = argv[2];
auto size = strtoll(argv[3], NULL, 0);
auto partition = builder->FindPartition(partName);
std::cout << "Resizing partition " << builder->ResizePartition(partition, size) << std::endl;
saveToDisk(std::move(builder));
exit(0);
} else if(strcmp(argv[1], "replace") == 0) {
if(argc != 4) {
std::cerr << "Usage: " << argv[0] << " replace <original partition name> <new partition name>" << std::endl;
std::cerr << "This will delete <new partition name> and rename <original partition name> to <new partition name>" << std::endl;
exit(1);
}
auto src = argv[2];
auto dst = argv[3];
auto srcPartition = builder->FindPartition(src);
if(srcPartition == nullptr) {
srcPartition = builder->FindPartition(src + ::android::base::GetProperty("ro.boot.slot_suffix", ""));
}
auto dstPartition = builder->FindPartition(dst);
if(dstPartition == nullptr) {
dstPartition = builder->FindPartition(dst + ::android::base::GetProperty("ro.boot.slot_suffix", ""));
}
std::string dstPartitionName = dst;
if(dstPartition != nullptr) {
dstPartitionName = dstPartition->name();
}
std::vector<std::unique_ptr<Extent>> originalExtents;
const auto& extents = srcPartition->extents();
for(unsigned i=0; i<extents.size(); i++) {
const auto& extend = extents[i];
auto linear = extend->AsLinearExtent();
if(linear != nullptr) {
auto copyLinear = std::make_unique<LinearExtent>(linear->num_sectors(), linear->device_index(), linear->physical_sector());
originalExtents.push_back(std::move(copyLinear));
} else {
auto copyZero = std::make_unique<ZeroExtent>(extend->num_sectors());
originalExtents.push_back(std::move(copyZero));
}
}
builder->RemovePartition(srcPartition->name());
builder->RemovePartition(dstPartitionName);
auto newDstPartition = builder->AddPartition(dstPartitionName, group, 0);
for(auto&& extent: originalExtents) {
newDstPartition->AddExtent(std::move(extent));
}
saveToDisk(std::move(builder));
exit(0);
} else if(strcmp(argv[1], "map") == 0) {
if(argc != 3) {
std::cerr << "Usage: " << argv[0] << " map <partition name>" << std::endl;
exit(1);
}
auto partName = argv[2];
std::string dmPath;
CreateLogicalPartitionParams params {
.block_device = "/dev/block/by-name/super",
.metadata_slot = 0,
.partition_name = partName,
.timeout_ms = std::chrono::milliseconds(10000),
.force_writable = true,
};
auto dmCreateRes = android::fs_mgr::CreateLogicalPartition(params, &dmPath);
std::cout << "Creating dm partition for " << partName << " answered " << dmCreateRes << " at " << dmPath << std::endl;
exit(0);
} else if(strcmp(argv[1], "unmap") == 0) {
if(argc != 3) {
std::cerr << "Usage: " << argv[0] << " unmap <partition name>" << std::endl;
exit(1);
}
auto partName = argv[2];
auto dmState = android::dm::DeviceMapper::Instance().GetState(partName);
if(dmState == android::dm::DmDeviceState::ACTIVE) {
android::fs_mgr::DestroyLogicalPartition(partName);
}
exit(0);
} else if(strcmp(argv[1], "free") == 0) {
if(argc != 2) {
std::cerr << "Usage: " << argv[0] << " free" << std::endl;
exit(1);
}
auto groupO = builder->FindGroup(group);
uint64_t maxSize = groupO->maximum_size();
uint64_t total = 0;
auto partitions = builder->ListPartitionsInGroup(group);
for (const auto& partition : partitions) {
total += partition->BytesOnDisk();
}
uint64_t groupAllocatable = maxSize - total;
uint64_t superFreeSpace = builder->AllocatableSpace() - builder->UsedSpace();
if(groupAllocatable > superFreeSpace || maxSize == 0)
groupAllocatable = superFreeSpace;
printf("Free space: %" PRIu64 "\n", groupAllocatable);
exit(0);
} else if(strcmp(argv[1], "unlimited-group") == 0) {
builder->ChangeGroupSize(group, 0);
saveToDisk(std::move(builder));
return 0;
} else if(strcmp(argv[1], "clear-cow") == 0) {
#ifndef LPTOOLS_STATIC
// Ensure this is a V AB device, and that no merging is taking place (merging? in gsi? uh)
auto svc1_1 = ::android::hardware::boot::V1_1::IBootControl::tryGetService();
if(svc1_1 == nullptr) {
std::cerr << "Couldn't get a bootcontrol HAL. You can clear cow only on V AB devices" << std::endl;
return 1;
}
auto mergeStatus = svc1_1->getSnapshotMergeStatus();
if(mergeStatus != ::android::hardware::boot::V1_1::MergeStatus::NONE) {
std::cerr << "Merge status is NOT none, meaning a merge is pending. Clearing COW isn't safe" << std::endl;
return 1;
}
#endif
uint64_t superFreeSpace = builder->AllocatableSpace() - builder->UsedSpace();
std::cerr << "Super allocatable " << superFreeSpace << std::endl;
uint64_t total = 0;
auto partitions = builder->ListPartitionsInGroup("cow");
for (const auto& partition : partitions) {
std::cout << "Deleting partition? " << partition->name() << std::endl;
if(ends_with(partition->name(), "-cow")) {
std::cout << "Deleting partition " << partition->name() << std::endl;
builder->RemovePartition(partition->name());
}
}
saveToDisk(std::move(builder));
return 0;
}
return 0;
}

View File

@ -1,12 +0,0 @@
#include <iostream>
#include <unistd.h>
#include <vendor/mediatek/hardware/radio/2.6/IRadio.h>
using ::vendor::mediatek::hardware::radio::V2_6::IRadio;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IRadio::getService(argv[1]);
if(svc != nullptr)
svc->setSmsFwkReady(1);
}

View File

@ -1,3 +0,0 @@
on property:sys.boot_completed=1
exec u:r:phhsu_daemon:s0 root -- /system/bin/mtk-sms-fwk-ready slot1
exec u:r:phhsu_daemon:s0 root -- /system/bin/mtk-sms-fwk-ready slot2

View File

@ -1,32 +0,0 @@
#include <iostream>
#include <unistd.h>
#include <vendor/oneplus/hardware/motorcontrol/1.0/IOPMotorControl.h>
using ::vendor::oneplus::hardware::motorcontrol::V1_0::IOPMotorControl;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IOPMotorControl::getService();
if(svc == nullptr) {
std::cerr << "Failed getting IMotor" << std::endl;
return -1;
}
if(argc<2) {
std::cerr << "Usage: " << argv[0] << " <read|down|up>" << std::endl;
return -1;
}
std::string cmd(argv[1]);
if(cmd == "read") {
int ret = svc->readMotorData(1, 16);
std::cout << "Read motor data 1/16 returned " << ret << std::endl;
return 0;
} else if(cmd == "down") {
int ret = svc->writeMotorData(1, 0, 1);
std::cout << "Down motor control data 1/0/1 returned " << ret << std::endl;
return 0;
} else if(cmd == "up") {
int ret = svc->writeMotorData(1, 1, 1);
std::cout << "Down motor control data 1/1/1 returned " << ret << std::endl;
return 0;
}
}

View File

@ -1,16 +0,0 @@
#include <iostream>
#include <vendor/oneplus/fingerprint/extension/1.0/IVendorFingerprintExtensions.h>
using ::vendor::oneplus::fingerprint::extension::V1_0::IVendorFingerprintExtensions;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IVendorFingerprintExtensions::getService();
if(argc!=2) return 1;
int v = atoi(argv[0]);
auto ret = svc->updateStatus(v);
if(!ret.isOk()) {
std::cerr << "HWBinder call failed" << std::endl;
}
std::cout << "updateStatus returned " << ret << std::endl;
}

View File

@ -1,54 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <linux/input.h>
int read_tristate() {
int fd = open("/proc/tristatekey/tri_state", O_RDONLY);
char p[16];
int ret = read(fd, p, sizeof(p) - 1);
p[ret] = 0;
return atoi(p);
}
int main() {
int fd = -1;
for(int i=0; i<255; i++) {
char path[256];
snprintf(path, 256, "/dev/input/event%d", i);
fd = open(path, O_RDWR);
if(fd == -1) continue;
char name[256];
ioctl(fd, EVIOCGNAME(256), name);
printf("Got input name %s\n", name);
if(strcmp(name, "oplus,hall_tri_state_key") == 0) {
break;
}
close(fd);
fd = -1;
}
if(fd == -1) return 0;
ioctl(fd, EVIOCGRAB, 1);
struct input_event ev;
while(read(fd, &ev, sizeof(ev)) != 0) {
if(!(ev.code == 61 && ev.value == 0)) continue;
int state = read_tristate();
if(state == 1) {
}
printf("State %d\n", read_tristate());
if(state == 1) {
system("service call audio 31 i32 2 s16 android");
} else if(state == 2) {
system("service call audio 31 i32 1 s16 android");
} else if(state == 3) {
system("service call audio 31 i32 0 s16 android");
}
}
}

View File

@ -1,4 +0,0 @@
service phhoplus-alert-slider /system/bin/oplus-alert-slider
seclabel u:r:phhsu_daemon:s0
oneshot
class main

View File

@ -1,27 +0,0 @@
/*
* Copyright (C) 2017 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.
*/
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
message PersistentProperties {
message PersistentPropertyRecord {
optional string name = 1;
optional string value = 2;
}
repeated PersistentPropertyRecord properties = 1;
}

View File

@ -1,55 +0,0 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "device/phh/treble/cmds/persistent_properties.pb.h"
#include <algorithm>
#include <iostream>
int main(int argc, char **argv) {
int fd = open("persistent_properties", O_RDWR);
off_t size = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
char *data = (char*) malloc(size);
int ret = read(fd, data, size);
PersistentProperties props;
bool parsed = props.ParseFromArray(data, size);
std::cout << "Currently has " << props.properties_size() << " props." << std::endl;
for(auto prop: props.properties()) {
std::cout << prop.name() << ":" << prop.value() << std::endl;
}
if(argc == 1) {
close(fd);
return 0;
}
if(argc != 3) {
std::cout << "Usage: " << argv[0] << " [prop value]" << std::endl;
return -1;
}
std::string property(argv[1]);
std::string value(argv[2]);
auto p = props.mutable_properties();
auto it = std::find_if(p->begin(), p->end(), [=](const auto& v) { return v.name() == property; });
if(it == p->end()) {
std::cout << "Property not found, adding it" << std::endl;
auto *record = p->Add();;
record->set_name(property);
record->set_value(value);
} else {
std::cout << "Property found, replacing it" << std::endl;
it->set_value(value);
}
size_t write_size = props.ByteSize();
char *write_buffer = (char*) malloc(write_size);
props.SerializeToArray(write_buffer, write_size);
ftruncate(fd, 0);
lseek(fd, 0, SEEK_SET);
write(fd, write_buffer, write_size);
close(fd);
}

View File

@ -1,15 +0,0 @@
#include <iostream>
#include <vendor/samsung/hardware/camera/provider/3.0/ISehCameraProvider.h>
using ::vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = ISehCameraProvider::getService("legacy/0");
auto cb = [](::android::hardware::camera::common::V1_0::Status status, ::android::hardware::hidl_vec<::android::hardware::hidl_string> ids) {
for(auto id: ids) {
std::cerr << "id = " << id << std::endl;
}
};
svc->sehGetCameraIdList(cb);
}

View File

@ -1,111 +0,0 @@
#define _GNU_SOURCE
#include <fcntl.h>
#include <unistd.h>
#include <sys/sendfile.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct sparse_header {
uint32_t magic; /* 0xed26ff3a */
uint16_t major_version; /* (0x1) - reject images with higher major versions */
uint16_t minor_version; /* (0x0) - allow images with higer minor versions */
uint16_t file_hdr_sz; /* 28 bytes for first revision of the file format */
uint16_t chunk_hdr_sz; /* 12 bytes for first revision of the file format */
uint32_t blk_sz; /* block size in bytes, must be a multiple of 4 (4096) */
uint32_t total_blks; /* total blocks in the non-sparse output image */
uint32_t total_chunks; /* total chunks in the sparse input image */
uint32_t image_checksum; /* CRC32 checksum of the original data, counting "don't care" */
/* as 0. Standard 802.3 polynomial, use a Public Domain */
/* table implementation */
} sparse_header_t;
#define SPARSE_HEADER_MAGIC 0xed26ff3a
#define CHUNK_TYPE_RAW 0xCAC1
#define CHUNK_TYPE_FILL 0xCAC2
#define CHUNK_TYPE_DONT_CARE 0xCAC3
#define CHUNK_TYPE_CRC32 0xCAC4
typedef struct chunk_header {
uint16_t chunk_type; /* 0xCAC1 -> raw; 0xCAC2 -> fill; 0xCAC3 -> don't care */
uint16_t reserved1;
uint32_t chunk_sz; /* in blocks in output image */
uint32_t total_sz; /* in bytes of chunk input file including chunk header and data */
} chunk_header_t;
/* Following a Raw or Fill or CRC32 chunk is data.
* For a Raw chunk, it's the data in chunk_sz * blk_sz.
* For a Fill chunk, it's 4 bytes of the fill data.
* For a CRC32 chunk, it's 4 bytes of CRC32
*/
static int disable_splice = 0;
void nsendfile(int out_fd, int in_fd, size_t count) {
char buf[1024*1024];
while(count) {
ssize_t res = -1;
if(!disable_splice) {
res = splice(in_fd, NULL, out_fd, NULL, count, 0);
}
if(count > 16*1024 && res < 1024)
disable_splice = 1;
if(res==-1) {
ssize_t sizeToRead = sizeof(buf);
if(count < sizeToRead) sizeToRead = count;
res = read(in_fd, buf, sizeToRead);
if(write(out_fd, buf, res) != res) exit(114);
}
if(res == 0 || res == -1) exit(112);
count -= res;
}
}
int main() {
sparse_header_t hdr;
if(read(0, &hdr, sizeof(hdr)) != sizeof(hdr)) exit(1);
if(hdr.magic != SPARSE_HEADER_MAGIC) exit(2);
if(hdr.blk_sz != 4096) exit(6);
if(hdr.major_version != 1) exit(11);
if(hdr.minor_version != 0) exit(12);
if(hdr.file_hdr_sz != 28) exit(13);
if(hdr.chunk_hdr_sz != 12) exit(14);
char block[4096];
for(unsigned i=0; i<hdr.total_chunks; i++) {
chunk_header_t chunk;
if(read(0, &chunk, sizeof(chunk)) != sizeof(chunk)) exit(3);
if(chunk.chunk_type == CHUNK_TYPE_RAW) {
if(chunk.total_sz != sizeof(chunk_header_t) + (chunk.chunk_sz * hdr.blk_sz)) exit(7);
nsendfile(1, 0, hdr.blk_sz * chunk.chunk_sz);
} else if(chunk.chunk_type == CHUNK_TYPE_FILL) {
if(chunk.total_sz != 4 + sizeof(chunk_header_t)) exit(7);
uint32_t fill;
if(read(0, &fill, sizeof(fill)) != sizeof(fill)) exit(5);
//memset takes a char, not a int32, hence the check
if(fill != 0) exit(6);
memset(block, fill, hdr.blk_sz);
for(unsigned i=0; i<chunk.chunk_sz; i++)
if(write(1, block, hdr.blk_sz) != hdr.blk_sz) exit(8);
} else if(chunk.chunk_type == CHUNK_TYPE_DONT_CARE) {
if(chunk.total_sz != sizeof(chunk_header_t)) exit(9);
memset(block, 0, hdr.blk_sz);
for(unsigned i=0; i<chunk.chunk_sz; i++)
if(write(1, block, hdr.blk_sz) != hdr.blk_sz) exit(10);
} else if(chunk.chunk_type == CHUNK_TYPE_CRC32) {
if(chunk.total_sz != 4 + sizeof(chunk_header_t)) exit(7);
uint32_t crc32;
if(read(0, &crc32, sizeof(crc32)) != sizeof(crc32)) exit(5);
/* ignore crc32 */
} else {
exit(4);
}
}
fsync(1);
return 0;
}

View File

@ -1,62 +0,0 @@
typedef unsigned short int sa_family_t;
#define __KERNEL_STRICT_NAMES
#include <sys/types.h>
#include <linux/netlink.h>
#include <sys/socket.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
//From a uevent patch for hal
#define HOTPLUG_BUFFER_SIZE 1024
#define HOTPLUG_NUM_ENVP 32
#define OBJECT_SIZE 512
#ifndef NETLINK_KOBJECT_UEVENT
#error Your kernel headers are too old, and do not define NETLINK_KOBJECT_UEVENT. You need Linux 2.6.10 or higher for KOBJECT_UEVENT support.
#endif
int main(int argc, char **argv, char **envp) {
//Start listening
int fd;
struct sockaddr_nl ksnl;
memset(&ksnl, 0x00, sizeof(struct sockaddr_nl));
ksnl.nl_family=AF_NETLINK;
ksnl.nl_pid=getpid();
ksnl.nl_groups=0xffffffff;
fd=socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
if (fd==-1) {
printf("Couldn't open kobject-uevent netlink socket");
perror("");
exit(1);
}
if (bind(fd, (struct sockaddr *) &ksnl, sizeof(struct sockaddr_nl))<0) {
fprintf (stderr, "Error binding to netlink socket");
close(fd);
exit(1);
}
while(1) {
char buffer[HOTPLUG_BUFFER_SIZE + OBJECT_SIZE];
int buflen;
buflen=recv(fd, &buffer, sizeof(buffer), 0);
if (buflen<0) {
exit(1);
}
if(argc>=2) {
if(!strstr(buffer, argv[1])) continue;
}
printf("%s\n", buffer);
char *pos = buffer + strlen(buffer);
char *end = buffer + buflen;
while(pos < end) {
int l = strlen(pos);
printf("\t%s\n", pos);
pos += l+1;
}
}
}

View File

@ -1,48 +0,0 @@
#include <iostream>
#include <vendor/lge/hardware/vibrator/1.0/IVibratorEx.h>
using ::vendor::lge::hardware::vibrator::V1_0::IVibratorEx;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IVibratorEx::getService();
auto supportsAmplitude = svc->supportsAmplitudeControl();
if(supportsAmplitude.isOk())
std::cerr << "supportsAmplitudeControl? " << supportsAmplitude << std::endl;
/*
public int on(int timeoutMs) throws RemoteException {
public int off() throws RemoteException {
public int setAmplitude(byte amplitude) throws RemoteException {
public void perform(int effect, byte strength, performCallback _hidl_cb) throws RemoteException {
public int playEffectWithStrength(ArrayList<Byte> effectData, int effectIndex, int strength) throws RemoteException {
*/
if(strcmp(argv[1], "on") == 0) {
int v = 100;
if(argc>=3)
v = atoi(argv[2]);
auto ret = svc->on(v);
if(ret.isOk()) {
android::hardware::vibrator::V1_0::Status r = ret;
std::cout << "vibrator on returned " << (int)r << std::endl;
} else {
std::cerr << "Binder failed request" << std::endl;
}
} else if(strcmp(argv[1], "amplitude") == 0) {
int v = 127;
if(argc>=3)
v = atoi(argv[2]);
auto ret = svc->setAmplitude(v);
if(ret.isOk()) {
android::hardware::vibrator::V1_0::Status r = ret;
std::cout << "vibrator amplitude returned " << (int)r << std::endl;
} else {
std::cerr << "Binder failed request" << std::endl;
}
} else {
std::cerr << "Not supported (yet)" << std::endl;
}
}

View File

@ -1,40 +0,0 @@
#include <iostream>
#include <unistd.h>
#include <vendor/xiaomi/hardware/displayfeature/1.0/IDisplayFeature.h>
using ::vendor::xiaomi::hardware::displayfeature::V1_0::IDisplayFeature;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IDisplayFeature::getService();
if(svc == nullptr) {
std::cerr << "Failed getting IDisplayFeature" << std::endl;
return -1;
}
if(argc != 3) {
fprintf(stderr, "Usage: %s <ADAPT|ENHANCE|STANDARD|EYECARE|MONOCHROME|SUNLIGHT|NIGHTLIGHT|HIGHLIGHT> <value>\n", argv[0]);
return -2;
}
int mode = -1;
std::string modeArg(argv[1]);
if(modeArg == "ADAPT")
mode = 0;
if(modeArg == "ENHANCE")
mode = 1;
if(modeArg == "STANDARD")
mode = 2;
if(modeArg == "EYECARE")
mode = 3;
if(modeArg == "MONOCHROME")
mode = 4;
if(modeArg == "SUNLIGHT")
mode = 8;
if(modeArg == "NIGHTLIGHT")
mode = 9;
if(modeArg == "HIGHLIGHT")
mode = 11;
else
mode = atoi(argv[1]);
svc->setFeature(0, mode, atoi(argv[2]), 255);
}

View File

@ -1,21 +0,0 @@
#include <iostream>
#include <unistd.h>
#include <vendor/xiaomi/hardware/fingerprintextension/1.0/IXiaomiFingerprint.h>
using ::vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IXiaomiFingerprint::getService();
if(svc == nullptr) {
std::cerr << "Failed getting IDisplayFeature" << std::endl;
return -1;
}
if(argc != 3) {
fprintf(stderr, "Usage: %s <command> <value>\n", argv[0]);
return -2;
}
uint32_t cmd = (uint32_t)strtoll(argv[1], NULL, 16);
uint32_t value = (uint32_t)strtoll(argv[2], NULL, 16);
svc->extCmd(cmd, value);
}

View File

@ -1,38 +0,0 @@
#include <iostream>
#include <unistd.h>
#include <vendor/xiaomi/hardware/motor/1.0/IMotor.h>
using ::vendor::xiaomi::hardware::motor::V1_0::IMotor;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IMotor::getService();
if(svc == nullptr) {
std::cerr << "Failed getting IMotor" << std::endl;
return -1;
}
if(argc<2) {
std::cerr << "Usage: " << argv[0] << " <init|release|popup|takeback|takebackShortly>" << std::endl;
return -1;
}
std::string cmd(argv[1]);
if(cmd == "init") {
svc->init();
} else if(cmd == "release") {
svc->release();
} else if(cmd == "popup") {
if(argc!=3) {
std::cerr << "Usage: " << argv[0] << " " << argv[1] << " <cookie>" << std::endl;
return -1;
}
svc->popupMotor(atoi(argv[2]));
} else if(cmd == "takeback") {
if(argc!=3) {
std::cerr << "Usage: " << argv[0] << " " << argv[1] << " <cookie>" << std::endl;
return -1;
}
svc->takebackMotor(atoi(argv[2]));
} else if(cmd == "takebackShortly") {
svc->takebackMotorShortly();
}
}

0
empty
View File

View File

@ -1,3 +0,0 @@
<?xml version="1.0"?>
<permissions>
</permissions>

View File

@ -1,4 +1,4 @@
# set up the global environment
on init
export BOOTCLASSPATH /apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar
export SYSTEMSERVERCLASSPATH /system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar:/system/framework/com.android.location.provider.jar
export BOOTCLASSPATH %BOOTCLASSPATH%
export SYSTEMSERVERCLASSPATH %SYSTEMSERVERCLASSPATH%

View File

@ -1,8 +0,0 @@
service adbd_system /system/bin/adbd --root_seclabel=u:r:su:s0
class core
socket adbd stream 660 system system
disabled
seclabel u:r:adbd:s0
on property:sys.usb.state=adb && property:sys.phh.five=true
start adbd_system

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<feature name="android.software.controls" />
</permissions>

View File

@ -1,30 +0,0 @@
# Copyright (c) 2019, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
key 226 HEADSETHOOK
key 257 VOLUME_UP
key 258 VOLUME_DOWN

View File

@ -1,11 +0,0 @@
##################################
#
#add for fpc fingerprints
#
##################################
key 195 SYSTEM_NAVIGATION_UP
key 196 SYSTEM_NAVIGATION_DOWN
key 197 SYSTEM_NAVIGATION_LEFT
key 198 SYSTEM_NAVIGATION_RIGHT
key 353 DPAD_CENTER

View File

@ -1,11 +0,0 @@
##################################
#
#add for goodix fingerprints
#
##################################
key 195 SYSTEM_NAVIGATION_UP
key 196 SYSTEM_NAVIGATION_DOWN
key 197 SYSTEM_NAVIGATION_LEFT
key 198 SYSTEM_NAVIGATION_RIGHT
key 353 DPAD_CENTER

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="/vendor/etc/audio_policy_volumes.xml"/>
<xi:include href="/vendor/etc/default_volume_tables.xml"/>
</audioPolicyConfiguration>

View File

@ -1,4 +0,0 @@
key 106 SYSTEM_NAVIGATION_LEFT
key 108 SYSTEM_NAVIGATION_DOWN
key 103 SYSTEM_NAVIGATION_UP
key 105 SYSTEM_NAVIGATION_RIGHT

View File

@ -1,7 +0,0 @@
key 28 HOME VIRTUAL
key 105 APP_SWITCH
key 106 APP_SWITCH
key 118 WAKEUP
key 174 BACK
key 108 SYSTEM_NAVIGATION_DOWN
key 103 SYSTEM_NAVIGATION_UP

View File

@ -1 +0,0 @@
key 542 WAKEUP

View File

@ -1,32 +0,0 @@
# Copyright (c) 2013, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 102 HOME
key 528 FOCUS
key 766 CAMERA
key 689 VOICE_ASSIST

View File

@ -1,14 +0,0 @@
#
# ETS320 Touch sensor driver
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License Version 2
# as published by the Free Software Foundation.
#
# ets320 "finger present"
key 618 SYSTEM_NAVIGATION_DOWN
key 619 SYSTEM_NAVIGATION_UP
key 620 SYSTEM_NAVIGATION_LEFT
key 621 SYSTEM_NAVIGATION_RIGHT

View File

@ -1,6 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 POWER
key 236 ASSIST

View File

@ -1 +0,0 @@
key 0x44 POWER

View File

@ -1,28 +0,0 @@
# Copyright (c) 2015, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
key 62 WAKEUP

View File

@ -1,2 +0,0 @@
key 62 WAKEUP

View File

@ -1,72 +0,0 @@
#!/system/bin/sh
set -e
if ! [ "$(getprop ro.boot.dynamic_partitions)" = true ];then
echo "OTA is supported only for devices with dynamic partitions!"
exit 1
fi
flavor=$(getprop ro.product.product.name)
nextVersion=$(curl --silent -L https://raw.githubusercontent.com/phhusson/treble_experimentations/master/ota/roar/$flavor/date)
if [ -z "$nextVersion" ];then
echo "Couldn't find any OTA for $flavor"
exit 1
fi
url=$(curl --silent -L https://raw.githubusercontent.com/phhusson/treble_experimentations/master/ota/roar/$flavor/url)
size=$(curl --silent -L https://raw.githubusercontent.com/phhusson/treble_experimentations/master/ota/roar/$flavor/size)
if [ "$(getprop ro.product.build.date.utc)" = "$nextVersion" ];then
echo "Installing $nextVersion onto itself, aborting"
exit 1
fi
if ! curl --silent -L https://raw.githubusercontent.com/phhusson/treble_experimentations/master/ota/roar/$flavor/known_releases |grep -q $(getprop ro.product.build.date.utc);then
echo "Warning! The build you are currently running is unknown. Type YES to confirm you want to apply OTA from $url"
read answer
if ! [ "$answer" = YES ];then
exit 1
fi
fi
if [ -b /dev/tmp-phh ] && ! tune2fs -l /dev/tmp-phh |grep 'Last mount time' |grep -q n/a;then
echo "Warning! It looks like you modified your system image! Flashing this OTA will revert this!"
echo "Type YES to acknowledge"
read answer
if ! [ "$answer" = YES ];then
exit 1
fi
fi
lptools remove system_phh
free=$(lptools free |grep -oE '[0-9]+$')
if [ "$free" -le "$size" ];then
echo "Warning! There doesn't seem to be enough space on super partition."
echo "Do you want me to try to make more space? Type YES"
read answer
if ! [ "$answer" = YES ];then
exit 1
fi
lptools clear-cow || true
lptools unlimited-group || true
lptools remove product || true
lptools remove product$(getprop ro.boot.slot_suffix) || true
free=$(lptools free |grep -oE '[0-9]+$')
if [ "$free" -le "$size" ];then
echo "Sorry, there is still not enough space available. OTA requires $size, you have $free available"
exit 1
fi
fi
lptools create system_phh "$size"
lptools unmap system_phh
dmDevice=$(lptools map system_phh|grep -oE '/dev/block/[^ ]*')
echo "Flashing from ${url}..."
curl -L "$url" | busybox_phh xz -d -c | simg2img_simple > $dmDevice
lptools replace system_phh system
reboot
exit 0

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<SecFloatingFeatureSet>
<SEC_FLOATING_FEATURE_AUDIO_SUPPORT_PSEUDO_DUAL_SPEAKER>TRUE</SEC_FLOATING_FEATURE_AUDIO_SUPPORT_PSEUDO_DUAL_SPEAKER>
</SecFloatingFeatureSet>

View File

@ -1,12 +0,0 @@
# Copyright (C) 2018 The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 POWER
key 703 ASSIST
key 103 SYSTEM_NAVIGATION_UP
key 105 SYSTEM_NAVIGATION_LEFT
key 106 SYSTEM_NAVIGATION_RIGHT
key 108 SYSTEM_NAVIGATION_DOWN
key 172 HOME

View File

@ -1 +0,0 @@
touch.orientationAware = 1

View File

@ -1,3 +0,0 @@
key 158 BACK
key 254 APP_SWITCH

View File

@ -1,30 +0,0 @@
# Copyright (c) 2015, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
key 143 WAKEUP
key 172 WAKEUP

View File

@ -1,5 +0,0 @@
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 528 FOCUS
key 766 CAMERA

View File

@ -1,4 +0,0 @@
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 POWER
key 456 WAKEUP

View File

@ -1,3 +0,0 @@
# Key layout for Unihertz devices with fingerprint sensor
# For Atom {,L,XL}: fingerprint sensor as home
key 172 HOME VIRTUAL

View File

@ -1,13 +0,0 @@
# Keylayout for Unihertz devices with a dedicated PTT button
# Volume buttons
key 115 VOLUME_UP
key 114 VOLUME_DOWN
# Power button
key 116 POWER
# PTT - Remap to camera by default
# CAMERA is delivered to apps, so remapping via
# third-party apps is possible
key 249 CAMERA
key 250 CAMERA

View File

@ -1,6 +0,0 @@
# Keylayout for Unihertz devices with capacitive keys
# Capacitive navigation
key 172 HOME VIRTUAL
key 580 APP_SWITCH VIRTUAL
key 158 BACK VIRTUAL

View File

@ -1,6 +0,0 @@
# Keylayout for Unihertz devices with capacitive keys
# Capacitive navigation
key 172 HOME VIRTUAL
key 580 APP_SWITCH VIRTUAL
key 158 BACK VIRTUAL

View File

@ -1,6 +0,0 @@
key 0x6c SYSTEM_NAVIGATION_DOWN
key 0x67 SYSTEM_NAVIGATION_UP
key 0x69 SYSTEM_NAVIGATION_LEFT
key 0x6a SYSTEM_NAVIGATION_RIGHT

View File

@ -1 +0,0 @@
key 0x248 ASSIST

View File

@ -1,23 +0,0 @@
<manifest version="1.0" type="framework">
<hal format="hidl">
<name>android.hardware.wifi.hostapd</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IHostapd</name>
<instance>default</instance>
</interface>
</hal>
<!-- For our Oppo/Realme friends -->
<hal>
<name>android.hardware.biometrics.fingerprint</name>
<transport>hwbinder</transport>
<version>2.1</version>
<interface>
<name>IBiometricsFingerprint</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View File

@ -1,21 +0,0 @@
BUILD_GMS := yes
#include not inherit, because we must edit some values
-include vendor/google/products/gms_go.mk
-include vendor/partner_gms/products/gms_go.mk
FILTER_OUT = $(foreach v,$(2),$(if $(findstring $(1),$(v)),,$(v)))
#gms_go.mk has a broken copy of google_go.xml => google.xml
#But there already is a google.xml => google.xml
#Only difference between those is maps go and youtube go applinks, so good enough
PRODUCT_COPY_FILES := $(call FILTER_OUT,google_go.xml:, $(PRODUCT_COPY_FILES))
#We need to use this way because it overrides sync adapters
PRODUCT_PACKAGES := $(filter-out CalendarGoogle, $(PRODUCT_PACKAGES))
PRODUCT_PACKAGES := $(filter-out GoogleContacts, $(PRODUCT_PACKAGES))
PRODUCT_SHIPPING_API_LEVEL :=
PRODUCT_PACKAGES += \
phh-gapps-go-overrides \
GoogleContactsSyncAdapter \

View File

@ -1,30 +1,4 @@
BUILD_GMS := yes
ifneq ($(wildcard vendor/google)$(wildcard vendor/partner_gms),)
-include vendor/google/products/gms.mk
-include vendor/partner_gms/products/gms.mk
PRODUCT_SHIPPING_API_LEVEL :=
PRODUCT_PACKAGES := $(filter-out CalendarGoogle, $(PRODUCT_PACKAGES))
PRODUCT_PACKAGES := $(filter-out GoogleContacts, $(PRODUCT_PACKAGES))
PRODUCT_PACKAGES += \
phh-gapps-overrides \
Chrome \
GoogleContactsSyncAdapter \
talkback \
PRODUCT_SYSTEM_DEFAULT_PROPERTIES := $(filter-out ro.boot.vendor.overlay.theme=%,$(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
endif
ifneq ($(wildcard vendor/opengapps),)
PRODUCT_COPY_FILES += \
device/phh/treble/empty-permission.xml:system/etc/permissions/com.google.android.camera2.xml \
device/phh/treble/empty-permission.xml:system/etc/permissions/com.google.android.camera.experimental2015.xml \
device/phh/treble/empty-permission.xml:system/etc/permissions/com.google.android.camera.experimental2016.xml \
device/phh/treble/empty-permission.xml:system/etc/permissions/com.google.android.camera.experimental2017.xml
PRODUCT_PACKAGE_OVERLAYS += device/phh/treble/overlay-gapps
GAPPS_VARIANT := pico
GAPPS_VARIANT := nano
DONT_DEXPREOPT_PREBUILTS := true
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := true
GAPPS_FORCE_PACKAGE_OVERRIDES := true
@ -35,18 +9,8 @@ PRODUCT_PACKAGES += \
CalculatorGoogle \
PrebuiltDeskClockGoogle \
CalendarGooglePrebuilt \
GoogleHome \
LatinImeGoogle \
phh-overrides
$(call inherit-product, vendor/opengapps/build/opengapps-packages.mk)
endif
#Pixel Experience gapps
ifneq ($(wildcard vendor/gapps),)
IS_PHONE := true
$(call inherit-product,vendor/gapps/config.mk)
PRODUCT_PACKAGES += \
phh-overrides \
com.simplemobiletools.gallery.pro \
endif

View File

@ -2,38 +2,24 @@
rom_script=''
if [ -n "$1" ];then
if echo "$1" | grep -qF /;then
rom_script=''
for i in "$@";do
rom_script="$rom_script"$'\n''$(call inherit-product, '$i')'
done
else
rom_script='$(call inherit-product, device/phh/treble/'$1'.mk)'
fi
rom_script='$(call inherit-product, device/phh/treble/'$1'.mk)'
fi
echo 'PRODUCT_MAKEFILES := \' > AndroidProducts.mk
for part in a ab;do
for apps in vanilla gapps foss gapps-go;do
for arch in arm64 arm a64;do
for apps in vanilla gapps foss;do
for arch in arm64 arm;do
for su in yes no;do
apps_suffix=""
apps_script=""
apps_name=""
extra_packages=""
vndk="vndk.mk"
optional_base=""
if [ "$apps" == "gapps" ];then
apps_suffix="g"
apps_script='$(call inherit-product, device/phh/treble/gapps.mk)'
apps_name="with GApps"
fi
if [ "$apps" == "gapps-go" ];then
apps_suffix="o"
apps_script='$(call inherit-product, device/phh/treble/gapps-go.mk)'
apps_name="Go"
fi
if [ "$apps" == "foss" ];then
apps_suffix="f"
apps_script='$(call inherit-product, vendor/foss/foss.mk)'
@ -44,55 +30,33 @@ for part in a ab;do
apps_script=''
apps_name="vanilla"
fi
if [ "$arch" == "arm" ];then
vndk="vndk-binder32.mk"
fi
if [ "$arch" == "a64" ];then
vndk="vndk32.mk"
fi
su_suffix='N'
if [ "$su" == "yes" ];then
su_suffix='S'
extra_packages+=' phh-su me.phh.superuser'
extra_packages+=' phh-su'
fi
part_suffix='a'
if [ "$part" == 'ab' ];then
part_suffix='b'
else
optional_base='$(call inherit-product, device/phh/treble/base-sas.mk)'
fi
target="treble_${arch}_${part_suffix}${apps_suffix}${su_suffix}"
baseArch="$arch"
if [ "$arch" = "a64" ];then
baseArch="arm"
fi
zygote=32
if [ "$arch" = "arm64" ];then
zygote=64_32
fi
cat > ${target}.mk << EOF
TARGET_GAPPS_ARCH := ${baseArch}
\$(call inherit-product, device/phh/treble/base-pre.mk)
include build/make/target/product/aosp_${baseArch}_ab.mk
include build/make/target/product/treble_common.mk
\$(call inherit-product, device/phh/treble/base.mk)
$optional_base
$apps_script
$rom_script
PRODUCT_NAME := $target
PRODUCT_DEVICE := phhgsi_${arch}_$part
PRODUCT_BRAND := Phh
PRODUCT_SYSTEM_BRAND := Phh
PRODUCT_BRAND := Android
PRODUCT_MODEL := Phh-Treble $apps_name
PRODUCT_PACKAGES += $extra_packages
EOF
echo -e '\t$(LOCAL_DIR)/'$target.mk '\' >> AndroidProducts.mk
done

View File

@ -1,23 +0,0 @@
cc_binary {
name: "android.hardware.biometrics.fingerprint@2.1-service.oplus.compat",
defaults: ["hidl_defaults"],
init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.oplus.rc"],
relative_install_path: "hw",
srcs: [
"BiometricsFingerprint.cpp",
"service.cpp",
],
cflags: [
"-Wno-unused-parameter",
],
shared_libs: [
"libcutils",
"liblog",
"libhidlbase",
"libhardware",
"libutils",
"libbase",
"android.hardware.biometrics.fingerprint@2.1",
"vendor.oplus.hardware.biometrics.fingerprint@2.1",
],
}

View File

@ -1,267 +0,0 @@
/*
* Copyright (C) 2017 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.
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.oplus.compat"
#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.1-service.oplus.compat"
#include <hardware/hardware.h>
#include <hardware/fingerprint.h>
#include "BiometricsFingerprint.h"
#include <inttypes.h>
#include <unistd.h>
#include <utils/Log.h>
#include <thread>
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
namespace V2_1 {
namespace implementation {
BiometricsFingerprint::BiometricsFingerprint() {
for(int i=0; i<10; i++) {
mOplusBiometricsFingerprint = vendor::oplus::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint::tryGetService();
if(mOplusBiometricsFingerprint != nullptr) break;
sleep(10);
}
if(mOplusBiometricsFingerprint == nullptr) exit(0);
}
static bool receivedCancel;
static bool receivedEnumerate;
static uint64_t myDeviceId;
static std::vector<uint32_t> knownFingers;
class OplusClientCallback : public vendor::oplus::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback {
public:
sp<android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback> mClientCallback;
OplusClientCallback(sp<android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback> clientCallback) : mClientCallback(clientCallback) {}
Return<void> onEnrollResult(uint64_t deviceId, uint32_t fingerId,
uint32_t groupId, uint32_t remaining) {
ALOGE("onEnrollResult %" PRIu64 " %u %u %u", deviceId, fingerId, groupId, remaining);
if(mClientCallback != nullptr)
mClientCallback->onEnrollResult(deviceId, fingerId, groupId, remaining);
return Void();
}
Return<void> onAcquired(uint64_t deviceId, vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo acquiredInfo,
int32_t vendorCode) {
ALOGE("onAcquired %" PRIu64 " %d", deviceId, vendorCode);
if(mClientCallback != nullptr)
mClientCallback->onAcquired(deviceId, OplusToAOSPFingerprintAcquiredInfo(acquiredInfo), vendorCode);
return Void();
}
Return<void> onAuthenticated(uint64_t deviceId, uint32_t fingerId, uint32_t groupId,
const hidl_vec<uint8_t>& token) {
ALOGE("onAuthenticated %" PRIu64 " %u %u", deviceId, fingerId, groupId);
if(mClientCallback != nullptr)
mClientCallback->onAuthenticated(deviceId, fingerId, groupId, token);
return Void();
}
Return<void> onError(uint64_t deviceId, vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError error, int32_t vendorCode) {
ALOGE("onError %" PRIu64 " %d", deviceId, vendorCode);
if(error == vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_CANCELED) {
receivedCancel = true;
}
if(mClientCallback != nullptr)
mClientCallback->onError(deviceId, OplusToAOSPFingerprintError(error), vendorCode);
return Void();
}
Return<void> onRemoved(uint64_t deviceId, uint32_t fingerId, uint32_t groupId,
uint32_t remaining) {
ALOGE("onRemoved %" PRIu64 " %" PRIu32, deviceId, fingerId);
if(mClientCallback != nullptr)
mClientCallback->onRemoved(deviceId, fingerId, groupId, remaining);
return Void();
}
Return<void> onEnumerate(uint64_t deviceId, uint32_t fingerId, uint32_t groupId,
uint32_t remaining) {
receivedEnumerate = true;
ALOGE("onEnumerate %" PRIu64 " %u %u %u", deviceId, fingerId, groupId, remaining);
if(mClientCallback != nullptr)
mClientCallback->onEnumerate(deviceId, fingerId, groupId, remaining);
return Void();
}
Return<void> onTouchUp(uint64_t deviceId) { return Void(); }
Return<void> onTouchDown(uint64_t deviceId) { return Void(); }
Return<void> onSyncTemplates(uint64_t deviceId, const hidl_vec<uint32_t>& fingerId, uint32_t remaining) {
ALOGE("onSyncTemplates %" PRIu64 " %zu %" PRIu32, deviceId, fingerId.size(), remaining);
myDeviceId = deviceId;
for(auto fid : fingerId) {
ALOGE("\t- %u", fid);
}
knownFingers = fingerId;
return Void();
}
Return<void> onFingerprintCmd(int32_t deviceId, const hidl_vec<uint32_t>& groupId, uint32_t remaining) { return Void(); }
Return<void> onImageInfoAcquired(uint32_t type, uint32_t quality, uint32_t match_score) { return Void(); }
Return<void> onMonitorEventTriggered(uint32_t type, const hidl_string& data) { return Void(); }
Return<void> onEngineeringInfoUpdated(uint32_t length, const hidl_vec<uint32_t>& keys, const hidl_vec<hidl_string>& values) { return Void(); }
Return<void> onUIReady(int64_t deviceId) { return Void(); }
private:
Return<android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo> OplusToAOSPFingerprintAcquiredInfo(vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo info) {
switch(info) {
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_GOOD: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_GOOD;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_PARTIAL: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_PARTIAL;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_IMAGER_DIRTY: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_IMAGER_DIRTY;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_TOO_SLOW: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_TOO_SLOW;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_TOO_FAST: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_TOO_FAST;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_VENDOR: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_VENDOR;
default:
return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_GOOD;
}
}
Return<android::hardware::biometrics::fingerprint::V2_1::FingerprintError> OplusToAOSPFingerprintError(vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError error) {
switch(error) {
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_ERROR: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_ERROR;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_HW_UNAVAILABLE: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_HW_UNAVAILABLE;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_UNABLE_TO_PROCESS: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_UNABLE_TO_PROCESS;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_TIMEOUT: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_TIMEOUT;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_SPACE: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_SPACE;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_CANCELED: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_CANCELED;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_UNABLE_TO_REMOVE: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_UNABLE_TO_REMOVE;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_LOCKOUT: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_LOCKOUT;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_VENDOR: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_VENDOR;
default:
return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_ERROR;
}
}
};
Return<uint64_t> BiometricsFingerprint::setNotify(
const sp<IBiometricsFingerprintClientCallback>& clientCallback) {
ALOGE("setNotify");
mOplusClientCallback = new OplusClientCallback(clientCallback);
return mOplusBiometricsFingerprint->setNotify(mOplusClientCallback);
}
Return<RequestStatus> BiometricsFingerprint::OplusToAOSPRequestStatus(vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus req) {
switch(req) {
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_UNKNOWN: return RequestStatus::SYS_UNKNOWN;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_OK: return RequestStatus::SYS_OK;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_ENOENT: return RequestStatus::SYS_ENOENT;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EINTR: return RequestStatus::SYS_EINTR;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EIO: return RequestStatus::SYS_EIO;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EAGAIN: return RequestStatus::SYS_EAGAIN;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_ENOMEM: return RequestStatus::SYS_ENOMEM;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EACCES: return RequestStatus::SYS_EACCES;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EFAULT: return RequestStatus::SYS_EFAULT;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EBUSY: return RequestStatus::SYS_EBUSY;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EINVAL: return RequestStatus::SYS_EINVAL;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_ENOSPC: return RequestStatus::SYS_ENOSPC;
case vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_ETIMEDOUT: return RequestStatus::SYS_ETIMEDOUT;
default:
return RequestStatus::SYS_UNKNOWN;
}
}
Return<uint64_t> BiometricsFingerprint::preEnroll() {
ALOGE("preEnroll");
return mOplusBiometricsFingerprint->preEnroll();
}
Return<RequestStatus> BiometricsFingerprint::enroll(const hidl_array<uint8_t, 69>& hat,
uint32_t gid, uint32_t timeoutSec) {
ALOGE("enroll");
return OplusToAOSPRequestStatus(mOplusBiometricsFingerprint->enroll(hat, gid, timeoutSec));
}
Return<RequestStatus> BiometricsFingerprint::postEnroll() {
ALOGE("postEnroll");
return OplusToAOSPRequestStatus(mOplusBiometricsFingerprint->postEnroll());
}
Return<uint64_t> BiometricsFingerprint::getAuthenticatorId() {
ALOGE("getAuthId");
return mOplusBiometricsFingerprint->getAuthenticatorId();
}
Return<RequestStatus> BiometricsFingerprint::cancel() {
receivedCancel = false;
RequestStatus ret = OplusToAOSPRequestStatus(mOplusBiometricsFingerprint->cancel());
ALOGE("CANCELING");
if(!receivedCancel) {
ALOGE("Sending cancel error");
mOplusClientCallback->mClientCallback->onError(
myDeviceId,
android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_CANCELED,
0);
}
return ret;
}
Return<RequestStatus> BiometricsFingerprint::enumerate() {
receivedEnumerate = false;
RequestStatus ret = OplusToAOSPRequestStatus(mOplusBiometricsFingerprint->enumerate());
ALOGE("ENUMERATING");
if(ret == RequestStatus::SYS_OK && !receivedEnumerate) {
size_t nFingers = knownFingers.size();
ALOGE("received fingers, sending our own %zu", nFingers);
if(nFingers > 0) {
for(auto finger: knownFingers) {
mOplusClientCallback->mClientCallback->onEnumerate(
myDeviceId,
finger,
0,
--nFingers);
}
} else {
mOplusClientCallback->mClientCallback->onEnumerate(
myDeviceId,
0,
0,
0);
}
}
return ret;
}
Return<RequestStatus> BiometricsFingerprint::remove(uint32_t gid, uint32_t fid) {
ALOGE("remove");
return OplusToAOSPRequestStatus(mOplusBiometricsFingerprint->remove(gid, fid));
}
Return<RequestStatus> BiometricsFingerprint::setActiveGroup(uint32_t gid,
const hidl_string& storePath) {
ALOGE("setActiveGroup");
return OplusToAOSPRequestStatus(mOplusBiometricsFingerprint->setActiveGroup(gid, storePath));
}
Return<RequestStatus> BiometricsFingerprint::authenticate(uint64_t operationId, uint32_t gid) {
ALOGE("auth");
return OplusToAOSPRequestStatus(mOplusBiometricsFingerprint->authenticate(operationId, gid));
}
} // namespace implementation
} // namespace V2_1
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android

View File

@ -1,78 +0,0 @@
/*
* Copyright (C) 2017 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.
*/
#ifndef ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H
#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H
#include <log/log.h>
#include <android/log.h>
#include <hardware/hardware.h>
#include <hardware/fingerprint.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
#include <android/hardware/biometrics/fingerprint/2.1/types.h>
#include <vendor/oplus/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
namespace V2_1 {
namespace implementation {
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback;
using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::OK;
using ::android::sp;
using ::android::status_t;
class OplusClientCallback;
struct BiometricsFingerprint : public IBiometricsFingerprint {
public:
BiometricsFingerprint();
// Methods from ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint follow.
Return<uint64_t> setNotify(const sp<IBiometricsFingerprintClientCallback>& clientCallback) override;
Return<uint64_t> preEnroll() override;
Return<RequestStatus> enroll(const hidl_array<uint8_t, 69>& hat, uint32_t gid, uint32_t timeoutSec) override;
Return<RequestStatus> postEnroll() override;
Return<uint64_t> getAuthenticatorId() override;
Return<RequestStatus> cancel() override;
Return<RequestStatus> enumerate() override;
Return<RequestStatus> remove(uint32_t gid, uint32_t fid) override;
Return<RequestStatus> setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
Return<RequestStatus> authenticate(uint64_t operationId, uint32_t gid) override;
private:
sp<vendor::oplus::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint> mOplusBiometricsFingerprint;
sp<OplusClientCallback> mOplusClientCallback;
static Return<RequestStatus> OplusToAOSPRequestStatus(vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus req);
};
} // namespace implementation
} // namespace V2_1
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H

View File

@ -1,9 +0,0 @@
service fps_hal.oplus.compat /system/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.oplus.compat
# "class hal" causes a race condition on some devices due to files created
# in /data. As a workaround, postpone startup until later in boot once
# /data is mounted.
class late_start
user system
group system input uhid
writepid /dev/cpuset/system-background/tasks
oneshot

View File

@ -1,61 +0,0 @@
/*
* Copyright (C) 2017 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.
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.realme_sdm710"
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#include "BiometricsFingerprint.h"
using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::OK;
using android::sp;
using android::status_t;
int main() {
sp<BiometricsFingerprint> biometricsFingerprint;
status_t status;
LOG(INFO) << "Fingerprint HAL Adapter service is starting.";
biometricsFingerprint = new BiometricsFingerprint();
if (biometricsFingerprint == nullptr) {
LOG(ERROR) << "Can not create an instance of Fingerprint HAL Adapter BiometricsFingerprint Iface, exiting.";
goto shutdown;
}
configureRpcThreadpool(1, true /*callerWillJoin*/);
status = biometricsFingerprint->registerAsService();
if (status != OK) {
LOG(ERROR) << "Could not register service for Fingerprint HAL Adapter BiometricsFingerprint Iface ("
<< status << ")";
goto shutdown;
}
LOG(INFO) << "Fingerprint HAL Adapter service is ready.";
joinRpcThreadpool();
// Should not pass this line
shutdown:
// In normal operation, we don't expect the thread pool to shutdown
LOG(ERROR) << "Fingerprint HAL Adapter service is shutting down.";
return 1;
}

View File

@ -1,23 +0,0 @@
cc_binary {
name: "android.hardware.biometrics.fingerprint@2.1-service.oppo.compat",
defaults: ["hidl_defaults"],
init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.oppo.rc"],
relative_install_path: "hw",
srcs: [
"BiometricsFingerprint.cpp",
"service.cpp",
],
cflags: [
"-Wno-unused-parameter",
],
shared_libs: [
"libcutils",
"liblog",
"libhidlbase",
"libhardware",
"libutils",
"libbase",
"android.hardware.biometrics.fingerprint@2.1",
"vendor.oppo.hardware.biometrics.fingerprint@2.1",
],
}

View File

@ -1,267 +0,0 @@
/*
* Copyright (C) 2017 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.
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.oppo.compat"
#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.1-service.oppo.compat"
#include <hardware/hardware.h>
#include <hardware/fingerprint.h>
#include "BiometricsFingerprint.h"
#include <inttypes.h>
#include <unistd.h>
#include <utils/Log.h>
#include <thread>
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
namespace V2_1 {
namespace implementation {
BiometricsFingerprint::BiometricsFingerprint() {
for(int i=0; i<10; i++) {
mOppoBiometricsFingerprint = vendor::oppo::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint::tryGetService();
if(mOppoBiometricsFingerprint != nullptr) break;
sleep(10);
}
if(mOppoBiometricsFingerprint == nullptr) exit(0);
}
static bool receivedCancel;
static bool receivedEnumerate;
static uint64_t myDeviceId;
static std::vector<uint32_t> knownFingers;
class OppoClientCallback : public vendor::oppo::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback {
public:
sp<android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback> mClientCallback;
OppoClientCallback(sp<android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback> clientCallback) : mClientCallback(clientCallback) {}
Return<void> onEnrollResult(uint64_t deviceId, uint32_t fingerId,
uint32_t groupId, uint32_t remaining) {
ALOGE("onEnrollResult %" PRIu64 " %u %u %u", deviceId, fingerId, groupId, remaining);
if(mClientCallback != nullptr)
mClientCallback->onEnrollResult(deviceId, fingerId, groupId, remaining);
return Void();
}
Return<void> onAcquired(uint64_t deviceId, vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo acquiredInfo,
int32_t vendorCode) {
ALOGE("onAcquired %" PRIu64 " %d", deviceId, vendorCode);
if(mClientCallback != nullptr)
mClientCallback->onAcquired(deviceId, OppoToAOSPFingerprintAcquiredInfo(acquiredInfo), vendorCode);
return Void();
}
Return<void> onAuthenticated(uint64_t deviceId, uint32_t fingerId, uint32_t groupId,
const hidl_vec<uint8_t>& token) {
ALOGE("onAuthenticated %" PRIu64 " %u %u", deviceId, fingerId, groupId);
if(mClientCallback != nullptr)
mClientCallback->onAuthenticated(deviceId, fingerId, groupId, token);
return Void();
}
Return<void> onError(uint64_t deviceId, vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError error, int32_t vendorCode) {
ALOGE("onError %" PRIu64 " %d", deviceId, vendorCode);
if(error == vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_CANCELED) {
receivedCancel = true;
}
if(mClientCallback != nullptr)
mClientCallback->onError(deviceId, OppoToAOSPFingerprintError(error), vendorCode);
return Void();
}
Return<void> onRemoved(uint64_t deviceId, uint32_t fingerId, uint32_t groupId,
uint32_t remaining) {
ALOGE("onRemoved %" PRIu64 " %" PRIu32, deviceId, fingerId);
if(mClientCallback != nullptr)
mClientCallback->onRemoved(deviceId, fingerId, groupId, remaining);
return Void();
}
Return<void> onEnumerate(uint64_t deviceId, uint32_t fingerId, uint32_t groupId,
uint32_t remaining) {
receivedEnumerate = true;
ALOGE("onEnumerate %" PRIu64 " %u %u %u", deviceId, fingerId, groupId, remaining);
if(mClientCallback != nullptr)
mClientCallback->onEnumerate(deviceId, fingerId, groupId, remaining);
return Void();
}
Return<void> onTouchUp(uint64_t deviceId) { return Void(); }
Return<void> onTouchDown(uint64_t deviceId) { return Void(); }
Return<void> onSyncTemplates(uint64_t deviceId, const hidl_vec<uint32_t>& fingerId, uint32_t remaining) {
ALOGE("onSyncTemplates %" PRIu64 " %zu %" PRIu32, deviceId, fingerId.size(), remaining);
myDeviceId = deviceId;
for(auto fid : fingerId) {
ALOGE("\t- %u", fid);
}
knownFingers = fingerId;
return Void();
}
Return<void> onFingerprintCmd(int32_t deviceId, const hidl_vec<uint32_t>& groupId, uint32_t remaining) { return Void(); }
Return<void> onImageInfoAcquired(uint32_t type, uint32_t quality, uint32_t match_score) { return Void(); }
Return<void> onMonitorEventTriggered(uint32_t type, const hidl_string& data) { return Void(); }
Return<void> onEngineeringInfoUpdated(uint32_t length, const hidl_vec<uint32_t>& keys, const hidl_vec<hidl_string>& values) { return Void(); }
Return<void> onUIReady(int64_t deviceId) { return Void(); }
private:
Return<android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo> OppoToAOSPFingerprintAcquiredInfo(vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo info) {
switch(info) {
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_GOOD: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_GOOD;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_PARTIAL: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_PARTIAL;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_IMAGER_DIRTY: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_IMAGER_DIRTY;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_TOO_SLOW: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_TOO_SLOW;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_TOO_FAST: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_TOO_FAST;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_VENDOR: return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_VENDOR;
default:
return android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo::ACQUIRED_GOOD;
}
}
Return<android::hardware::biometrics::fingerprint::V2_1::FingerprintError> OppoToAOSPFingerprintError(vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError error) {
switch(error) {
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_ERROR: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_ERROR;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_HW_UNAVAILABLE: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_HW_UNAVAILABLE;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_UNABLE_TO_PROCESS: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_UNABLE_TO_PROCESS;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_TIMEOUT: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_TIMEOUT;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_SPACE: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_SPACE;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_CANCELED: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_CANCELED;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_UNABLE_TO_REMOVE: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_UNABLE_TO_REMOVE;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_LOCKOUT: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_LOCKOUT;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_VENDOR: return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_VENDOR;
default:
return android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_NO_ERROR;
}
}
};
Return<uint64_t> BiometricsFingerprint::setNotify(
const sp<IBiometricsFingerprintClientCallback>& clientCallback) {
ALOGE("setNotify");
mOppoClientCallback = new OppoClientCallback(clientCallback);
return mOppoBiometricsFingerprint->setNotify(mOppoClientCallback);
}
Return<RequestStatus> BiometricsFingerprint::OppoToAOSPRequestStatus(vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus req) {
switch(req) {
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_UNKNOWN: return RequestStatus::SYS_UNKNOWN;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_OK: return RequestStatus::SYS_OK;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_ENOENT: return RequestStatus::SYS_ENOENT;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EINTR: return RequestStatus::SYS_EINTR;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EIO: return RequestStatus::SYS_EIO;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EAGAIN: return RequestStatus::SYS_EAGAIN;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_ENOMEM: return RequestStatus::SYS_ENOMEM;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EACCES: return RequestStatus::SYS_EACCES;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EFAULT: return RequestStatus::SYS_EFAULT;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EBUSY: return RequestStatus::SYS_EBUSY;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_EINVAL: return RequestStatus::SYS_EINVAL;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_ENOSPC: return RequestStatus::SYS_ENOSPC;
case vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus::SYS_ETIMEDOUT: return RequestStatus::SYS_ETIMEDOUT;
default:
return RequestStatus::SYS_UNKNOWN;
}
}
Return<uint64_t> BiometricsFingerprint::preEnroll() {
ALOGE("preEnroll");
return mOppoBiometricsFingerprint->preEnroll();
}
Return<RequestStatus> BiometricsFingerprint::enroll(const hidl_array<uint8_t, 69>& hat,
uint32_t gid, uint32_t timeoutSec) {
ALOGE("enroll");
return OppoToAOSPRequestStatus(mOppoBiometricsFingerprint->enroll(hat, gid, timeoutSec));
}
Return<RequestStatus> BiometricsFingerprint::postEnroll() {
ALOGE("postEnroll");
return OppoToAOSPRequestStatus(mOppoBiometricsFingerprint->postEnroll());
}
Return<uint64_t> BiometricsFingerprint::getAuthenticatorId() {
ALOGE("getAuthId");
return mOppoBiometricsFingerprint->getAuthenticatorId();
}
Return<RequestStatus> BiometricsFingerprint::cancel() {
receivedCancel = false;
RequestStatus ret = OppoToAOSPRequestStatus(mOppoBiometricsFingerprint->cancel());
ALOGE("CANCELING");
if(!receivedCancel) {
ALOGE("Sending cancel error");
mOppoClientCallback->mClientCallback->onError(
myDeviceId,
android::hardware::biometrics::fingerprint::V2_1::FingerprintError::ERROR_CANCELED,
0);
}
return ret;
}
Return<RequestStatus> BiometricsFingerprint::enumerate() {
receivedEnumerate = false;
RequestStatus ret = OppoToAOSPRequestStatus(mOppoBiometricsFingerprint->enumerate());
ALOGE("ENUMERATING");
if(ret == RequestStatus::SYS_OK && !receivedEnumerate) {
size_t nFingers = knownFingers.size();
ALOGE("received fingers, sending our own %zu", nFingers);
if(nFingers > 0) {
for(auto finger: knownFingers) {
mOppoClientCallback->mClientCallback->onEnumerate(
myDeviceId,
finger,
0,
--nFingers);
}
} else {
mOppoClientCallback->mClientCallback->onEnumerate(
myDeviceId,
0,
0,
0);
}
}
return ret;
}
Return<RequestStatus> BiometricsFingerprint::remove(uint32_t gid, uint32_t fid) {
ALOGE("remove");
return OppoToAOSPRequestStatus(mOppoBiometricsFingerprint->remove(gid, fid));
}
Return<RequestStatus> BiometricsFingerprint::setActiveGroup(uint32_t gid,
const hidl_string& storePath) {
ALOGE("setActiveGroup");
return OppoToAOSPRequestStatus(mOppoBiometricsFingerprint->setActiveGroup(gid, storePath));
}
Return<RequestStatus> BiometricsFingerprint::authenticate(uint64_t operationId, uint32_t gid) {
ALOGE("auth");
return OppoToAOSPRequestStatus(mOppoBiometricsFingerprint->authenticate(operationId, gid));
}
} // namespace implementation
} // namespace V2_1
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android

View File

@ -1,78 +0,0 @@
/*
* Copyright (C) 2017 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.
*/
#ifndef ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H
#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H
#include <log/log.h>
#include <android/log.h>
#include <hardware/hardware.h>
#include <hardware/fingerprint.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
#include <android/hardware/biometrics/fingerprint/2.1/types.h>
#include <vendor/oppo/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
namespace V2_1 {
namespace implementation {
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback;
using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::OK;
using ::android::sp;
using ::android::status_t;
class OppoClientCallback;
struct BiometricsFingerprint : public IBiometricsFingerprint {
public:
BiometricsFingerprint();
// Methods from ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint follow.
Return<uint64_t> setNotify(const sp<IBiometricsFingerprintClientCallback>& clientCallback) override;
Return<uint64_t> preEnroll() override;
Return<RequestStatus> enroll(const hidl_array<uint8_t, 69>& hat, uint32_t gid, uint32_t timeoutSec) override;
Return<RequestStatus> postEnroll() override;
Return<uint64_t> getAuthenticatorId() override;
Return<RequestStatus> cancel() override;
Return<RequestStatus> enumerate() override;
Return<RequestStatus> remove(uint32_t gid, uint32_t fid) override;
Return<RequestStatus> setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
Return<RequestStatus> authenticate(uint64_t operationId, uint32_t gid) override;
private:
sp<vendor::oppo::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint> mOppoBiometricsFingerprint;
sp<OppoClientCallback> mOppoClientCallback;
static Return<RequestStatus> OppoToAOSPRequestStatus(vendor::oppo::hardware::biometrics::fingerprint::V2_1::RequestStatus req);
};
} // namespace implementation
} // namespace V2_1
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H

View File

@ -1,9 +0,0 @@
service fps_hal.oppo.compat /system/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.oppo.compat
# "class hal" causes a race condition on some devices due to files created
# in /data. As a workaround, postpone startup until later in boot once
# /data is mounted.
class late_start
user system
group system input uhid
writepid /dev/cpuset/system-background/tasks
oneshot

View File

@ -1,61 +0,0 @@
/*
* Copyright (C) 2017 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.
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.realme_sdm710"
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#include "BiometricsFingerprint.h"
using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::OK;
using android::sp;
using android::status_t;
int main() {
sp<BiometricsFingerprint> biometricsFingerprint;
status_t status;
LOG(INFO) << "Fingerprint HAL Adapter service is starting.";
biometricsFingerprint = new BiometricsFingerprint();
if (biometricsFingerprint == nullptr) {
LOG(ERROR) << "Can not create an instance of Fingerprint HAL Adapter BiometricsFingerprint Iface, exiting.";
goto shutdown;
}
configureRpcThreadpool(1, true /*callerWillJoin*/);
status = biometricsFingerprint->registerAsService();
if (status != OK) {
LOG(ERROR) << "Could not register service for Fingerprint HAL Adapter BiometricsFingerprint Iface ("
<< status << ")";
goto shutdown;
}
LOG(INFO) << "Fingerprint HAL Adapter service is ready.";
joinRpcThreadpool();
// Should not pass this line
shutdown:
// In normal operation, we don't expect the thread pool to shutdown
LOG(ERROR) << "Fingerprint HAL Adapter service is shutting down.";
return 1;
}

View File

@ -1,3 +0,0 @@
$(call inherit-product, vendor/havoc/config/common_full_phone.mk)
$(call inherit-product, device/havoc/sepolicy/common/sepolicy.mk)
-include vendor/havoc/build/core/config.mk

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 B

Some files were not shown because too many files have changed in this diff Show More