Merge pull request #1 from phhusson/android-10.0

Android 10.0 pull from phh
This commit is contained in:
Tim Bortnik 2020-02-23 21:10:21 +02:00 committed by GitHub
commit d72a25793e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
151 changed files with 3691 additions and 342 deletions

17
apex-setup.rc Normal file
View File

@ -0,0 +1,17 @@
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

13
base-sas.mk Normal file
View File

@ -0,0 +1,13 @@
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 \

52
base.mk
View File

@ -2,7 +2,9 @@
#TODO: Proper detection #TODO: Proper detection
PRODUCT_COPY_FILES := \ PRODUCT_COPY_FILES := \
frameworks/native/data/etc/android.hardware.fingerprint.xml:system/etc/permissions/android.hardware.fingerprint.xml \ 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.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.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 \
#Use a more decent APN config #Use a more decent APN config
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
@ -36,7 +38,6 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
device/phh/treble/vndk-detect:system/bin/vndk-detect \ device/phh/treble/vndk-detect:system/bin/vndk-detect \
device/phh/treble/vndk.rc:system/etc/init/vndk.rc \ device/phh/treble/vndk.rc:system/etc/init/vndk.rc \
device/phh/treble/ld.config.26.txt:system/etc/ld.config.26.txt \
#USB Audio #USB Audio
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
@ -51,7 +52,7 @@ PRODUCT_COPY_FILES += \
# LineageOS build may need this to make NFC work # LineageOS build may need this to make NFC work
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
NfcNci NfcNci \
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
device/phh/treble/rw-system.sh:system/bin/rw-system.sh \ device/phh/treble/rw-system.sh:system/bin/rw-system.sh \
@ -62,11 +63,17 @@ PRODUCT_COPY_FILES += \
device/phh/treble/phh-on-boot.sh:system/bin/phh-on-boot.sh device/phh/treble/phh-on-boot.sh:system/bin/phh-on-boot.sh
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
treble-environ-rc treble-environ-rc \
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
bootctl \ bootctl \
vintf 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 += \ PRODUCT_COPY_FILES += \
device/phh/treble/twrp/twrp.rc:system/etc/init/twrp.rc \ device/phh/treble/twrp/twrp.rc:system/etc/init/twrp.rc \
@ -83,6 +90,7 @@ PRODUCT_PACKAGES += \
endif endif
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
android.hidl.manager-V1.0-java \
android.hardware.wifi.hostapd-V1.0-java \ android.hardware.wifi.hostapd-V1.0-java \
vendor.huawei.hardware.biometrics.fingerprint-V2.1-java \ vendor.huawei.hardware.biometrics.fingerprint-V2.1-java \
vendor.huawei.hardware.tp-V1.0-java \ vendor.huawei.hardware.tp-V1.0-java \
@ -99,7 +107,10 @@ PRODUCT_COPY_FILES += \
device/phh/treble/files/huawei-fingerprint.kl:system/phh/huawei/fingerprint.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-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/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/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 \
SELINUX_IGNORE_NEVERALLOWS := true SELINUX_IGNORE_NEVERALLOWS := true
@ -113,3 +124,32 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
device/phh/treble/files/adbd.rc:system/etc/init/adbd.rc 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
PRODUCT_PACKAGES += \
Stk
PRODUCT_PACKAGES += \
resetprop
PRODUCT_COPY_FILES += \
device/phh/treble/phh-securize.sh:system/bin/phh-securize.sh \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.secure_lock_screen.xml:system/etc/permissions/android.software.secure_lock_screen.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

View File

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

View File

@ -36,3 +36,149 @@ cc_binary {
], ],
host_supported: true, 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",
],
}

30
cmds/asus-motor.cpp Normal file
View File

@ -0,0 +1,30 @@
#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);
}

17
cmds/goodix-fp.cpp Normal file
View File

@ -0,0 +1,17 @@
#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;
}

21
cmds/lightsctl-huawei.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <iostream>
#include <vendor/huawei/hardware/light/2.0/IHwLight.h>
#include <android/hardware/light/2.0/types.h>
using ::vendor::huawei::hardware::light::V2_0::IHwLight;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IHwLight::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);
uint32_t b = (uint32_t)strtoll(argv[2], NULL, 10);
auto ret = svc->HWsetLightBrightness(a, b);
std::cout << "Set light brightness returned " << toString(ret) << std::endl;
}

