From db12985a31b3d83625c7c0e88d42b6c114ee62ef Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sun, 31 Mar 2019 17:37:13 +0200 Subject: [PATCH 1/5] Set ussd fix on mtk-ril --- rw-system.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/rw-system.sh b/rw-system.sh index 6187ad5..fafb3cc 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -234,6 +234,7 @@ for f in /vendor/lib/mtk-ril.so /vendor/lib64/mtk-ril.so /vendor/lib/libmtk-ril. mount -o bind "/mnt/phh/$b" "$f" setprop persist.sys.phh.radio.force_cognitive true + setprop persist.sys.radio.ussd.fix true done mount -o bind /system/phh/empty /vendor/overlay/SysuiDarkTheme/SysuiDarkTheme.apk || true From 3f4e811d2eeb68f9ff1b1d6ed8b3e807ad4d8f26 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sun, 31 Mar 2019 17:37:37 +0200 Subject: [PATCH 2/5] Remove mtk/ussd fix from vndk-detect. It is plain wrong (property doesnt exist) --- vndk-detect | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vndk-detect b/vndk-detect index 3f115d9..ab2c9d8 100644 --- a/vndk-detect +++ b/vndk-detect @@ -40,7 +40,3 @@ if getprop ro.hardware |grep -qiE -e qcom -e judyln -e judypn;then setprop persist.sys.overlay.devinputjack true fi fi - -if getprop Build.BRAND | grep -qiE -e MTK;then - setprop persist.sys.radio.ussd.fix true -fi From f00f7f44022d0f7b9ac1b362902be6600d4631c5 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sun, 31 Mar 2019 18:57:41 +0200 Subject: [PATCH 3/5] Samsung pie vendors arent happy with my edits. Disable them until it is fixed --- rw-system.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rw-system.sh b/rw-system.sh index fafb3cc..69d10f6 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -248,7 +248,7 @@ if grep -qF 'PowerVR Rogue GE8100' /vendor/lib/egl/GLESv1_CM_mtk.so || fi #If we have both Samsung and AOSP power hal, take Samsung's -if [ -f /vendor/bin/hw/vendor.samsung.hardware.miscpower@1.0-service ]; then +if [ -f /vendor/bin/hw/vendor.samsung.hardware.miscpower@1.0-service ] && [ "$vndk" -lt 28 ]; then mount -o bind /system/phh/empty /vendor/bin/hw/android.hardware.power@1.0-service fi @@ -280,7 +280,7 @@ if getprop ro.vendor.build.fingerprint | grep -iq -E -e 'huawei|honor' || getpro mount -o bind /system/phh/libnfc-nci-huawei.conf /system/etc/libnfc-nci.conf fi -if getprop ro.vendor.build.fingerprint | grep -qE -e ".*(crown|star)[q2]*lte.*" -e ".*(SC-0[23]K|SCV3[89]).*"; then +if getprop ro.vendor.build.fingerprint | grep -qE -e ".*(crown|star)[q2]*lte.*" -e ".*(SC-0[23]K|SCV3[89]).*" && [ "$vndk" -lt 28 ]; then for f in /vendor/lib/libfloatingfeature.so /vendor/lib64/libfloatingfeature.so; do [ ! -f "$f" ] && continue # shellcheck disable=SC2010 From afae0a4d6f125c5fce5638f95bf4cb4d02b30e7b Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sun, 31 Mar 2019 19:41:09 +0200 Subject: [PATCH 4/5] Add few debug commands --- cmds/Android.bp | 36 ++++++++++++++++++++ cmds/lightsctl-sec.cpp | 59 +++++++++++++++++++++++++++++++++ cmds/xiaomi-display-feature.cpp | 38 +++++++++++++++++++++ cmds/xiaomi-fp.cpp | 21 ++++++++++++ 4 files changed, 154 insertions(+) create mode 100644 cmds/lightsctl-sec.cpp create mode 100644 cmds/xiaomi-display-feature.cpp create mode 100644 cmds/xiaomi-fp.cpp diff --git a/cmds/Android.bp b/cmds/Android.bp index 79514b6..72adbf7 100644 --- a/cmds/Android.bp +++ b/cmds/Android.bp @@ -63,3 +63,39 @@ cc_binary { "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", + ], +} diff --git a/cmds/lightsctl-sec.cpp b/cmds/lightsctl-sec.cpp new file mode 100644 index 0000000..b2c41ff --- /dev/null +++ b/cmds/lightsctl-sec.cpp @@ -0,0 +1,59 @@ +#include +#include +#include + +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; +} diff --git a/cmds/xiaomi-display-feature.cpp b/cmds/xiaomi-display-feature.cpp new file mode 100644 index 0000000..0f2d276 --- /dev/null +++ b/cmds/xiaomi-display-feature.cpp @@ -0,0 +1,38 @@ +#include +#include +#include + +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 \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); +} diff --git a/cmds/xiaomi-fp.cpp b/cmds/xiaomi-fp.cpp new file mode 100644 index 0000000..49701b2 --- /dev/null +++ b/cmds/xiaomi-fp.cpp @@ -0,0 +1,21 @@ +#include +#include +#include + +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 \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); +} From eaacc3accceeb8a709da12be79872581ca3c57a5 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Mon, 8 Apr 2019 13:29:07 +0200 Subject: [PATCH 5/5] Remove global libeffects sed. Breaks many devices, and is actually needed only on moto --- rw-system.sh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/rw-system.sh b/rw-system.sh index 69d10f6..dd06e63 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -198,21 +198,6 @@ if [ "$(getprop ro.vendor.product.manufacturer)" = "motorola" ] || [ "$(getprop fi fi -for f in /vendor/lib/libeffects.so /vendor/lib64/libeffects.so; do - [ ! -f $f ] && continue - f="/vendor/lib/libeffects.so" - # shellcheck disable=SC2010 - ctxt="$(ls -lZ "$f" | grep -oE 'u:object_r:[^:]*:s0')" - b="$(echo "$f" | tr / _)" - - cp -a "$f" "/mnt/phh/$b" - sed -i \ - 's/%zu errors during loading of configuration: %s/%zu errors during loading of configuration: ss/g' \ - "/mnt/phh/$b" - chcon "$ctxt" "/mnt/phh/$b" - mount -o bind "/mnt/phh/$b" "$f" -done - if getprop ro.vendor.build.fingerprint | grep -q -i -e xiaomi/wayne -e xiaomi/jasmine; then setprop persist.imx376_sunny.low.lux 310 setprop persist.imx376_sunny.light.lux 280