Merge remote-tracking branch 'phh/android-12.0' into android-13.0

This commit is contained in:
Pierre-Hugues Husson 2022-10-10 12:24:35 -04:00
commit 0b26ad42ab
4 changed files with 57 additions and 21 deletions

View File

@ -144,6 +144,7 @@ PRODUCT_COPY_FILES += \
device/phh/treble/files/bv9500plus-mtk-kpd.kl:system/phh/bv9500plus-mtk-kpd.kl \
device/phh/treble/files/moto-liber-gpio-keys.kl:system/phh/moto-liber-gpio-keys.kl \
device/phh/treble/files/tecno-touchpanel.kl:system/phh/tecno-touchpanel.kl \
device/phh/treble/files/rosemary-excluded-input-devices.xml:system/phh/rosemary-excluded-input-devices.xml
SELINUX_IGNORE_NEVERALLOWS := true

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Copyright (c) 2018 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. -->
<devices>
<device name="uinput-fpc" />
<device name="uinput-goodix" />
</devices>

View File

@ -14,6 +14,17 @@ using namespace std::chrono_literals;
using namespace std::string_literals;
using android::fiemap::IImageManager;
std::string getNextSlot() {
std::string current_slot;
std::string next_slot = "a";
if(android::base::ReadFileToString("/metadata/phh/img", &current_slot) &&
current_slot.c_str()[0] == 'a') {
next_slot = "b";
}
return next_slot;
}
int main(int argc, char **argv) {
mkdir("/metadata/gsi/phh", 0771);
chown("/metadata/gsi/phh", 0, 1000);
@ -27,27 +38,13 @@ int main(int argc, char **argv) {
return 0;
}
if(argc>=2 && strcmp(argv[1], "switch-slot") == 0) {
std::string current_slot;
std::string next_slot;
if(!android::base::ReadFileToString("/metadata/phh/img", &current_slot)) {
next_slot = "a";
} else {
if(current_slot.c_str()[0] == 'a')
next_slot = "b";
}
std::string next_slot = getNextSlot();
mkdir("/metadata/phh", 0700);
android::base::WriteStringToFile(next_slot, "/metadata/phh/img");
return 0;
}
if(argc>=2 && strcmp(argv[1], "new-slot") == 0) {
std::string current_slot;
std::string next_slot;
if(!android::base::ReadFileToString("/metadata/phh/img", &current_slot)) {
next_slot = "a";
} else {
if(current_slot.c_str()[0] == 'a')
next_slot = "b";
}
std::string next_slot = getNextSlot();
std::string imageName = "system_otaphh_"s + next_slot;

View File

@ -147,7 +147,7 @@ changeKeylayout() {
fi
if getprop ro.vendor.build.fingerprint | grep -iq \
-e poco/ -e redmi/ -e xiaomi/ ; then
-e poco/ -e POCO/ -e redmi/ -e xiaomi/ ; then
if [ ! -f /mnt/phh/keylayout/uinput-goodix.kl ]; then
cp /system/phh/empty /mnt/phh/keylayout/uinput-goodix.kl
chmod 0644 /mnt/phh/keylayout/uinput-goodix.kl
@ -392,9 +392,9 @@ if getprop ro.vendor.build.fingerprint | grep -iq \
setprop persist.sys.qcom-brightness -1
fi
# Lenovo Z5s brightness flickers without this setting
# Lenovo Z5s & Xiaomi Mi10TLite brightness flickers without this setting
if getprop ro.vendor.build.fingerprint | grep -iq \
-e Lenovo/jd2019; then
-e Lenovo/jd2019 -e Xiaomi/gauguin -e Redmi/gauguin; then
setprop persist.sys.qcom-brightness -1
fi
@ -424,7 +424,7 @@ if getprop ro.vendor.build.fingerprint | grep -q -i \
-e xiaomi/nitrogen -e xiaomi/whyred -e xiaomi/platina \
-e xiaomi/ysl -e nubia/nx60 -e nubia/nx61 -e xiaomi/tulip \
-e xiaomi/lavender -e xiaomi/olive -e xiaomi/olivelite -e xiaomi/pine \
-e Redmi/lancelot -e Redmi/galahad; then
-e Redmi/lancelot -e Redmi/galahad -e POCO/evergreen; then
setprop persist.sys.qcom-brightness "$(cat /sys/class/leds/lcd-backlight/max_brightness)"
fi
@ -457,7 +457,7 @@ if getprop ro.vendor.build.fingerprint | grep -iq \
-e motorola/hannah -e motorola/james -e motorola/pettyl -e xiaomi/cepheus \
-e xiaomi/grus -e xiaomi/cereus -e xiaomi/cactus -e xiaomi/raphael -e xiaomi/davinci \
-e xiaomi/ginkgo -e xiaomi/willow -e xiaomi/laurel_sprout -e xiaomi/andromeda \
-e redmi/curtana -e redmi/picasso \
-e xiaomi/gauguin -e redmi/gauguin -e redmi/curtana -e redmi/picasso \
-e bq/Aquaris_M10 ; then
mount -o bind /mnt/phh/empty_dir /vendor/lib64/soundfx
mount -o bind /mnt/phh/empty_dir /vendor/lib/soundfx
@ -581,10 +581,17 @@ if getprop ro.vendor.build.fingerprint | grep -iq -e Redmi/merlin; then
setprop debug.sf.enable_hwc_vds 0
fi
if getprop ro.vendor.build.fingerprint | grep -iq -e Redmi/lancelot; then
setprop debug.sf.enable_hwc_vds 1
fi
if getprop ro.vendor.build.fingerprint | grep -iq -e Redmi/rosemary \
-e Redmi/secret -e Redmi/maltose; then
setprop debug.sf.latch_unsignaled 1
setprop debug.sf.enable_hwc_vds 0
# Exclude FP input devices
mount -o bind /system/phh/rosemary-excluded-input-devices.xml /system/etc/excluded-input-devices.xml
fi
if getprop ro.vendor.build.fingerprint | grep -iq -E -e 'huawei|honor' || getprop persist.sys.overlay.huawei | grep -iq -E -e 'true'; then