59
cmds/lightsctl-sec.cpp Normal file
View File

@ -0,0 +1,59 @@
#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;
}

62
cmds/lightsctl-seh.cpp Normal file
View File

@ -0,0 +1,62 @@
#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

@ -0,0 +1,12 @@
#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

@ -0,0 +1,3 @@
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

32
cmds/oneplus-motor.cpp Normal file
View File

@ -0,0 +1,32 @@
#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

@ -0,0 +1,27 @@
/*
* 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;
}

55
cmds/persistprops.cpp Normal file
View File

@ -0,0 +1,55 @@
#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);
}

48
cmds/vibrator-lge.cpp Normal file
View File

@ -0,0 +1,48 @@
#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

@ -0,0 +1,38 @@
#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;
svc->setFeature(0, mode, atoi(argv[2]), 255);
}

21
cmds/xiaomi-fp.cpp Normal file
View File

@ -0,0 +1,21 @@
#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);
}

38
cmds/xiaomi-motor.cpp Normal file
View File

@ -0,0 +1,38 @@
#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();
}
}

View File

@ -1,4 +1,4 @@
# set up the global environment # set up the global environment
on init on init
export BOOTCLASSPATH %BOOTCLASSPATH% 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 %SYSTEMSERVERCLASSPATH% export SYSTEMSERVERCLASSPATH /system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar:/system/framework/com.android.location.provider.jar

View File

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

View File

@ -29,4 +29,4 @@ key 114 VOLUME_DOWN
key 102 HOME key 102 HOME
key 528 FOCUS key 528 FOCUS
key 766 CAMERA key 766 CAMERA
key 689 ASSIST key 689 VOICE_ASSIST

View File

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

2
files/oppo-touchpanel.kl Normal file
View File

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

View File

@ -1,3 +1,4 @@
ifneq ($(wildcard vendor/opengapps),)
PRODUCT_COPY_FILES += \ 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.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.experimental2015.xml \
@ -20,3 +21,12 @@ PRODUCT_PACKAGES += \
phh-overrides phh-overrides
$(call inherit-product, vendor/opengapps/build/opengapps-packages.mk) $(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
endif

View File

@ -23,6 +23,7 @@ for part in a ab;do
apps_name="" apps_name=""
extra_packages="" extra_packages=""
vndk="vndk.mk" vndk="vndk.mk"
optional_base=""
if [ "$apps" == "gapps" ];then if [ "$apps" == "gapps" ];then
apps_suffix="g" apps_suffix="g"
apps_script='$(call inherit-product, device/phh/treble/gapps.mk)' apps_script='$(call inherit-product, device/phh/treble/gapps.mk)'
@ -59,15 +60,29 @@ for part in a ab;do
part_suffix='a' part_suffix='a'
if [ "$part" == 'ab' ];then if [ "$part" == 'ab' ];then
part_suffix='b' part_suffix='b'
else
optional_base='$(call inherit-product, device/phh/treble/base-sas.mk)'
fi fi
target="treble_${arch}_${part_suffix}${apps_suffix}${su_suffix}" 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 cat > ${target}.mk << EOF
TARGET_GAPPS_ARCH := ${baseArch}
\$(call inherit-product, device/phh/treble/base-pre.mk) \$(call inherit-product, device/phh/treble/base-pre.mk)
include build/make/target/product/treble_common.mk include build/make/target/product/aosp_${baseArch}_ab.mk
\$(call inherit-product, vendor/vndk/${vndk}) \$(call inherit-product, vendor/vndk/${vndk})
\$(call inherit-product, device/phh/treble/base.mk) \$(call inherit-product, device/phh/treble/base.mk)
$optional_base
$apps_script $apps_script
$rom_script $rom_script
@ -77,6 +92,7 @@ PRODUCT_BRAND := Android
PRODUCT_MODEL := Phh-Treble $apps_name PRODUCT_MODEL := Phh-Treble $apps_name
PRODUCT_PACKAGES += $extra_packages PRODUCT_PACKAGES += $extra_packages
EOF EOF
echo -e '\t$(LOCAL_DIR)/'$target.mk '\' >> AndroidProducts.mk echo -e '\t$(LOCAL_DIR)/'$target.mk '\' >> AndroidProducts.mk
done done

1775
huawei_charger/Android.mk Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

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