├── .github └── ISSUE_TEMPLATE │ ├── config.yml │ └── issue-template.md ├── pointer ├── hdpi │ └── hdpi.png ├── mdpi │ └── mdpi.png ├── xhdpi │ └── xhdpi.png └── xxhdpi │ └── xxhdpi.png ├── misc ├── wallpaper │ └── default_wallpaper.png ├── keymaker.sh └── gradle.sh ├── aosp.mk ├── apk ├── apps │ ├── TotalCommander │ │ └── Android.mk │ ├── VLC │ │ └── Android.mk │ ├── Firefox │ │ └── Android.mk │ └── OneNote │ │ └── Android.mk └── handheld_product.mk ├── apply-patches.sh ├── patches ├── trebledroid │ ├── platform_build │ │ ├── 0005-Include-vndk-v28-sepolicy-support.patch │ │ ├── 0004-build-Remove-llkd.patch │ │ ├── 0006-core-sysprop-Write-build-display-id-to-product-prop.patch │ │ ├── 0001-build-remove-emulator-crap-from-GSI.patch │ │ └── 0002-build-Bypass-vendor-calls.patch │ ├── platform_packages_modules_vndk │ │ └── 0001-Include-vndk-v28-apex.patch │ ├── platform_system_linkerconfig │ │ └── 0001-Disable-vndklite-handling.patch │ ├── platform_system_netd │ │ ├── 0004-Don-t-abort-in-case-of-cgroup-bpf-setup-fail-since-s.patch │ │ ├── 0003-Support-no-bpf-usecase.patch │ │ ├── 0001-Huawei-Kirin-960-accept-broken-rpfilter-match.patch │ │ └── 0002-Don-t-fail-on-FTP-conntracking-failing.patch │ ├── platform_system_vold │ │ ├── 0005-Every-voldmanaged-storage-is-adoptable.patch │ │ ├── 0003-Don-t-unmount-rw-system.sh-binds.patch │ │ ├── 0001-Allow-deletion-of-symlink.patch │ │ ├── 0002-Failing-to-create-facedata-shouldn-t-be-fatal.patch │ │ └── 0004-Exfat-can-be-mounted-with-exfat-kernel-fs-driver-or-.patch │ ├── platform_external_selinux │ │ ├── 0001-Increase-default-log_level-to-get-actual-selinux-err.patch │ │ ├── 0008-Improve-SELinux-policy-workaround-on-device-phh-treb.patch │ │ ├── 0010-Allow-conflict-on-fuseblk.patch │ │ ├── 0006-Allow-mismatches-of-exfat-genfscon.patch │ │ ├── 0009-Allow-sys-vm-watermark_scale_factor-conflict-seen-on.patch │ │ ├── 0005-if-service-is-rcs-accept-conflict.-Seen-on-Moto-E5.patch │ │ ├── 0004-Allow-devices-virtual-block-genfscon-conflict-seen-o.patch │ │ └── 0002-Revert-libsepol-Make-an-unknown-permission-an-error-.patch │ ├── platform_frameworks_base │ │ ├── 0009-Support-samsung-Pie-and-Q-light-hal.patch │ │ ├── 0038-Once-we-integrate-Samsung-Power-hal-in-libpowermanag.patch │ │ ├── 0012-HOME-deserves-to-wake-up-devices-just-as-well-as-bac.patch │ │ ├── 0003-Fix-env-empty-string-ANDROID_STORAGE.patch │ │ ├── 0016-Remove-useless-notification-about-console-service-be.patch │ │ ├── 0020-Fix-Wakelock-issue.patch │ │ ├── 0007-Show-APN-Settings-for-CDMA-carriers.patch │ │ ├── 0013-Some-devices-have-proximity-sensor-reporting-NaN-as-.patch │ │ ├── 0025-Allow-disabling-of-fingerprint-cleanups-needed-on-so.patch │ │ ├── 0004-Relax-requirement-for-visible-flag-to-sdcards.patch │ │ ├── 0036-Catch-NPE-in-SystemUI.patch │ │ ├── 0024-Revert-Switch-long-press-power-behavior-in-AOSP.patch │ │ ├── 0034-Restore-getSimStateForSlotIndex-in-SubscriptionManag.patch │ │ ├── 0011-Always-allow-overriding-the-number-of-work-profiles.patch │ │ ├── 0048-Fix-Xiaomi-custom-vendors-implementing-fingerprint-p.patch │ │ ├── 0028-SystemUI-Use-AVCProfileMain-for-screen-recorder.patch │ │ ├── 0019-TelephonyManager-add-API-annotations-for-setTelephon.patch │ │ ├── 0002-Fallback-to-stupid-autobrightness-if-brightness-valu.patch │ │ ├── 0047-Replace-strings-with-strings.patch │ │ ├── 0026-Dynamically-resize-boot-animation-to-match-screen-si.patch │ │ ├── 0014-Fix-brightness-range-not-being-complete-on-Samsung-d.patch │ │ ├── 0005-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch │ │ ├── 0001-Disable-vendor-mismatch-warning.patch │ │ ├── 0021-Automatically-detect-pick-up-sensor-so-that-an-overl.patch │ │ ├── 0008-Re-order-services-so-that-it-works-even-without-qtag.patch │ │ ├── 0044-Add-a-prop-to-use-linear-backlight-control.patch │ │ └── 0029-Set-old-fingerprint-sensors-to-security-strong.patch │ ├── platform_system_core │ │ ├── 0018-Add-vendor-firmware_mnt.-Moto-Razr-2019-look-for-fir.patch │ │ ├── 0022-fix-Nubia-6-series-custom-rc-action-prop-validation.patch │ │ ├── 0005-init-Do-not-start-console-service-when-debuggable.patch │ │ ├── 0019-Ignore-dm-verity-setup-issues.patch │ │ ├── 0021-Disable-project_quota-on-old-devices-but-new-enough-.patch │ │ ├── 0013-Let-system-override-adb-secure-props-so-we-dont-get-.patch │ │ ├── 0008-Ugly-but-secure-Set-dev-uinput-as-0666-to-fix-finger.patch │ │ ├── 0024-Keep-our-own-version-of-ro.logd.kernel.-We-do-want-l.patch │ │ ├── 0017-Disable-quotas-on-legacy-devices-with-encryption-dis.patch │ │ ├── 0009-Revert-Set-system-xbin-permissions-to-750.patch │ │ ├── 0025-Keep-capex-when-there-are-vendor-apexes.patch │ │ ├── 0004-Don-t-abandon-creating-property-tree-if-there-is-a-c.patch │ │ ├── 0011-fs_mgr-Keep-allowing-encryptable-fstab-flag.patch │ │ ├── 0023-HACK-Ignore-errors-when-setting-fscrypt-directory.-S.patch │ │ ├── 0006-Panic-into-recovery-rather-than-bootloader.patch │ │ ├── 0002-If-Vboot2-fails-fall-back-to-Vboot1.patch │ │ ├── 0001-Let-system-override-ro.apex.updatable.patch │ │ ├── 0020-Fix-support-for-devices-without-cgroupv2-support.patch │ │ ├── 0012-FDE-is-dead.-Fallback-FDE-to-no-encryption-and-FDE-F.patch │ │ ├── 0007-Detect-allowed-sdcard-options-based-on-vndk.patch │ │ ├── 0014-Allow-apex-on-5.0-kernels.-This-is-needed-because-on.patch │ │ └── 0026-When-setting-ro.apex.updatable-actually-set-the-valu.patch │ ├── platform_bootable_recovery │ │ └── 0001-Don-t-reboot-if-we-couldn-t-get-bootctrl.patch │ ├── platform_system_nfc │ │ └── 0001-Let-vendor-have-priority-over-NFC-config-file-rather.patch │ ├── platform_frameworks_native │ │ ├── 0003-unshared_oob-didn-t-exist-in-O-P-so-detect-its-suppo.patch │ │ ├── 0001-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch │ │ ├── 0006-MIUI13-devices-hide-their-vibrator-HAL-behind-non-de.patch │ │ ├── 0004-Remove-Samsung-system-permission-on-sensors.patch │ │ ├── 0005-Mark-accelerometer-input-as-sensor-exclusively-if-th.patch │ │ ├── 0010-Fix-loading-unnamed-GLES.patch │ │ └── 0002-Matching-an-input-with-a-display-uses-uniqueId.patch │ ├── platform_packages_modules_Connectivity │ │ ├── 0002-Dont-delete-UID-from-BpfMap-on-BPF-less-kernel.patch │ │ └── 0001-Allow-failing-to-load-bpf-programs-for-BPF-less-devi.patch │ ├── platform_system_bpf │ │ └── 0002-Revert-detect-inability-to-write-to-index-0-of-bpf-m.patch │ ├── platform_hardware_interfaces │ │ ├── 0003-Fix-crash-on-Samsung-S23-using-stock-properties-beca.patch │ │ ├── 0001-Add-a-vendor800-command-to-be-able-to-call-vendor-sp.patch │ │ └── 0002-Fix-light-sensor-crash-on-Xiaomi-13.patch │ ├── platform_frameworks_opt_net_ims │ │ └── 0001-Pie-MTK-IMS-calls-static-ImsManager.updateImsService.patch │ ├── platform_frameworks_opt_telephony │ │ ├── 0008-Fix-NPE-with-1.0-and-1.1-CardStatus.patch │ │ ├── 0003-Fix-baseband-being-too-long-to-fit-into-a-91-chars-p.patch │ │ ├── 0002-Telephony-Don-not-call-onUssdRelease-for-Huawei-RIL.patch │ │ ├── 0010-When-logging-UiccSlot-ignore-error-if-we-cant-print-.patch │ │ ├── 0006-telephony-forward-port-support-for-forceCognitive.patch │ │ └── 0004-Reintroduce-public-void-TelephonyMetrics.writeRilSen.patch │ ├── platform_packages_apps_Nfc │ │ └── 0001-Don-t-crash-when-there-is-no-VR-service.patch │ ├── platform_frameworks_av │ │ ├── 0016-Not-all-sources-in-a-route-are-valid.-Dont-ignore-th.patch │ │ ├── 0022-Add-a-prop-to-disable-AUDIO_OUTPUT_FLAG_FAST-from-au.patch │ │ ├── 0015-Don-t-crash-on-unknown-audio-devices.patch │ │ ├── 0012-No-longer-make-re-assigning-legacy-audio-groups-fata.patch │ │ ├── 0017-Use-a-fake-volume-policy-when-none-has-been-found.patch │ │ ├── 0010-Add-a-property-to-force-camera-timestamp-source.patch │ │ ├── 0023-Add-a-prop-to-fix-echo-on-incoming-or-outgoing-calls.patch │ │ ├── 0008-There-are-three-SCO-devices.-Fallback-from-one-to-th.patch │ │ ├── 0020-voip-Fix-high-pitched-voice-on-Qualcomm-devices.patch │ │ └── 0006-audiopolicy-try-again-with-trimmed-audio-port-name-i.patch │ ├── platform_bionic │ │ └── 0001-Disable-vndklite-handling.patch │ ├── platform_system_extras │ │ └── 0001-libfscrypt-Bail-out-if-we-can-t-open-directory.patch │ ├── platform_packages_modules_DeviceLock │ │ └── 0001-Don-t-crash-when-we-get-no-DeviceLockManager.patch │ ├── platform_packages_modules_Bluetooth │ │ ├── 0008-gd-hci-Ignore-command-READ_REMOTE_VERSION_INFORMATIO.patch │ │ ├── 0003-Add-option-to-change-eSCO-Transport-Unit-Size.patch │ │ ├── 0001-gd-hci-Ignore-unexpected-status-events.patch │ │ └── 0007-Add-a-property-to-cap-declared-le-vendor-version.-Fo.patch │ ├── platform_packages_apps_Settings │ │ ├── 0001-Act-as-usb-device-when-there-is-no-hal-but-we-believ.patch │ │ └── 0003-Don-t-crash-when-we-get-no-DeviceLockManager.patch │ └── platform_frameworks_libs_net │ │ └── 0001-Restore-back-the-behavior-of-isValid-It-is-legal-to-.patch └── personal │ ├── platform_build │ ├── 0001-Remove-su-from-vanilla-builds.patch │ ├── 0002-build-Always-use-release-keys.patch │ └── 0003-product-Exclude-AOSP-apn-list-on-custom-builds.patch │ ├── platform_packages_apps_Aperture │ ├── 0002-Make-Aperture-override-Camera2.patch │ └── 0001-Revert-Aperture-Inherit-aapt_version_code_defaults.patch │ ├── device_phh_treble │ └── 0001-Import-vendor-gapps.patch │ ├── platform_packages_apps_ThemePicker │ └── 0001-Make-ThemePicker-override-Live-Wallpapers-picker-too.patch │ ├── platform_packages_apps_Settings │ └── 0002-feat-Add-Face-Unlock-with-ParanoidSense-2-2.patch │ └── platform_frameworks_base │ ├── 0005-SystemUI-fix-SliceView-layout.patch │ ├── 0006-Add-android.permission.READ_PHONE_STATE-to-manifest.patch │ ├── 0003-monet-Use-Style.SPRITZ-by-default.patch │ └── 0002-gmscompat-Spoof-Pixel-XL-for-Google-Photos.patch └── manifest.xml /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /pointer/hdpi/hdpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tabletseeker/treble_build_aosp/HEAD/pointer/hdpi/hdpi.png -------------------------------------------------------------------------------- /pointer/mdpi/mdpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tabletseeker/treble_build_aosp/HEAD/pointer/mdpi/mdpi.png -------------------------------------------------------------------------------- /pointer/xhdpi/xhdpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tabletseeker/treble_build_aosp/HEAD/pointer/xhdpi/xhdpi.png -------------------------------------------------------------------------------- /pointer/xxhdpi/xxhdpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tabletseeker/treble_build_aosp/HEAD/pointer/xxhdpi/xxhdpi.png -------------------------------------------------------------------------------- /misc/wallpaper/default_wallpaper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tabletseeker/treble_build_aosp/HEAD/misc/wallpaper/default_wallpaper.png -------------------------------------------------------------------------------- /aosp.mk: -------------------------------------------------------------------------------- 1 | $(call inherit-product, vendor/ponces/config/common.mk) 2 | 3 | PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ 4 | ro.system.ota.json_url=https://raw.githubusercontent.com/ponces/treble_build_aosp/android-14.0/ota.json 5 | -------------------------------------------------------------------------------- /apk/apps/TotalCommander/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE_TAGS := optional 6 | 7 | LOCAL_MODULE := TotalCommander 8 | 9 | LOCAL_CERTIFICATE := testkey 10 | 11 | LOCAL_SRC_FILES := total_commander.apk 12 | 13 | LOCAL_MODULE_CLASS := APPS 14 | 15 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 16 | 17 | include $(BUILD_PREBUILT) 18 | -------------------------------------------------------------------------------- /apk/apps/VLC/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE_TAGS := optional 6 | 7 | LOCAL_MODULE := VLC 8 | 9 | LOCAL_CERTIFICATE := testkey 10 | 11 | LOCAL_SRC_FILES := vlc.apk 12 | 13 | LOCAL_MODULE_CLASS := APPS 14 | 15 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 16 | 17 | LOCAL_OPTIONAL_USES_LIBRARIES := androidx.window.extensions androidx.window.sidecar 18 | 19 | include $(BUILD_PREBUILT) 20 | -------------------------------------------------------------------------------- /apk/apps/Firefox/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE_TAGS := optional 6 | 7 | LOCAL_MODULE := Firefox 8 | 9 | LOCAL_CERTIFICATE := testkey 10 | 11 | LOCAL_SRC_FILES := firefox.apk 12 | 13 | LOCAL_MODULE_CLASS := APPS 14 | 15 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 16 | 17 | LOCAL_OPTIONAL_USES_LIBRARIES := androidx.window.extensions androidx.window.sidecar 18 | 19 | include $(BUILD_PREBUILT) 20 | -------------------------------------------------------------------------------- /apply-patches.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | patches="$(readlink -f -- $1)" 6 | tree="$2" 7 | 8 | for project in $(cd $patches/patches/$tree; echo *); do 9 | p="$(tr _ / <<<$project |sed -e 's;platform/;;g')" 10 | [ "$p" == build ] && p=build/make 11 | [ "$p" == treble/app ] && p=treble_app 12 | [ "$p" == vendor/hardware/overlay ] && p=vendor/hardware_overlay 13 | pushd $p &>/dev/null 14 | for patch in $patches/patches/$tree/$project/*.patch; do 15 | git am $patch || exit 16 | done 17 | popd &>/dev/null 18 | done 19 | -------------------------------------------------------------------------------- /apk/apps/OneNote/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE_TAGS := optional 6 | 7 | LOCAL_MODULE := OneNote 8 | 9 | LOCAL_CERTIFICATE := testkey 10 | 11 | LOCAL_SRC_FILES := onenote.apk 12 | 13 | LOCAL_MODULE_CLASS := APPS 14 | 15 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 16 | 17 | LOCAL_OPTIONAL_USES_LIBRARIES := com.sec.android.app.multiwindow org.apache.http.legacy android.test.base androidx.camera.extensions.impl androidx.window.extensions androidx.window.sidecar 18 | 19 | include $(BUILD_PREBUILT) 20 | -------------------------------------------------------------------------------- /misc/keymaker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | KEYS="$PWD/build/make/target/product/security" 4 | 5 | echo -e "\n Creating new signing keys and deleting old..." 6 | 7 | for x in ls "$KEYS"/* 8 | 9 | do 10 | if echo "$x" | grep -Eq "releasekey|testkey|platform|shared|media|networkstack";then 11 | 12 | rm -f "$x" 13 | 14 | fi 15 | 16 | done 17 | 18 | subject='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com' 19 | 20 | for x in releasekey testkey platform shared media networkstack; do \ 21 | 22 | ./development/tools/make_key "$KEYS"/$x "$subject"; \ 23 | 24 | done 25 | 26 | -------------------------------------------------------------------------------- /misc/gradle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | JAVA_DIR=$(ls /usr/lib/jvm | grep -Em1 java-[0-9]{2}-openjdk) 6 | 7 | export PATH=/usr/lib/jvm/$JAVA_DIR/bin:$PATH 8 | export JAVA_HOME=/usr/lib/jvm/$JAVA_DIR 9 | export ANDROID_HOME=$PWD/sdk 10 | export ANDROID_SDK_ROOT=$PWD/sdk 11 | 12 | gradleTarget=assembleDebug 13 | target=debug 14 | file=app-debug 15 | if [ "$1" == "release" ];then 16 | gradleTarget=assembleRelease 17 | target=release 18 | file=app-release-unsigned 19 | fi 20 | ./gradlew $gradleTarget 21 | LD_LIBRARY_PATH=./signapk/ java -jar signapk/signapk.jar keys/platform.x509.pem keys/platform.pk8 ./app/build/outputs/apk/$target/${file}.apk TrebleApp.apk 22 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_build/0005-Include-vndk-v28-sepolicy-support.patch: -------------------------------------------------------------------------------- 1 | From 7759fa2f27faa175deeb71341ba7671a2a908b3f Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 6 Oct 2023 19:11:22 -0400 4 | Subject: [PATCH 5/6] Include vndk v28 sepolicy support 5 | 6 | --- 7 | core/config.mk | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/core/config.mk b/core/config.mk 11 | index 0c086ee0907..6006a5e8f5f 100644 12 | --- a/core/config.mk 13 | +++ b/core/config.mk 14 | @@ -911,6 +911,7 @@ endif 15 | 16 | # A list of SEPolicy versions, besides PLATFORM_SEPOLICY_VERSION, that the framework supports. 17 | PLATFORM_SEPOLICY_COMPAT_VERSIONS := \ 18 | + 28.0 \ 19 | 29.0 \ 20 | 30.0 \ 21 | 31.0 \ 22 | -- 23 | 2.34.1 24 | 25 | -------------------------------------------------------------------------------- /patches/personal/platform_build/0001-Remove-su-from-vanilla-builds.patch: -------------------------------------------------------------------------------- 1 | From 011e1fc84acc2f69449394e38f2e82aef767a17d Mon Sep 17 00:00:00 2001 2 | From: Victor Bo 3 | Date: Sat, 14 Dec 2019 23:46:34 +0200 4 | Subject: [PATCH 1/3] Remove su from vanilla builds 5 | 6 | --- 7 | target/product/base_system.mk | 1 - 8 | 1 file changed, 1 deletion(-) 9 | 10 | diff --git a/target/product/base_system.mk b/target/product/base_system.mk 11 | index 0096f23b3d..e59c65d67d 100644 12 | --- a/target/product/base_system.mk 13 | +++ b/target/product/base_system.mk 14 | @@ -403,7 +403,6 @@ PRODUCT_PACKAGES_DEBUG := \ 15 | ss \ 16 | start_with_lockagent \ 17 | strace \ 18 | - su \ 19 | sanitizer-status \ 20 | tracepath \ 21 | tracepath6 \ 22 | -- 23 | 2.34.1 24 | 25 | -------------------------------------------------------------------------------- /patches/personal/platform_packages_apps_Aperture/0002-Make-Aperture-override-Camera2.patch: -------------------------------------------------------------------------------- 1 | From f7729cb1393eec47a4af2b939066a8527cc2a440 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Mon, 30 Oct 2023 22:49:09 +0000 4 | Subject: [PATCH 2/2] Make Aperture override Camera2 5 | 6 | --- 7 | app/Android.bp | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/app/Android.bp b/app/Android.bp 11 | index f3d9d59..fae6671 100644 12 | --- a/app/Android.bp 13 | +++ b/app/Android.bp 14 | @@ -13,6 +13,7 @@ android_app { 15 | srcs: ["src/main/java/**/*.kt"], 16 | resource_dirs: ["src/main/res"], 17 | manifest: "src/main/AndroidManifest.xml", 18 | + overrides: ["Camera2"], 19 | 20 | sdk_version: "33", 21 | product_specific: true, 22 | -- 23 | 2.34.1 24 | 25 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_vndk/0001-Include-vndk-v28-apex.patch: -------------------------------------------------------------------------------- 1 | From 5e4d928f55dda5b8b3f6ba56f8f8e20fd0b514ea Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 6 Oct 2023 05:18:39 -0400 4 | Subject: [PATCH] Include vndk v28 apex 5 | 6 | Change-Id: I5689074542f13e136e5bc1292afec2a8288f9e1c 7 | --- 8 | apex/Android.bp | 6 ++++++ 9 | 1 file changed, 6 insertions(+) 10 | 11 | diff --git a/apex/Android.bp b/apex/Android.bp 12 | index da5d4b7..2989ebd 100644 13 | --- a/apex/Android.bp 14 | +++ b/apex/Android.bp 15 | @@ -82,3 +82,9 @@ apex_vndk { 16 | system_ext_specific: true, 17 | } 18 | 19 | +apex_vndk { 20 | + name: "com.android.vndk.v28", 21 | + defaults: ["vndk-apex-defaults"], 22 | + vndk_version: "28", 23 | + system_ext_specific: true, 24 | +} 25 | -- 26 | 2.34.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_linkerconfig/0001-Disable-vndklite-handling.patch: -------------------------------------------------------------------------------- 1 | From 20667b3e57d4edef357435b7eecd62edcb81f7de Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 27 Oct 2021 14:40:26 -0400 4 | Subject: [PATCH] Disable vndklite handling 5 | 6 | Change-Id: I4a132512471a68891f2efb59539267c35a3c3e56 7 | --- 8 | modules/environment.cc | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/modules/environment.cc b/modules/environment.cc 12 | index 82801f32..e05341b7 100644 13 | --- a/modules/environment.cc 14 | +++ b/modules/environment.cc 15 | @@ -29,7 +29,7 @@ bool IsLegacyDevice() { 16 | } 17 | 18 | bool IsVndkLiteDevice() { 19 | - return Variables::GetValue("ro.vndk.lite").value_or("") == "true"; 20 | + return false; 21 | } 22 | 23 | bool IsVndkInSystemNamespace() { 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/personal/device_phh_treble/0001-Import-vendor-gapps.patch: -------------------------------------------------------------------------------- 1 | From 990e22c107d7144f41c83b39a6e48f2f89248e10 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Tue, 21 Feb 2023 22:51:12 +0000 4 | Subject: [PATCH 1/2] Import vendor/gapps 5 | 6 | --- 7 | generate.sh | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/generate.sh b/generate.sh 11 | index 9c20eb5..8fbb16b 100644 12 | --- a/generate.sh 13 | +++ b/generate.sh 14 | @@ -26,7 +26,7 @@ for part in a ab;do 15 | optional_base="" 16 | if [ "$apps" == "gapps" ];then 17 | apps_suffix="g" 18 | - apps_script='$(call inherit-product, device/phh/treble/gapps.mk)' 19 | + apps_script='$(call inherit-product, vendor/gapps/common/common-vendor.mk)' 20 | apps_name="with GApps" 21 | fi 22 | if [ "$apps" == "gapps-go" ];then 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_netd/0004-Don-t-abort-in-case-of-cgroup-bpf-setup-fail-since-s.patch: -------------------------------------------------------------------------------- 1 | From 1ff7b31f5766eec7c7f067be7be3f0da99052785 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 26 Oct 2022 18:13:56 -0400 4 | Subject: [PATCH 4/4] Don't abort in case of cgroup/bpf setup fail, since some 5 | devices dont have BPF 6 | 7 | --- 8 | server/main.cpp | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/server/main.cpp b/server/main.cpp 12 | index 3c6b0d52e..89bf4e9e4 100644 13 | --- a/server/main.cpp 14 | +++ b/server/main.cpp 15 | @@ -147,7 +147,7 @@ int main() { 16 | 17 | if (libnetd_updatable_init(cg2_path.c_str())) { 18 | ALOGE("libnetd_updatable_init failed"); 19 | - exit(1); 20 | + //exit(1); 21 | } 22 | gLog.info("libnetd_updatable_init success"); 23 | 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_build/0004-build-Remove-llkd.patch: -------------------------------------------------------------------------------- 1 | From a6f9ae921a33a393ca1003c4dbf8e8986b753e94 Mon Sep 17 00:00:00 2001 2 | From: Andy CrossGate Yan 3 | Date: Thu, 14 Oct 2021 12:20:52 +0000 4 | Subject: [PATCH 4/6] build: Remove llkd 5 | 6 | ...until someone figures out why Genshin Impact fails it 7 | 8 | Change-Id: I29384a820a0c07b29d3f11d7039bed40eeaee926 9 | --- 10 | target/product/base_system.mk | 1 - 11 | 1 file changed, 1 deletion(-) 12 | 13 | diff --git a/target/product/base_system.mk b/target/product/base_system.mk 14 | index a3f5ab34703..0096f23b3d2 100644 15 | --- a/target/product/base_system.mk 16 | +++ b/target/product/base_system.mk 17 | @@ -208,7 +208,6 @@ PRODUCT_PACKAGES += \ 18 | libvulkan \ 19 | libwilhelm \ 20 | linker \ 21 | - llkd \ 22 | lmkd \ 23 | LocalTransport \ 24 | locksettings \ 25 | -- 26 | 2.34.1 27 | 28 | -------------------------------------------------------------------------------- /patches/personal/platform_packages_apps_ThemePicker/0001-Make-ThemePicker-override-Live-Wallpapers-picker-too.patch: -------------------------------------------------------------------------------- 1 | From 8c4999ed9a060e690e51cbc4ee464026c04a2aa8 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Fri, 10 Nov 2023 00:58:32 +0000 4 | Subject: [PATCH] Make ThemePicker override Live Wallpapers picker too 5 | 6 | --- 7 | Android.bp | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/Android.bp b/Android.bp 11 | index 9de3ae18..979b2e8a 100644 12 | --- a/Android.bp 13 | +++ b/Android.bp 14 | @@ -127,5 +127,5 @@ android_app { 15 | platform_apis: true, 16 | manifest: "AndroidManifest.xml", 17 | additional_manifests: [":WallpaperPicker2_Manifest"], 18 | - overrides: ["WallpaperCropper", "WallpaperPicker", "WallpaperPicker2"], 19 | + overrides: ["LiveWallpapersPicker", "WallpaperCropper", "WallpaperPicker", "WallpaperPicker2"], 20 | } 21 | -- 22 | 2.34.1 23 | 24 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_vold/0005-Every-voldmanaged-storage-is-adoptable.patch: -------------------------------------------------------------------------------- 1 | From 07b070326d6d1e91f4ce005e7ab656e8ca16be2a Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 11 Mar 2020 14:02:35 +0100 4 | Subject: [PATCH 5/5] Every voldmanaged storage is adoptable 5 | 6 | --- 7 | main.cpp | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/main.cpp b/main.cpp 11 | index 078ee14b..475060dc 100644 12 | --- a/main.cpp 13 | +++ b/main.cpp 14 | @@ -269,7 +269,7 @@ static int process_config(VolumeManager* vm, VoldConfigs* configs) { 15 | std::string nickname(entry.label); 16 | int flags = 0; 17 | 18 | - if (entry.is_encryptable()) { 19 | + if (entry.is_encryptable() || true) { 20 | flags |= android::vold::Disk::Flags::kAdoptable; 21 | configs->has_adoptable = true; 22 | } 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0001-Increase-default-log_level-to-get-actual-selinux-err.patch: -------------------------------------------------------------------------------- 1 | From 64cf79e704435ac07f5a35422be1a5a782ebfa81 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 9 Apr 2018 00:19:49 +0200 4 | Subject: [PATCH 01/10] Increase default log_level to get actual selinux error 5 | in kmsg 6 | 7 | --- 8 | secilc/secilc.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/secilc/secilc.c b/secilc/secilc.c 12 | index 80d3583d7..a51630b2c 100644 13 | --- a/secilc/secilc.c 14 | +++ b/secilc/secilc.c 15 | @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) 16 | int opt_index = 0; 17 | char *fc_buf = NULL; 18 | size_t fc_size; 19 | - enum cil_log_level log_level = CIL_ERR; 20 | + enum cil_log_level log_level = CIL_WARN; 21 | static struct option long_opts[] = { 22 | {"help", no_argument, 0, 'h'}, 23 | {"verbose", no_argument, 0, 'v'}, 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_vold/0003-Don-t-unmount-rw-system.sh-binds.patch: -------------------------------------------------------------------------------- 1 | From a3a276b58ccd0a3526c4b7fb7c1cee8285fa3685 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 29 Nov 2021 17:49:13 -0500 4 | Subject: [PATCH 3/5] Don't unmount rw-system.sh binds 5 | 6 | Change-Id: If9132c21defa8b09879b79a70794c5275d6852d0 7 | --- 8 | VolumeManager.cpp | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/VolumeManager.cpp b/VolumeManager.cpp 12 | index dc6fae98..47c8cd40 100644 13 | --- a/VolumeManager.cpp 14 | +++ b/VolumeManager.cpp 15 | @@ -985,6 +985,7 @@ int VolumeManager::unmountAll() { 16 | while ((mentry = getmntent(fp)) != NULL) { 17 | auto test = std::string(mentry->mnt_dir); 18 | if ((StartsWith(test, "/mnt/") && 19 | + !StartsWith(test, "/mnt/phh") && 20 | #ifdef __ANDROID_DEBUGGABLE__ 21 | !StartsWith(test, "/mnt/scratch") && 22 | #endif 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_vold/0001-Allow-deletion-of-symlink.patch: -------------------------------------------------------------------------------- 1 | From b00fbfc470c6f91224429178bc24c30f9146af05 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 17 Feb 2018 19:39:38 +0100 4 | Subject: [PATCH 1/5] Allow deletion of symlink 5 | 6 | Change-Id: I9731895f88729072297f753088583aabbe6990f4 7 | --- 8 | FsCrypt.cpp | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/FsCrypt.cpp b/FsCrypt.cpp 12 | index 903d36bf..74e6ad1d 100644 13 | --- a/FsCrypt.cpp 14 | +++ b/FsCrypt.cpp 15 | @@ -351,6 +351,7 @@ static bool prepare_dir_with_policy(const std::string& dir, mode_t mode, uid_t u 16 | static bool destroy_dir(const std::string& dir) { 17 | LOG(DEBUG) << "Destroying: " << dir; 18 | if (rmdir(dir.c_str()) != 0 && errno != ENOENT) { 19 | + if(unlink(dir.c_str()) == 0) return true; 20 | PLOG(ERROR) << "Failed to destroy " << dir; 21 | return false; 22 | } 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0009-Support-samsung-Pie-and-Q-light-hal.patch: -------------------------------------------------------------------------------- 1 | From bc35e297b51c8c480ebb177e94dbb9d1f6f91e9d Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 24 Mar 2019 23:05:14 +0100 4 | Subject: [PATCH 09/49] Support samsung Pie and Q light hal 5 | 6 | Change-Id: I01f94acd7d0672733e48854d80368f9ac6f861c6 7 | --- 8 | services/core/jni/Android.bp | 2 ++ 9 | 1 file changed, 2 insertions(+) 10 | 11 | diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp 12 | index 77db96001e0c..36c13ca121e3 100644 13 | --- a/services/core/jni/Android.bp 14 | +++ b/services/core/jni/Android.bp 15 | @@ -202,6 +202,8 @@ cc_defaults { 16 | "android.system.suspend-V1-ndk", 17 | "server_configurable_flags", 18 | "service.incremental", 19 | + "vendor.samsung.hardware.light@2.0", 20 | + "vendor.samsung.hardware.light@3.0", 21 | ], 22 | 23 | static_libs: [ 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0018-Add-vendor-firmware_mnt.-Moto-Razr-2019-look-for-fir.patch: -------------------------------------------------------------------------------- 1 | From cf2b10c83b9d1f8d1575a2330b042f6b22cf3a35 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 11 Jul 2023 14:52:40 -0400 4 | Subject: [PATCH 18/26] Add /vendor/firmware_mnt. Moto Razr 2019 look for 5 | firmwares (modem, sensors, ...) there 6 | 7 | --- 8 | rootdir/ueventd.rc | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc 12 | index e06e453b11..0af6948f8d 100644 13 | --- a/rootdir/ueventd.rc 14 | +++ b/rootdir/ueventd.rc 15 | @@ -1,7 +1,7 @@ 16 | import /vendor/etc/ueventd.rc 17 | import /odm/etc/ueventd.rc 18 | 19 | -firmware_directories /etc/firmware/ /odm/firmware/ /vendor/firmware/ /firmware/image/ 20 | +firmware_directories /etc/firmware/ /odm/firmware/ /vendor/firmware/ /firmware/image/ /vendor/firmware_mnt/image/ 21 | uevent_socket_rcvbuf_size 16M 22 | 23 | subsystem graphics 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0022-fix-Nubia-6-series-custom-rc-action-prop-validation.patch: -------------------------------------------------------------------------------- 1 | From 843dc1cfa90d542b85bc9da204e4e91af6803476 Mon Sep 17 00:00:00 2001 2 | From: Huy Hoang <38396158+boydaihungst@users.noreply.github.com> 3 | Date: Thu, 19 Oct 2023 07:06:55 +0700 4 | Subject: [PATCH 22/26] fix: Nubia 6 series custom rc action prop validation 5 | 6 | --- 7 | init/action_parser.cpp | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/init/action_parser.cpp b/init/action_parser.cpp 11 | index 49fe24a436..f683790e99 100644 12 | --- a/init/action_parser.cpp 13 | +++ b/init/action_parser.cpp 14 | @@ -47,6 +47,7 @@ bool IsActionableProperty(Subcontext* subcontext, const std::string& prop_name) 15 | "init.svc.vendor.", "ro.vendor.", "persist.vendor.", 16 | "vendor.", "init.svc.odm.", "ro.odm.", 17 | "persist.odm.", "odm.", "ro.boot.", 18 | + "nubia.perf." 19 | }; 20 | 21 | for (const auto& prefix : kPartnerPrefixes) { 22 | -- 23 | 2.34.1 24 | 25 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_netd/0003-Support-no-bpf-usecase.patch: -------------------------------------------------------------------------------- 1 | From 1bf386d291c7a5ecc00c77dfb89f28c27104d9ec Mon Sep 17 00:00:00 2001 2 | From: ChonDoit 3 | Date: Fri, 7 Oct 2022 02:43:21 +0000 4 | Subject: [PATCH 3/4] Support no-bpf usecase 5 | 6 | Change-Id: Ic759e2cfaf11705169a4a6b677b0e5aca26907b3 7 | --- 8 | server/Controllers.cpp | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/server/Controllers.cpp b/server/Controllers.cpp 12 | index 43a2d1ee3..35e2b890d 100644 13 | --- a/server/Controllers.cpp 14 | +++ b/server/Controllers.cpp 15 | @@ -284,7 +284,7 @@ void Controllers::init() { 16 | // As such simply exit netd. This may crash loop the system, but by failing 17 | // to bootup we will trigger rollback and thus this offers us protection against 18 | // a mainline update breaking things. 19 | - exit(1); 20 | + // exit(1); 21 | } 22 | gLog.info("Enabling bandwidth control: %" PRId64 "us", s.getTimeAndResetUs()); 23 | 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_bootable_recovery/0001-Don-t-reboot-if-we-couldn-t-get-bootctrl.patch: -------------------------------------------------------------------------------- 1 | From 9805c3d5fd0f23b9d914ef66243d65d9c7a99e4d Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 12 Sep 2019 20:31:07 +0200 4 | Subject: [PATCH] Don't reboot if we couldn't get bootctrl 5 | 6 | Change-Id: Id1793660bd1c97ab369607f58a772ca3512ec1af 7 | --- 8 | update_verifier/update_verifier.cpp | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp 12 | index a0160e2fc..24d6ccab2 100644 13 | --- a/update_verifier/update_verifier.cpp 14 | +++ b/update_verifier/update_verifier.cpp 15 | @@ -324,7 +324,7 @@ int update_verifier(int argc, char** argv) { 16 | const auto module = android::hal::BootControlClient::WaitForService(); 17 | if (module == nullptr) { 18 | LOG(ERROR) << "Error getting bootctrl module."; 19 | - return reboot_device(); 20 | + return 0; 21 | } 22 | 23 | uint32_t current_slot = module->GetCurrentSlot(); 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0038-Once-we-integrate-Samsung-Power-hal-in-libpowermanag.patch: -------------------------------------------------------------------------------- 1 | From 22274999ff186a6fb021aa8cb9cf42bbb727e2ac Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 27 Dec 2021 17:57:11 -0500 4 | Subject: [PATCH 38/49] Once we integrate Samsung Power hal in libpowermanager, 5 | libpowermanager and its deps require linking against 6 | vendor.samsung.hardware.miscpower@2.0 7 | 8 | Change-Id: I9084f64e505009abe9420d28b44199605cee52d8 9 | --- 10 | services/core/jni/Android.bp | 1 + 11 | 1 file changed, 1 insertion(+) 12 | 13 | diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp 14 | index 36c13ca121e3..00e9cfa998b9 100644 15 | --- a/services/core/jni/Android.bp 16 | +++ b/services/core/jni/Android.bp 17 | @@ -204,6 +204,7 @@ cc_defaults { 18 | "service.incremental", 19 | "vendor.samsung.hardware.light@2.0", 20 | "vendor.samsung.hardware.light@3.0", 21 | + "vendor.samsung.hardware.miscpower@2.0", 22 | ], 23 | 24 | static_libs: [ 25 | -- 26 | 2.34.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0008-Improve-SELinux-policy-workaround-on-device-phh-treb.patch: -------------------------------------------------------------------------------- 1 | From 6a69271d74ca04fc4edb55a82a910e3210ddafbd Mon Sep 17 00:00:00 2001 2 | From: ponces 3 | Date: Mon, 7 Nov 2022 16:14:20 +0000 4 | Subject: [PATCH 08/10] Improve SELinux policy workaround on device/phh/treble 5 | conflict to exit with SEPOL_OK instead of SEPOL_EEXIST 6 | 7 | This fixes boot on many Samsung devices as exiting with SEPOL_EEXIST will prevent them to boot 8 | --- 9 | libsepol/cil/src/cil_build_ast.c | 1 - 10 | 1 file changed, 1 deletion(-) 11 | 12 | diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c 13 | index 77e130d1e..daf8b8b30 100644 14 | --- a/libsepol/cil/src/cil_build_ast.c 15 | +++ b/libsepol/cil/src/cil_build_ast.c 16 | @@ -141,7 +141,6 @@ int cil_add_decl_to_symtab(struct cil_db *db, symtab_t *symtab, hashtab_key_t ke 17 | /* multiple_decls is enabled and works for this datum type, add node */ 18 | cil_list_append(prev->nodes, CIL_NODE, node); 19 | node->data = prev; 20 | - return SEPOL_EEXIST; 21 | } 22 | 23 | return SEPOL_OK; 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0010-Allow-conflict-on-fuseblk.patch: -------------------------------------------------------------------------------- 1 | From b85e5400f0d5c46ffe96fb4b40e3c22509a40c17 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 6 Oct 2023 08:49:59 -0400 4 | Subject: [PATCH 10/10] Allow conflict on fuseblk 5 | 6 | --- 7 | libsepol/cil/src/cil_post.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c 11 | index 1703b3b6d..5428005d6 100644 12 | --- a/libsepol/cil/src/cil_post.c 13 | +++ b/libsepol/cil/src/cil_post.c 14 | @@ -511,7 +511,7 @@ static int cil_post_genfscon_context_compare(const void *a, const void *b) 15 | */ 16 | if(strcmp(a_genfscon->path_str, "/sys/vm/watermark_scale_factor") == 0) 17 | bypass = 1; 18 | - if(strcmp(a_genfscon->fs_str, "exfat") == 0 || strcmp(a_genfscon->fs_str, "esdfs") == 0) { 19 | + if(strcmp(a_genfscon->fs_str, "exfat") == 0 || strcmp(a_genfscon->fs_str, "esdfs") == 0 || strcmp(a_genfscon->fs_str, "fuseblk") == 0) { 20 | if(strcmp(a_genfscon->path_str, "/") == 0) 21 | bypass = 1; 22 | } 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0012-HOME-deserves-to-wake-up-devices-just-as-well-as-bac.patch: -------------------------------------------------------------------------------- 1 | From aeec01e72ba463385a0e3929a033ec930ed38837 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 6 Jun 2020 18:21:56 +0200 4 | Subject: [PATCH 12/49] HOME deserves to wake-up devices just as well as back 5 | and menu 6 | 7 | Change-Id: Ia562bafd8c620d00c17e8eb338e4701c6c4a3c3a 8 | --- 9 | core/java/android/view/KeyEvent.java | 1 + 10 | 1 file changed, 1 insertion(+) 11 | 12 | diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java 13 | index 858da554c670..df9b4d938061 100644 14 | --- a/core/java/android/view/KeyEvent.java 15 | +++ b/core/java/android/view/KeyEvent.java 16 | @@ -2061,6 +2061,7 @@ public class KeyEvent extends InputEvent implements Parcelable { 17 | switch (keyCode) { 18 | case KeyEvent.KEYCODE_CAMERA: 19 | case KeyEvent.KEYCODE_MENU: 20 | + case KeyEvent.KEYCODE_HOME: 21 | case KeyEvent.KEYCODE_PAIRING: 22 | case KeyEvent.KEYCODE_STEM_1: 23 | case KeyEvent.KEYCODE_STEM_2: 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/personal/platform_build/0002-build-Always-use-release-keys.patch: -------------------------------------------------------------------------------- 1 | From 934caf7429259ee32d036c7251eba28a4c12ca98 Mon Sep 17 00:00:00 2001 2 | From: Pranav Vashi 3 | Date: Sat, 16 Oct 2021 00:12:03 +0530 4 | Subject: [PATCH 2/3] build: Always use release-keys 5 | 6 | Change-Id: Iff4d88d6bd4c7f4f6b9270dea24a2673c8535d9e 7 | --- 8 | core/sysprop.mk | 6 +----- 9 | 1 file changed, 1 insertion(+), 5 deletions(-) 10 | 11 | diff --git a/core/sysprop.mk b/core/sysprop.mk 12 | index 4adec48daa..fbe2f30a6f 100644 13 | --- a/core/sysprop.mk 14 | +++ b/core/sysprop.mk 15 | @@ -175,11 +175,7 @@ endif 16 | # non-default dev keys (usually private keys from a vendor directory). 17 | # Both of these tags will be removed and replaced with "release-keys" 18 | # when the target-files is signed in a post-build step. 19 | -ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey) 20 | -BUILD_KEYS := test-keys 21 | -else 22 | -BUILD_KEYS := dev-keys 23 | -endif 24 | +BUILD_KEYS := release-keys 25 | BUILD_VERSION_TAGS += $(BUILD_KEYS) 26 | BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) 27 | 28 | -- 29 | 2.34.1 30 | 31 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0006-Allow-mismatches-of-exfat-genfscon.patch: -------------------------------------------------------------------------------- 1 | From 7aea91b1e670f545cb86167e1b1473b84af29eac Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 24 May 2020 17:22:22 +0200 4 | Subject: [PATCH 06/10] Allow mismatches of exfat genfscon 5 | 6 | --- 7 | libsepol/cil/src/cil_post.c | 4 ++++ 8 | 1 file changed, 4 insertions(+) 9 | 10 | diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c 11 | index 99410da07..7f614c039 100644 12 | --- a/libsepol/cil/src/cil_post.c 13 | +++ b/libsepol/cil/src/cil_post.c 14 | @@ -502,6 +502,10 @@ static int cil_post_genfscon_context_compare(const void *a, const void *b) 15 | */ 16 | if(strcmp(a_genfscon->path_str, "/devices/virtual/block/") == 0) 17 | bypass = 1; 18 | + if(strcmp(a_genfscon->fs_str, "exfat") == 0 || strcmp(a_genfscon->fs_str, "esdfs") == 0) { 19 | + if(strcmp(a_genfscon->path_str, "/") == 0) 20 | + bypass = 1; 21 | + } 22 | if(bypass == 1) { 23 | fprintf(stderr, "Received conflicting %s vs %s but ignore\n", a_genfscon->path_str, b_genfscon->path_str); 24 | return 0; 25 | -- 26 | 2.34.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_nfc/0001-Let-vendor-have-priority-over-NFC-config-file-rather.patch: -------------------------------------------------------------------------------- 1 | From d1ebd2dbb8e521c7dcff2c4ca42c4e4044c28c6a Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 21 Dec 2020 19:36:54 +0100 4 | Subject: [PATCH] Let vendor have priority over NFC config file, rather than 5 | GSI 6 | 7 | Thanks @mikalovtch 8 | 9 | Change-Id: Iaee468f3b8e5c8ec90ca7e856a6526d1cbcaa33e 10 | --- 11 | src/adaptation/nfc_config.cc | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/src/adaptation/nfc_config.cc b/src/adaptation/nfc_config.cc 15 | index f635fd502..15d42cabf 100644 16 | --- a/src/adaptation/nfc_config.cc 17 | +++ b/src/adaptation/nfc_config.cc 18 | @@ -30,7 +30,7 @@ using namespace ::android::base; 19 | namespace { 20 | std::string searchConfigPath(std::string file_name) { 21 | const std::vector search_path = { 22 | - "/product/etc/", "/odm/etc/", "/vendor/etc/", "/system_ext/etc/", "/etc/", 23 | + "/odm/etc/", "/vendor/etc/", "/product/etc/", "/system_ext/etc/", "/etc/", 24 | }; 25 | for (std::string path : search_path) { 26 | path.append(file_name); 27 | -- 28 | 2.34.1 29 | 30 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0005-init-Do-not-start-console-service-when-debuggable.patch: -------------------------------------------------------------------------------- 1 | From 4e0416f52dfa470ad732fcb2ab3822c5ab7844b2 Mon Sep 17 00:00:00 2001 2 | From: Isaac Chen 3 | Date: Wed, 23 Jun 2021 13:07:30 +0800 4 | Subject: [PATCH 05/26] init: Do not start console service when debuggable 5 | 6 | Google added a check for this in R, when it's running it will show a 7 | notification about that performance is impacted. 8 | 9 | Signed-off-by: Isaac Chen 10 | Change-Id: I34cfd6b42d3b9aee4b3e63181480cfb8b1255f29 11 | --- 12 | rootdir/init.rc | 3 --- 13 | 1 file changed, 3 deletions(-) 14 | 15 | diff --git a/rootdir/init.rc b/rootdir/init.rc 16 | index 7da264611d..8b037bc9aa 100644 17 | --- a/rootdir/init.rc 18 | +++ b/rootdir/init.rc 19 | @@ -1312,9 +1312,6 @@ on property:ro.debuggable=1 20 | # Give reads to anyone for the accessibility trace folder on debug builds. 21 | chmod 0775 /data/misc/a11ytrace 22 | 23 | -on init && property:ro.debuggable=1 24 | - start console 25 | - 26 | on userspace-reboot-requested 27 | # TODO(b/135984674): reset all necessary properties here. 28 | setprop sys.boot_completed "" 29 | -- 30 | 2.34.1 31 | 32 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_build/0006-core-sysprop-Write-build-display-id-to-product-prop.patch: -------------------------------------------------------------------------------- 1 | From db0055ea5bd43b2dba9e0f8b3c359edb7bb75d0f Mon Sep 17 00:00:00 2001 2 | From: Adithya R 3 | Date: Thu, 18 Aug 2022 21:29:34 +0530 4 | Subject: [PATCH 6/6] core: sysprop: Write build display id to product prop 5 | 6 | Some vendors override build id in odm or vendor, such as oplus. 7 | 8 | Change-Id: I1c2de43ba7c3544710897ad9127d320dd02293fe 9 | --- 10 | core/sysprop.mk | 3 +++ 11 | 1 file changed, 3 insertions(+) 12 | 13 | diff --git a/core/sysprop.mk b/core/sysprop.mk 14 | index 44af367a38d..4adec48daa7 100644 15 | --- a/core/sysprop.mk 16 | +++ b/core/sysprop.mk 17 | @@ -76,6 +76,9 @@ define generate-common-build-props 18 | echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\ 19 | )\ 20 | )\ 21 | + $(if $(filter product,$(1)),\ 22 | + echo "ro.build.display.id=$(BUILD_DISPLAY_ID)" >> $(2);\ 23 | + )\ 24 | echo "ro.$(1).build.date=`$(DATE_FROM_FILE)`" >> $(2);\ 25 | echo "ro.$(1).build.date.utc=`$(DATE_FROM_FILE) +%s`" >> $(2);\ 26 | echo "ro.$(1).build.fingerprint=$(BUILD_FINGERPRINT_FROM_FILE)" >> $(2);\ 27 | -- 28 | 2.34.1 29 | 30 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0003-Fix-env-empty-string-ANDROID_STORAGE.patch: -------------------------------------------------------------------------------- 1 | From c3160e818a5b8f6421ca40f8c8db61e1a2661fc4 Mon Sep 17 00:00:00 2001 2 | From: Raphael Mounier 3 | Date: Sat, 6 Aug 2022 18:08:36 +0200 4 | Subject: [PATCH 03/49] Fix env empty string - ANDROID_STORAGE 5 | 6 | Huawei hi6250 define in init.hi6250.rc ANDROID_STORAGE to "", so check empty string and replace with default path. Apply change for all env directory 7 | --- 8 | core/java/android/os/Environment.java | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java 12 | index 536ef31f334a..bebab95189d7 100644 13 | --- a/core/java/android/os/Environment.java 14 | +++ b/core/java/android/os/Environment.java 15 | @@ -1523,7 +1523,7 @@ public class Environment { 16 | 17 | static File getDirectory(String variableName, String defaultPath) { 18 | String path = System.getenv(variableName); 19 | - return path == null ? new File(defaultPath) : new File(path); 20 | + return ((path == null || path.isEmpty()) ? new File(defaultPath) : new File(path)); 21 | } 22 | 23 | @NonNull 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0003-unshared_oob-didn-t-exist-in-O-P-so-detect-its-suppo.patch: -------------------------------------------------------------------------------- 1 | From 0f7242588c227f161b9a030482da0ffb741b8270 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 5 Jan 2021 23:44:00 +0100 4 | Subject: [PATCH 03/10] unshared_oob didn't exist in O/P, so detect its 5 | supported based on vndk version 6 | 7 | --- 8 | cmds/installd/migrate_legacy_obb_data.sh | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/cmds/installd/migrate_legacy_obb_data.sh b/cmds/installd/migrate_legacy_obb_data.sh 12 | index 7399681c3e..9d5b73eae2 100644 13 | --- a/cmds/installd/migrate_legacy_obb_data.sh 14 | +++ b/cmds/installd/migrate_legacy_obb_data.sh 15 | @@ -18,7 +18,7 @@ 16 | rm -rf /data/media/0/Android/obb/test_probe 17 | mkdir -p /data/media/0/Android/obb/ 18 | touch /data/media/0/Android/obb/test_probe 19 | -if ! test -f /data/media/0/Android/obb/test_probe ; then 20 | +if ! test -f /data/media/0/Android/obb/test_probe || [ "$(adb shell getprop ro.vndk.version)" -le 28 ]; then 21 | log -p i -t migrate_legacy_obb_data "No support for 'unshared_obb'. Not migrating" 22 | rm -rf /data/media/0/Android/obb/test_probe 23 | exit 0 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/personal/platform_packages_apps_Settings/0002-feat-Add-Face-Unlock-with-ParanoidSense-2-2.patch: -------------------------------------------------------------------------------- 1 | From a75ccf6a43fb8557bb52a743daca83de1ba69562 Mon Sep 17 00:00:00 2001 2 | From: Chris Crump 3 | Date: Fri, 17 Mar 2023 20:48:46 +0100 4 | Subject: [PATCH 2/2] feat: Add Face Unlock with ParanoidSense (2/2) 5 | 6 | Based on AOSPA's implementation and adapted by @ghostrider-reborn 7 | 8 | Co-authored-by: Chris Crump 9 | Co-authored-by: Adithya R 10 | Change-Id: I05fa784d9f7f978be9f5944900a97ad7df19f59e 11 | --- 12 | AndroidManifest.xml | 2 +- 13 | 1 file changed, 1 insertion(+), 1 deletion(-) 14 | 15 | diff --git a/AndroidManifest.xml b/AndroidManifest.xml 16 | index 6689645aa8..e1ed24f790 100644 17 | --- a/AndroidManifest.xml 18 | +++ b/AndroidManifest.xml 19 | @@ -2488,7 +2488,7 @@ 20 | android:screenOrientation="portrait"/> 21 | 22 | 26 | 27 | 3 | Date: Tue, 12 Oct 2021 14:32:52 +0300 4 | Subject: [PATCH 1/6] build: remove emulator crap from GSI 5 | 6 | Change-Id: Id45f3ff1d31e3d4492f956e68a1eb4b2fb82ce63 7 | --- 8 | target/product/emulator_vendor.mk | 6 +++--- 9 | 1 file changed, 3 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk 12 | index f71b275b0e2..62984253f31 100644 13 | --- a/target/product/emulator_vendor.mk 14 | +++ b/target/product/emulator_vendor.mk 15 | @@ -28,7 +28,7 @@ PRODUCT_PACKAGES += \ 16 | 17 | DEVICE_PACKAGE_OVERLAYS := device/generic/goldfish/overlay 18 | 19 | -PRODUCT_CHARACTERISTICS := emulator 20 | +# PRODUCT_CHARACTERISTICS := emulator 21 | 22 | PRODUCT_FULL_TREBLE_OVERRIDE := true 23 | 24 | @@ -48,5 +48,5 @@ PRODUCT_SYSTEM_EXT_PROPERTIES += \ 25 | ro.com.google.locationfeatures=1 26 | 27 | # disable setupwizard 28 | -PRODUCT_SYSTEM_EXT_PROPERTIES += \ 29 | - ro.setupwizard.mode?=DISABLED 30 | +# PRODUCT_SYSTEM_EXT_PROPERTIES += \ 31 | +# ro.setupwizard.mode?=DISABLED 32 | -- 33 | 2.34.1 34 | 35 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_Connectivity/0002-Dont-delete-UID-from-BpfMap-on-BPF-less-kernel.patch: -------------------------------------------------------------------------------- 1 | From 872277e89874d3abce6ffb940276b3ac04e25584 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 26 Oct 2022 18:11:10 -0400 4 | Subject: [PATCH 2/4] Dont delete UID from BpfMap on BPF-less kernel 5 | 6 | Change-Id: I93b5b8237f6655cb47e0b0584c54cad73a51e7b2 7 | --- 8 | service-t/src/com/android/server/net/NetworkStatsService.java | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/service-t/src/com/android/server/net/NetworkStatsService.java b/service-t/src/com/android/server/net/NetworkStatsService.java 12 | index f977a2724c..877f351b5f 100644 13 | --- a/service-t/src/com/android/server/net/NetworkStatsService.java 14 | +++ b/service-t/src/com/android/server/net/NetworkStatsService.java 15 | @@ -2498,6 +2498,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { 16 | * @param uid 17 | */ 18 | private void deleteKernelTagData(int uid) { 19 | + if(mCookieTagMap == null) return; 20 | try { 21 | mCookieTagMap.forEach((key, value) -> { 22 | // If SkDestroyListener deletes the socket tag while this code is running, 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0019-Ignore-dm-verity-setup-issues.patch: -------------------------------------------------------------------------------- 1 | From 6789bc4f38dabd9810588ab7621cbdcbaeca0c1a Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 6 Oct 2023 08:20:48 -0400 4 | Subject: [PATCH 19/26] Ignore dm-verity setup issues 5 | 6 | On Amlogic STB Android 9 vendor, no boot device is setup 7 | (fstab doesn't use /dev/block/by-name but more direct mappings) 8 | that means that libavb can't access the partition by-name, thus failing 9 | to read vbmeta & co, and thus failing setting up dm-verity. 10 | 11 | We don't care much about dm-verity so let's just ignore this 12 | --- 13 | init/first_stage_mount.cpp | 1 - 14 | 1 file changed, 1 deletion(-) 15 | 16 | diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp 17 | index 1fc981719c..d0e00b3164 100644 18 | --- a/init/first_stage_mount.cpp 19 | +++ b/init/first_stage_mount.cpp 20 | @@ -438,7 +438,6 @@ bool FirstStageMount::MountPartition(const Fstab::iterator& begin, bool erase_sa 21 | } 22 | if (!SetUpDmVerity(&(*begin))) { 23 | PLOG(ERROR) << "Failed to setup verity for '" << begin->mount_point << "'"; 24 | - return false; 25 | } 26 | 27 | bool mounted = (fs_mgr_do_mount_one(*begin) == 0); 28 | -- 29 | 2.34.1 30 | 31 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_netd/0001-Huawei-Kirin-960-accept-broken-rpfilter-match.patch: -------------------------------------------------------------------------------- 1 | From 91ab1ef92af5fcfceddab678c1d2d8d7965f6247 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 2 Jul 2018 22:01:43 +0200 4 | Subject: [PATCH 1/4] Huawei Kirin 960:: accept broken rpfilter match 5 | 6 | How bad a security flaw is this? 7 | People lived with rpfilter on IPv4 for a very long time... 8 | 9 | Change-Id: I9aa63d18e54a8254133adf97bf757c03d6b66757 10 | --- 11 | server/TetherController.cpp | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/server/TetherController.cpp b/server/TetherController.cpp 15 | index 791935746..d867cea4a 100644 16 | --- a/server/TetherController.cpp 17 | +++ b/server/TetherController.cpp 18 | @@ -718,7 +718,7 @@ int TetherController::setForwardRules(bool add, const char *intIface, const char 19 | "*raw\n" 20 | "%s %s -i %s -m rpfilter --invert ! -s fe80::/64 -j DROP\n" 21 | "COMMIT\n", op, LOCAL_RAW_PREROUTING, intIface); 22 | - if (iptablesRestoreFunction(V6, rpfilterCmd, nullptr) == -1 && add) { 23 | + if (iptablesRestoreFunction(V6, rpfilterCmd, nullptr) == -1 && add && false) { 24 | return -EREMOTEIO; 25 | } 26 | 27 | -- 28 | 2.34.1 29 | 30 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0016-Remove-useless-notification-about-console-service-be.patch: -------------------------------------------------------------------------------- 1 | From bd0f7d8b3bf18442a82595137c3ed00806fb36fc Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 11 Dec 2020 14:41:09 +0100 4 | Subject: [PATCH 16/49] Remove useless notification about "console" service 5 | being running 6 | 7 | --- 8 | .../core/java/com/android/server/am/ActivityManagerService.java | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java 12 | index 4dad2d560526..5d1f27ac923d 100644 13 | --- a/services/core/java/com/android/server/am/ActivityManagerService.java 14 | +++ b/services/core/java/com/android/server/am/ActivityManagerService.java 15 | @@ -5156,7 +5156,7 @@ public class ActivityManagerService extends IActivityManager.Stub 16 | } 17 | 18 | private void showConsoleNotificationIfActive() { 19 | - if (!SystemProperties.get("init.svc.console").equals("running")) { 20 | + if (!SystemProperties.get("init.svc.console").equals("running") || true) { 21 | return; 22 | } 23 | String title = mContext 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0021-Disable-project_quota-on-old-devices-but-new-enough-.patch: -------------------------------------------------------------------------------- 1 | From 5c247a1eabc40fdefa0009cc3001b104e41b669b Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 6 Oct 2023 19:01:27 -0400 4 | Subject: [PATCH 21/26] Disable project_quota on old devices but new enough to 5 | have encryption (they do keep quota support) 6 | 7 | --- 8 | fs_mgr/fs_mgr.cpp | 8 ++++++++ 9 | 1 file changed, 8 insertions(+) 10 | 11 | diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp 12 | index 2b8dbd46cf..285ea21fdf 100644 13 | --- a/fs_mgr/fs_mgr.cpp 14 | +++ b/fs_mgr/fs_mgr.cpp 15 | @@ -385,6 +385,14 @@ static void tune_quota(const std::string& blk_device, const FstabEntry& entry, 16 | want_quota = false; 17 | } 18 | 19 | + struct utsname uts; 20 | + unsigned int major, minor; 21 | + 22 | + if ((uname(&uts) == 0) && (sscanf(uts.release, "%u.%u", &major, &minor) == 2)) { 23 | + if(major < 4) want_projid = false; 24 | + if(major == 4 && minor < 9) want_projid = false; 25 | + } 26 | + 27 | if (!tune2fs_available()) { 28 | LERROR << "Unable to " << (want_quota ? "enable" : "disable") << " quotas on " << blk_device 29 | << " because " TUNE2FS_BIN " is missing"; 30 | -- 31 | 2.34.1 32 | 33 | -------------------------------------------------------------------------------- /patches/personal/platform_frameworks_base/0005-SystemUI-fix-SliceView-layout.patch: -------------------------------------------------------------------------------- 1 | From 88d9585714431967d0c4d7fe177cf65b6cbe9648 Mon Sep 17 00:00:00 2001 2 | From: Anay Wadhera 3 | Date: Sun, 13 Nov 2022 10:42:03 -0500 4 | Subject: [PATCH 5/9] SystemUI: fix SliceView layout 5 | 6 | Before: https://imgur.com/a/wIwyMJS 7 | After: https://imgur.com/a/dJPVMxS 8 | 9 | Change-Id: Ib5fb2e3b9c0f3948bc3e88c2333df816bde265f8 10 | --- 11 | packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml 15 | index 7c5dbc247428..64657547621f 100644 16 | --- a/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml 17 | +++ b/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml 18 | @@ -38,7 +38,7 @@ 19 | android:id="@+id/row" 20 | android:layout_width="match_parent" 21 | android:layout_height="wrap_content" 22 | - android:orientation="horizontal" 23 | + android:orientation="vertical" 24 | android:gravity="start" 25 | /> 26 | 27 | -- 28 | 2.34.1 29 | 30 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0001-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch: -------------------------------------------------------------------------------- 1 | From ce6a013b02770fad97b07dec97c800ec800f1fc1 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 14 Aug 2019 23:37:10 +0200 4 | Subject: [PATCH 01/10] On Samsung, we need to send a hack-message to HAL to 5 | get all Sensors 6 | 7 | Change-Id: Id6a1fa48340de61c418493668e9abd22c2599376 8 | --- 9 | services/sensorservice/SensorDevice.cpp | 3 +++ 10 | 1 file changed, 3 insertions(+) 11 | 12 | diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp 13 | index 10ca990f87..e603f6d404 100644 14 | --- a/services/sensorservice/SensorDevice.cpp 15 | +++ b/services/sensorservice/SensorDevice.cpp 16 | @@ -38,6 +38,7 @@ 17 | #include 18 | #include 19 | 20 | +#include 21 | using namespace android::hardware::sensors; 22 | using android::util::ProtoOutputStream; 23 | 24 | @@ -76,6 +77,8 @@ SensorDevice::SensorDevice() { 25 | } 26 | 27 | void SensorDevice::initializeSensorList() { 28 | + if(::android::base::GetBoolProperty("persist.sys.phh.samsung_sensors", false)) 29 | + setMode(5555); 30 | if (mHalWrapper == nullptr) { 31 | return; 32 | } 33 | -- 34 | 2.34.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_build/0002-build-Bypass-vendor-calls.patch: -------------------------------------------------------------------------------- 1 | From 4474122b2faff5edc08822a05da594cb53cd4853 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Mon, 18 Oct 2021 17:20:18 +0100 4 | Subject: [PATCH 2/6] build: Bypass vendor calls 5 | 6 | Change-Id: I69830d6264356dadd7b037553a899a4eb3d211f1 7 | --- 8 | target/product/aosp_arm64.mk | 6 +++--- 9 | 1 file changed, 3 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk 12 | index 6c907db0edd..0adced1672e 100644 13 | --- a/target/product/aosp_arm64.mk 14 | +++ b/target/product/aosp_arm64.mk 15 | @@ -54,9 +54,9 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) 16 | # 17 | # All components inherited here go to vendor or vendor_boot image 18 | # 19 | -$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk) 20 | -$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk) 21 | -$(call inherit-product, $(SRC_TARGET_DIR)/product/non_ab_device.mk) 22 | +#$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk) 23 | +#$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk) 24 | +#$(call inherit-product, $(SRC_TARGET_DIR)/product/non_ab_device.mk) 25 | 26 | # 27 | # Special settings for GSI releasing 28 | -- 29 | 2.34.1 30 | 31 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0013-Let-system-override-adb-secure-props-so-we-dont-get-.patch: -------------------------------------------------------------------------------- 1 | From 8f6312e63faa7fecbfbd1e8d3c3776ed387a9f95 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 9 Dec 2022 13:57:10 -0500 4 | Subject: [PATCH 13/26] Let system override adb/secure props, so we dont get 5 | stuck in ro.adb.secure=1 vendors 6 | 7 | --- 8 | init/property_service.cpp | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/init/property_service.cpp b/init/property_service.cpp 12 | index 545c25e26f..da69dbe69e 100644 13 | --- a/init/property_service.cpp 14 | +++ b/init/property_service.cpp 15 | @@ -787,7 +787,7 @@ static void LoadProperties(char* data, const char* filter, const char* filename, 16 | } else if (it->second != value) { 17 | LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second 18 | << "' with new value '" << value << "'"; 19 | - if(strcmp("ro.apex.updatable", key) == 0) { 20 | + if(strcmp("ro.apex.updatable", key) == 0 || strstr(key, "adb") || strstr(key, "secure")) { 21 | LOG(WARNING) << "... Ignored"; 22 | } else { 23 | it->second = value; 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/personal/platform_frameworks_base/0006-Add-android.permission.READ_PHONE_STATE-to-manifest.patch: -------------------------------------------------------------------------------- 1 | From 375113fb8d0fd551b407793531812708068627f6 Mon Sep 17 00:00:00 2001 2 | From: Janson Kang 3 | Date: Mon, 14 Dec 2015 11:13:24 +0800 4 | Subject: [PATCH 6/9] Add "android.permission.READ_PHONE_STATE" to manifest 5 | 6 | Change-Id: I78d90166635bbdf6b74e2a02efc1029387b4ad8d 7 | --- 8 | packages/SystemUI/AndroidManifest.xml | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml 12 | index 4fd47232a0df..6bb7b2549237 100644 13 | --- a/packages/SystemUI/AndroidManifest.xml 14 | +++ b/packages/SystemUI/AndroidManifest.xml 15 | @@ -68,6 +68,7 @@ 16 | 17 | 18 | 19 | + 20 | 21 | 22 | 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0020-Fix-Wakelock-issue.patch: -------------------------------------------------------------------------------- 1 | From 714901b7425d2e22d6ca2db55f879dc0ff8f5f9f Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Tue, 2 Feb 2021 10:20:51 +0000 4 | Subject: [PATCH 20/49] Fix Wakelock issue 5 | 6 | Prevent SystemUI crash due to "WakeLock under-locked Doze" (issue #12) by only releasing a wakelock that was not already released 7 | --- 8 | .../src/com/android/systemui/util/wakelock/WakeLock.java | 4 +++- 9 | 1 file changed, 3 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java b/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java 12 | index 6128feee8116..b60905b39e32 100644 13 | --- a/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java 14 | +++ b/packages/SystemUI/src/com/android/systemui/util/wakelock/WakeLock.java 15 | @@ -143,7 +143,9 @@ public interface WakeLock { 16 | if (logger != null) { 17 | logger.logRelease(inner, why, count); 18 | } 19 | - inner.release(); 20 | + if (inner.isHeld()) { 21 | + inner.release(); 22 | + } 23 | } 24 | 25 | /** @see PowerManager.WakeLock#wrap(Runnable) */ 26 | -- 27 | 2.34.1 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_bpf/0002-Revert-detect-inability-to-write-to-index-0-of-bpf-m.patch: -------------------------------------------------------------------------------- 1 | From 9804c2fc6ce2930c1bd372a3493deb60115ae60c Mon Sep 17 00:00:00 2001 2 | From: Andy CrossGate Yan 3 | Date: Wed, 19 Oct 2022 02:20:05 +0000 4 | Subject: [PATCH 2/2] Revert "detect inability to write to index != 0 of bpf 5 | map array" 6 | 7 | This reverts commit ead9d83423877458023056f6ccf9390950d6726f. 8 | --- 9 | bpfloader/BpfLoader.cpp | 9 --------- 10 | 1 file changed, 9 deletions(-) 11 | 12 | diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp 13 | index 158dca62..0af23c92 100644 14 | --- a/bpfloader/BpfLoader.cpp 15 | +++ b/bpfloader/BpfLoader.cpp 16 | @@ -306,15 +306,6 @@ int main(int argc, char** argv) { 17 | } 18 | } 19 | 20 | - int key = 1; 21 | - int value = 123; 22 | - android::base::unique_fd map( 23 | - android::bpf::createMap(BPF_MAP_TYPE_ARRAY, sizeof(key), sizeof(value), 2, 0)); 24 | - if (android::bpf::writeToMapEntry(map, &key, &value, BPF_ANY)) { 25 | - ALOGE("Critical kernel bug - failure to write into index 1 of 2 element bpf map array."); 26 | - return 1; 27 | - } 28 | - 29 | if (android::base::SetProperty("bpf.progs_loaded", "1") == false) { 30 | ALOGE("Failed to set bpf.progs_loaded property"); 31 | return 1; 32 | -- 33 | 2.34.1 34 | 35 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_hardware_interfaces/0003-Fix-crash-on-Samsung-S23-using-stock-properties-beca.patch: -------------------------------------------------------------------------------- 1 | From 70e2131690533463ea51b8d9c3beb52c3f33c7c1 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 24 Oct 2023 04:59:57 -0400 4 | Subject: [PATCH 3/3] Fix crash on Samsung S23 using stock properties, because 5 | of sensor reporting vec3 instead of scalar. Likely the device orientation 6 | sensor 7 | 8 | --- 9 | sensors/aidl/convert/convert.cpp | 3 +++ 10 | 1 file changed, 3 insertions(+) 11 | 12 | diff --git a/sensors/aidl/convert/convert.cpp b/sensors/aidl/convert/convert.cpp 13 | index be3833dfa7..c56b30475c 100644 14 | --- a/sensors/aidl/convert/convert.cpp 15 | +++ b/sensors/aidl/convert/convert.cpp 16 | @@ -167,6 +167,9 @@ void convertToSensorEvent(const Event& src, sensors_event_t* dst) { 17 | auto dstr = ::android::internal::ToString(d); 18 | // ALOGE("Received 6DOF for expected scalar %s", dstr.c_str()); 19 | dst->data[0] = d.values[0]; 20 | + } else if (src.payload.getTag() == Event::EventPayload::vec3) { 21 | + auto d = src.payload.get(); 22 | + dst->data[0] = d.x; 23 | } else { 24 | dst->data[0] = src.payload.get(); 25 | } 26 | -- 27 | 2.34.1 28 | 29 | -------------------------------------------------------------------------------- /patches/personal/platform_packages_apps_Aperture/0001-Revert-Aperture-Inherit-aapt_version_code_defaults.patch: -------------------------------------------------------------------------------- 1 | From 44409cb178cb56012885c80ee7b4ee5325874a7e Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Fri, 20 Oct 2023 23:36:20 +0000 4 | Subject: [PATCH 1/2] Revert "Aperture: Inherit aapt_version_code_defaults" 5 | 6 | This reverts commit aca4ae5c172a8ab8f3e0079da3c4d583db12b078. 7 | --- 8 | app/Android.bp | 2 -- 9 | lens_launcher/Android.bp | 2 -- 10 | 2 files changed, 4 deletions(-) 11 | 12 | diff --git a/app/Android.bp b/app/Android.bp 13 | index d0925ff..f3d9d59 100644 14 | --- a/app/Android.bp 15 | +++ b/app/Android.bp 16 | @@ -10,8 +10,6 @@ package { 17 | android_app { 18 | name: "Aperture", 19 | 20 | - defaults: ["aapt_version_code_defaults"], 21 | - 22 | srcs: ["src/main/java/**/*.kt"], 23 | resource_dirs: ["src/main/res"], 24 | manifest: "src/main/AndroidManifest.xml", 25 | diff --git a/lens_launcher/Android.bp b/lens_launcher/Android.bp 26 | index 54e5307..5c50f9c 100644 27 | --- a/lens_launcher/Android.bp 28 | +++ b/lens_launcher/Android.bp 29 | @@ -10,8 +10,6 @@ package { 30 | android_app { 31 | name: "ApertureLensLauncher", 32 | 33 | - defaults: ["aapt_version_code_defaults"], 34 | - 35 | srcs: ["src/main/java/**/*.kt"], 36 | manifest: "src/main/AndroidManifest.xml", 37 | 38 | -- 39 | 2.34.1 40 | 41 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_opt_net_ims/0001-Pie-MTK-IMS-calls-static-ImsManager.updateImsService.patch: -------------------------------------------------------------------------------- 1 | From 671ea085bf35f02d76e16131404a32a41b9eb23e Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 14 Nov 2021 13:47:29 -0500 4 | Subject: [PATCH] Pie MTK IMS calls static 5 | ImsManager.updateImsServiceConfig(Context,int,boolean). Bring it back 6 | 7 | Change-Id: I3dd66d436629d37c8ec795df6569736195ae570e 8 | --- 9 | src/java/com/android/ims/ImsManager.java | 8 ++++++++ 10 | 1 file changed, 8 insertions(+) 11 | 12 | diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java 13 | index b5a1168b..547a3a16 100644 14 | --- a/src/java/com/android/ims/ImsManager.java 15 | +++ b/src/java/com/android/ims/ImsManager.java 16 | @@ -1666,6 +1666,14 @@ public class ImsManager implements FeatureUpdates { 17 | } 18 | } 19 | 20 | + public static void updateImsServiceConfig(Context context, int phoneId, boolean force) { 21 | + ImsManager mgr = ImsManager.getInstance(context, phoneId); 22 | + if (mgr != null) { 23 | + mgr.updateImsServiceConfig(); 24 | + } 25 | + Rlog.e(TAG, "updateImsServiceConfig: ImsManager null, returning without update."); 26 | + } 27 | + 28 | /** 29 | * Push configuration updates to the ImsService implementation. 30 | */ 31 | -- 32 | 2.34.1 33 | 34 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0008-Ugly-but-secure-Set-dev-uinput-as-0666-to-fix-finger.patch: -------------------------------------------------------------------------------- 1 | From 0c91ef369620b4ef4ff7ccbd1a8eec5623b3ce55 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 1 Nov 2019 18:22:13 +0100 4 | Subject: [PATCH 08/26] Ugly but secure: Set /dev/uinput as 0666 to fix 5 | fingerprint sensor on some devices 6 | 7 | cf https://github.com/phhusson/device_phh_treble/pull/122/commits/e000d69c286b6686777ea6f1867f379e30273e48 8 | This is safe because even though it's 0666, its SELinux policy is very 9 | tight, and only bluetooth HAL, shell (and fingerprint HAL on Xiaomi) can 10 | access it. 11 | 12 | Change-Id: Id374e781957927d5604cb96c7a39b3fb28b3a6c5 13 | --- 14 | rootdir/ueventd.rc | 2 +- 15 | 1 file changed, 1 insertion(+), 1 deletion(-) 16 | 17 | diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc 18 | index 0b7ffb8ea6..e06e453b11 100644 19 | --- a/rootdir/ueventd.rc 20 | +++ b/rootdir/ueventd.rc 21 | @@ -54,7 +54,7 @@ subsystem dma_heap 22 | 23 | # these should not be world writable 24 | /dev/uhid 0660 uhid uhid 25 | -/dev/uinput 0660 uhid uhid 26 | +/dev/uinput 0666 uhid uhid 27 | /dev/rtc0 0640 system system 28 | /dev/tty0 0660 root system 29 | /dev/graphics/* 0660 root graphics 30 | -- 31 | 2.34.1 32 | 33 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0024-Keep-our-own-version-of-ro.logd.kernel.-We-do-want-l.patch: -------------------------------------------------------------------------------- 1 | From db552f69e88ef7fefd434601421cf9adfcbce081 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 25 Nov 2023 09:51:14 -0500 4 | Subject: [PATCH 24/26] Keep our own version of ro.logd.kernel. We do want 5 | logcat -b kernel, unlike what OEM set from their vendor 6 | 7 | --- 8 | init/property_service.cpp | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/init/property_service.cpp b/init/property_service.cpp 12 | index a1993c8224..eb87675828 100644 13 | --- a/init/property_service.cpp 14 | +++ b/init/property_service.cpp 15 | @@ -800,7 +800,7 @@ static void LoadProperties(char* data, const char* filter, const char* filename, 16 | << "' with new value '" << value << "'"; 17 | if(strcmp("ro.apex.updatable", key) == 0 && !kernel_supports_capex()) { 18 | LOG(WARNING) << "... Ignored apex by kernel version"; 19 | - } else if(strstr(key, "adb") || strstr(key, "secure")) { 20 | + } else if(strstr(key, "adb") || strstr(key, "secure") || strstr(key, "ro.logd.kernel")) { 21 | LOG(WARNING) << "... Ignored"; 22 | } else { 23 | it->second = value; 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_opt_telephony/0008-Fix-NPE-with-1.0-and-1.1-CardStatus.patch: -------------------------------------------------------------------------------- 1 | From 1b8794951b91612a5628d759302aff0cb84660db Mon Sep 17 00:00:00 2001 2 | From: Christian Hoffmann 3 | Date: Fri, 21 Oct 2022 12:58:04 +0200 4 | Subject: [PATCH 08/11] Fix NPE with 1.0 and 1.1 CardStatus 5 | 6 | Change-Id: I965f6ef419b7aef828da02f5d4745bd33d09fe3a 7 | --- 8 | src/java/com/android/internal/telephony/RadioResponse.java | 2 ++ 9 | 1 file changed, 2 insertions(+) 10 | 11 | diff --git a/src/java/com/android/internal/telephony/RadioResponse.java b/src/java/com/android/internal/telephony/RadioResponse.java 12 | index 0bc29583fb..71bb2e5b75 100644 13 | --- a/src/java/com/android/internal/telephony/RadioResponse.java 14 | +++ b/src/java/com/android/internal/telephony/RadioResponse.java 15 | @@ -1879,6 +1879,8 @@ public class RadioResponse extends IRadioResponse.Stub { 16 | 17 | if (rr != null) { 18 | IccCardStatus iccCardStatus = RILUtils.convertHalCardStatus(cardStatus); 19 | + IccSlotPortMapping slotPortMapping = new IccSlotPortMapping(); 20 | + iccCardStatus.mSlotPortMapping = slotPortMapping; 21 | mRil.riljLog("responseIccCardStatus: from HIDL: " + iccCardStatus); 22 | if (responseInfo.error == RadioError.NONE) { 23 | sendMessageResponse(rr.mResult, iccCardStatus); 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_apps_Nfc/0001-Don-t-crash-when-there-is-no-VR-service.patch: -------------------------------------------------------------------------------- 1 | From 979358640c18f464b9ab0254734c7c2d7b91789c Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 20 Oct 2023 13:02:43 -0400 4 | Subject: [PATCH] Don't crash when there is no VR service 5 | 6 | Change-Id: I02d672f9a2688df7b1abf16377634fdcf4132511 7 | --- 8 | src/com/android/nfc/NfcService.java | 6 +++++- 9 | 1 file changed, 5 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java 12 | index 662112a08..d3e9d2d16 100644 13 | --- a/src/com/android/nfc/NfcService.java 14 | +++ b/src/com/android/nfc/NfcService.java 15 | @@ -572,7 +572,11 @@ public class NfcService implements DeviceHostListener, ForegroundUtils.Callback 16 | mActivityManager = mContext.getSystemService(ActivityManager.class); 17 | mVibrator = mContext.getSystemService(Vibrator.class); 18 | mVibrationEffect = VibrationEffect.createOneShot(200, VibrationEffect.DEFAULT_AMPLITUDE); 19 | - mVrManager = mContext.getSystemService(VrManager.class); 20 | + try { 21 | + mVrManager = mContext.getSystemService(VrManager.class); 22 | + } catch(Throwable t) { 23 | + mVrManager = null; 24 | + } 25 | 26 | mScreenState = mScreenStateHelper.checkScreenState(); 27 | 28 | -- 29 | 2.34.1 30 | 31 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_hardware_interfaces/0001-Add-a-vendor800-command-to-be-able-to-call-vendor-sp.patch: -------------------------------------------------------------------------------- 1 | From a89b84cd737b85a5e71bf64d4ee979cecbf40600 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 19 Dec 2021 17:03:15 -0500 4 | Subject: [PATCH 1/3] Add a vendor800 command, to be able to call 5 | vendor-specific hwc functions 6 | 7 | Change-Id: Icbef1e9e3a331ae3bd5a05687d545851d94d88a8 8 | --- 9 | .../composer-command-buffer/2.1/ComposerCommandBuffer.h | 6 ++++++ 10 | 1 file changed, 6 insertions(+) 11 | 12 | diff --git a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h 13 | index 499d3b96e3..489578468f 100644 14 | --- a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h 15 | +++ b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h 16 | @@ -402,6 +402,12 @@ class CommandWriterBase { 17 | endCommand(); 18 | } 19 | 20 | + void vendor800_1(uint32_t val) { 21 | + beginCommand(0x800 << 16, 1); 22 | + write(val); 23 | + endCommand(); 24 | + } 25 | + 26 | protected: 27 | template 28 | void beginCommand(T command, uint16_t length) { 29 | -- 30 | 2.34.1 31 | 32 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0017-Disable-quotas-on-legacy-devices-with-encryption-dis.patch: -------------------------------------------------------------------------------- 1 | From 0f084a20a69ff3b30c1a6d7af02e2ee823ee7144 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 6 Jun 2023 16:17:11 +0100 4 | Subject: [PATCH 17/26] Disable quotas on legacy devices with encryption 5 | disabled 6 | 7 | Source: https://t.me/phhtreblebuilders/20521 and https://t.me/phhtreblebuilders/20546 8 | --- 9 | fs_mgr/fs_mgr.cpp | 7 +++++++ 10 | 1 file changed, 7 insertions(+) 11 | 12 | diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp 13 | index e5dbaf32cb..2b8dbd46cf 100644 14 | --- a/fs_mgr/fs_mgr.cpp 15 | +++ b/fs_mgr/fs_mgr.cpp 16 | @@ -378,6 +378,13 @@ static void tune_quota(const std::string& blk_device, const FstabEntry& entry, 17 | return; 18 | } 19 | 20 | + // There is no relation between quotas and encryption disabled, it's just that encryption 21 | + // being disabled shows that the device is pretty old, so quotas might be broken on it 22 | + if (!entry.fs_mgr_flags.file_encryption) { 23 | + LINFO << "Disabling quotas on legacy devices with encryption disabled"; 24 | + want_quota = false; 25 | + } 26 | + 27 | if (!tune2fs_available()) { 28 | LERROR << "Unable to " << (want_quota ? "enable" : "disable") << " quotas on " << blk_device 29 | << " because " TUNE2FS_BIN " is missing"; 30 | -- 31 | 2.34.1 32 | 33 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0007-Show-APN-Settings-for-CDMA-carriers.patch: -------------------------------------------------------------------------------- 1 | From 98e180e2a0fe0f808586ea17c9ffe2c7abf1d033 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 6 Aug 2018 12:49:00 +0200 4 | Subject: [PATCH 07/49] Show APN Settings for CDMA carriers 5 | 6 | --- 7 | telephony/java/android/telephony/CarrierConfigManager.java | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java 11 | index 3d46c33534af..3f29b459b7cf 100644 12 | --- a/telephony/java/android/telephony/CarrierConfigManager.java 13 | +++ b/telephony/java/android/telephony/CarrierConfigManager.java 14 | @@ -9904,7 +9904,7 @@ public class CarrierConfigManager { 15 | sDefaults.putBoolean(KEY_OPERATOR_SELECTION_EXPAND_BOOL, true); 16 | sDefaults.putBoolean(KEY_PREFER_2G_BOOL, false); 17 | sDefaults.putBoolean(KEY_4G_ONLY_BOOL, false); 18 | - sDefaults.putBoolean(KEY_SHOW_APN_SETTING_CDMA_BOOL, false); 19 | + sDefaults.putBoolean(KEY_SHOW_APN_SETTING_CDMA_BOOL, true); 20 | sDefaults.putBoolean(KEY_SHOW_CDMA_CHOICES_BOOL, false); 21 | sDefaults.putBoolean(KEY_SMS_REQUIRES_DESTINATION_NUMBER_CONVERSION_BOOL, false); 22 | sDefaults.putBoolean(KEY_SUPPORT_EMERGENCY_SMS_OVER_IMS_BOOL, false); 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0013-Some-devices-have-proximity-sensor-reporting-NaN-as-.patch: -------------------------------------------------------------------------------- 1 | From 77cb62d2eb42aa86dc06c42b706739be0159b291 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 29 Sep 2020 22:39:47 +0200 4 | Subject: [PATCH 13/49] Some devices have proximity sensor reporting NaN as max 5 | range for some reason. Make them behave standard way by setting 5 cm 6 | 7 | Change-Id: I3c39e3e914a05903c140235702e0480d2d58a612 8 | --- 9 | .../com/android/server/display/DisplayPowerController.java | 3 +++ 10 | 1 file changed, 3 insertions(+) 11 | 12 | diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java 13 | index b76bb8d6a4c3..a797470c4306 100644 14 | --- a/services/core/java/com/android/server/display/DisplayPowerController.java 15 | +++ b/services/core/java/com/android/server/display/DisplayPowerController.java 16 | @@ -2390,6 +2390,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call 17 | if (mProximitySensor != null) { 18 | mProximityThreshold = Math.min(mProximitySensor.getMaximumRange(), 19 | TYPICAL_PROXIMITY_THRESHOLD); 20 | + if(Float.isNaN(mProximityThreshold)) { 21 | + mProximityThreshold = 5.0f; 22 | + } 23 | } 24 | } 25 | 26 | -- 27 | 2.34.1 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0016-Not-all-sources-in-a-route-are-valid.-Dont-ignore-th.patch: -------------------------------------------------------------------------------- 1 | From 466599686d47617894f6a43666609bac181f94d3 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 28 Mar 2021 18:54:47 +0200 4 | Subject: [PATCH 16/23] Not all sources in a route are valid. Dont ignore the 5 | whole route because of one broken source 6 | 7 | Change-Id: If8a51740e71bef3a4738262ad7b43a337b0ec36d 8 | --- 9 | .../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 13 | index 91fc5f57da..d2fcc13b00 100644 14 | --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 15 | +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 16 | @@ -667,7 +667,7 @@ std::variant PolicySerializer::deserializefindPortByTagName(trim(devTag)); 19 | } 20 | - if (source == NULL && !mIgnoreVendorExtensions) { 21 | + if (source == NULL && false) { 22 | ALOGE("%s: no source found with name=%s", __func__, devTag); 23 | return BAD_VALUE; 24 | } else if (source == NULL) { 25 | -- 26 | 2.34.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0025-Allow-disabling-of-fingerprint-cleanups-needed-on-so.patch: -------------------------------------------------------------------------------- 1 | From b95021d471d6936fb75f0482ef5687de4a41ec64 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 2 Apr 2022 18:04:01 -0400 4 | Subject: [PATCH 25/49] Allow disabling of fingerprint cleanups, needed on some 5 | Realme devices that cant enumerate 6 | 7 | --- 8 | .../biometrics/sensors/fingerprint/hidl/Fingerprint21.java | 2 ++ 9 | 1 file changed, 2 insertions(+) 10 | 11 | diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java 12 | index d0b71fcf2dbb..d5978a531dc5 100644 13 | --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java 14 | +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java 15 | @@ -746,6 +746,8 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider 16 | 17 | private void scheduleInternalCleanup(int userId, 18 | @Nullable ClientMonitorCallback callback) { 19 | + final boolean mNocleanup = android.os.SystemProperties.getBoolean("persist.sys.phh.fingerprint.nocleanup", false); 20 | + if(mNocleanup) return; 21 | mHandler.post(() -> { 22 | scheduleUpdateActiveUserWithoutHandler(userId); 23 | 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0006-MIUI13-devices-hide-their-vibrator-HAL-behind-non-de.patch: -------------------------------------------------------------------------------- 1 | From 4f49c7b1a14053787c24bcfe25f61b14e04954de Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 25 Mar 2022 05:37:56 -0400 4 | Subject: [PATCH 06/10] MIUI13 devices hide their vibrator HAL behind 5 | non-default name: "vibratorfeature" 6 | 7 | --- 8 | services/vibratorservice/VibratorHalController.cpp | 6 ++++++ 9 | 1 file changed, 6 insertions(+) 10 | 11 | diff --git a/services/vibratorservice/VibratorHalController.cpp b/services/vibratorservice/VibratorHalController.cpp 12 | index c1795f5c32..345016efd6 100644 13 | --- a/services/vibratorservice/VibratorHalController.cpp 14 | +++ b/services/vibratorservice/VibratorHalController.cpp 15 | @@ -59,6 +59,12 @@ std::shared_ptr connectHal(std::shared_ptr schedu 16 | return std::make_shared(std::move(scheduler), aidlHal); 17 | } 18 | 19 | + aidlHal = waitForVintfService(String16("vibratorfeature")); 20 | + if (aidlHal) { 21 | + ALOGV("Successfully connected to Xiaomi Vibrator HAL AIDL service."); 22 | + return std::make_shared(std::move(scheduler), aidlHal); 23 | + } 24 | + 25 | sp halV1_0 = V1_0::IVibrator::getService(); 26 | if (halV1_0 == nullptr) { 27 | ALOGV("Vibrator HAL service not available."); 28 | -- 29 | 2.34.1 30 | 31 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0009-Revert-Set-system-xbin-permissions-to-750.patch: -------------------------------------------------------------------------------- 1 | From d9c75784ad1e14a6f8eb42c5d8fa15cc5c28a82d Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Tue, 1 Feb 2022 13:48:35 +0000 4 | Subject: [PATCH 09/26] Revert "Set /system/xbin permissions to 750." 5 | 6 | This reverts commit 42a1a126e554a8bca31d0afc832848b7b0fa1f4e. 7 | 8 | Change-Id: I277def5153616d6f00bc877e6170b7fed7cd799d 9 | --- 10 | libcutils/fs_config.cpp | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp 14 | index f90a1bc3ca..8aadc3bb74 100644 15 | --- a/libcutils/fs_config.cpp 16 | +++ b/libcutils/fs_config.cpp 17 | @@ -87,7 +87,7 @@ static const struct fs_path_config android_dirs[] = { 18 | { 00751, AID_ROOT, AID_SHELL, 0, "system/bin" }, 19 | { 00755, AID_ROOT, AID_ROOT, 0, "system/etc/ppp" }, 20 | { 00755, AID_ROOT, AID_SHELL, 0, "system/vendor" }, 21 | - { 00750, AID_ROOT, AID_SHELL, 0, "system/xbin" }, 22 | + { 00751, AID_ROOT, AID_SHELL, 0, "system/xbin" }, 23 | { 00751, AID_ROOT, AID_SHELL, 0, "system/apex/*/bin" }, 24 | { 00750, AID_ROOT, AID_SYSTEM, 0, "system_ext/apex/com.android.tethering/bin/for-system" }, 25 | { 00751, AID_ROOT, AID_SHELL, 0, "system_ext/bin" }, 26 | -- 27 | 2.34.1 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0004-Remove-Samsung-system-permission-on-sensors.patch: -------------------------------------------------------------------------------- 1 | From 314a9ee8bbf83732b8581c1269fea6be055b3cc6 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 31 Mar 2021 23:36:03 +0200 4 | Subject: [PATCH 04/10] Remove Samsung system permission on sensors 5 | 6 | --- 7 | libs/sensor/Sensor.cpp | 1 + 8 | libs/sensor/include/sensor/Sensor.h | 1 + 9 | 2 files changed, 2 insertions(+) 10 | 11 | diff --git a/libs/sensor/Sensor.cpp b/libs/sensor/Sensor.cpp 12 | index b6ea77deb5..91807a8a53 100644 13 | --- a/libs/sensor/Sensor.cpp 14 | +++ b/libs/sensor/Sensor.cpp 15 | @@ -429,6 +429,7 @@ const String8& Sensor::getStringType() const { 16 | } 17 | 18 | const String8& Sensor::getRequiredPermission() const { 19 | + if (mRequiredPermission == "com.samsung.permission.SSENSOR") return mFakeRequiredPermission; 20 | return mRequiredPermission; 21 | } 22 | 23 | diff --git a/libs/sensor/include/sensor/Sensor.h b/libs/sensor/include/sensor/Sensor.h 24 | index bae8a1380b..afaafb321e 100644 25 | --- a/libs/sensor/include/sensor/Sensor.h 26 | +++ b/libs/sensor/include/sensor/Sensor.h 27 | @@ -125,6 +125,7 @@ private: 28 | uint32_t mFifoMaxEventCount; 29 | String8 mStringType; 30 | String8 mRequiredPermission; 31 | + String8 mFakeRequiredPermission; 32 | bool mRequiredPermissionRuntime = false; 33 | int32_t mRequiredAppOp; 34 | int32_t mMaxDelay; 35 | -- 36 | 2.34.1 37 | 38 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0025-Keep-capex-when-there-are-vendor-apexes.patch: -------------------------------------------------------------------------------- 1 | From 95173f62e972bd85d89d35d92b9946cb8ddf46eb Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 16 Jan 2024 10:30:57 -0500 4 | Subject: [PATCH 25/26] Keep capex when there are vendor apexes 5 | 6 | When disabling APEX on Linux < 5, we might break some vendor APEXes 7 | For instance Pixel 4a on Linux 4.14. 8 | If there is a vendor apex, enable APEX anyway. 9 | --- 10 | init/property_service.cpp | 14 ++++++++++++-- 11 | 1 file changed, 12 insertions(+), 2 deletions(-) 12 | 13 | diff --git a/init/property_service.cpp b/init/property_service.cpp 14 | index eb87675828..679bece507 100644 15 | --- a/init/property_service.cpp 16 | +++ b/init/property_service.cpp 17 | @@ -697,8 +697,18 @@ static bool kernel_supports_capex() { 18 | uname(&buf); 19 | const char *where = buf.release; 20 | int a = atoi(where); 21 | - if(a <= 4) return false; 22 | - return true; 23 | + if(a >= 5) return true; 24 | + 25 | + // If there are vendor apexes, we most likely actually need them 26 | + auto dir = std::unique_ptr{opendir("/vendor/apex"), closedir}; 27 | + if (!dir) { 28 | + return false; 29 | + } 30 | + for (struct dirent* ent = readdir(dir.get()); ent; ent = readdir(dir.get())) { 31 | + if(strstr(ent->d_name, "apex")) return true; 32 | + } 33 | + 34 | + return false; 35 | } 36 | 37 | /* 38 | -- 39 | 2.34.1 40 | 41 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_bionic/0001-Disable-vndklite-handling.patch: -------------------------------------------------------------------------------- 1 | From da3e4e28f1087493239cd8991e5cfa2ff576e22f Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 27 Oct 2021 14:39:29 -0400 4 | Subject: [PATCH 1/2] Disable vndklite handling 5 | 6 | Change-Id: Ic4474cf80fc4b45a9a2760dd51e2ca29c4d961e2 7 | --- 8 | linker/linker.cpp | 5 ----- 9 | 1 file changed, 5 deletions(-) 10 | 11 | diff --git a/linker/linker.cpp b/linker/linker.cpp 12 | index 17b574fc1f..c863f8ea69 100644 13 | --- a/linker/linker.cpp 14 | +++ b/linker/linker.cpp 15 | @@ -95,7 +95,6 @@ static uint64_t g_module_unload_counter = 0; 16 | static const char* const kLdConfigArchFilePath = "/system/etc/ld.config." ABI_STRING ".txt"; 17 | 18 | static const char* const kLdConfigFilePath = "/system/etc/ld.config.txt"; 19 | -static const char* const kLdConfigVndkLiteFilePath = "/system/etc/ld.config.vndk_lite.txt"; 20 | 21 | static const char* const kLdGeneratedConfigFilePath = "/linkerconfig/ld.config.txt"; 22 | 23 | @@ -3423,10 +3422,6 @@ static std::string get_ld_config_file_apex_path(const char* executable_path) { 24 | } 25 | 26 | static std::string get_ld_config_file_vndk_path() { 27 | - if (android::base::GetBoolProperty("ro.vndk.lite", false)) { 28 | - return kLdConfigVndkLiteFilePath; 29 | - } 30 | - 31 | std::string ld_config_file_vndk = kLdConfigFilePath; 32 | size_t insert_pos = ld_config_file_vndk.find_last_of('.'); 33 | if (insert_pos == std::string::npos) { 34 | -- 35 | 2.34.1 36 | 37 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_extras/0001-libfscrypt-Bail-out-if-we-can-t-open-directory.patch: -------------------------------------------------------------------------------- 1 | From bc0a573aa58e366d9f34811bb698dffc4de695cb Mon Sep 17 00:00:00 2001 2 | From: Luca Stefani 3 | Date: Wed, 9 Sep 2020 12:43:54 +0200 4 | Subject: [PATCH] libfscrypt: Bail out if we can't open directory 5 | 6 | * On QCOM Q vendor init.qcom.rc has a 'mkdir' entry 7 | for /data/system 8 | * While the encryption policy matches and is applied properly in 9 | permissive, vendor_init doesn't have enough perms to open 10 | and run ioctl over system_data_file to check its policy 11 | * Instead of opening the possiblity to vendors, just 12 | bail out if we fail to open the directory 13 | 14 | Test: m, boot r-gsi on Zenfone 6 15 | Change-Id: I5ea37019221cd0887b8a5d7454f5a42ac01335c7 16 | --- 17 | libfscrypt/fscrypt.cpp | 2 +- 18 | 1 file changed, 1 insertion(+), 1 deletion(-) 19 | 20 | diff --git a/libfscrypt/fscrypt.cpp b/libfscrypt/fscrypt.cpp 21 | index 174cecada..285cb9d7c 100644 22 | --- a/libfscrypt/fscrypt.cpp 23 | +++ b/libfscrypt/fscrypt.cpp 24 | @@ -328,7 +328,7 @@ bool EnsurePolicy(const EncryptionPolicy& policy, const std::string& directory) 25 | android::base::unique_fd fd(open(directory.c_str(), O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)); 26 | if (fd == -1) { 27 | PLOG(ERROR) << "Failed to open directory " << directory; 28 | - return false; 29 | + return true; 30 | } 31 | 32 | bool already_encrypted = fscrypt_is_encrypted(fd); 33 | -- 34 | 2.34.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_DeviceLock/0001-Don-t-crash-when-we-get-no-DeviceLockManager.patch: -------------------------------------------------------------------------------- 1 | From dc6088f136fe0e3162a9b36e3be1416594fedc1e Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 18 Oct 2023 17:44:59 -0400 4 | Subject: [PATCH] Don't crash when we get no DeviceLockManager 5 | 6 | Change-Id: Iaba659694e706c82a95ec2e99feb26e2bc6314e0 7 | --- 8 | .../devicelockcontroller/SystemDeviceLockManagerImpl.java | 5 ++++- 9 | 1 file changed, 4 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/DeviceLockController/src/com/android/devicelockcontroller/SystemDeviceLockManagerImpl.java b/DeviceLockController/src/com/android/devicelockcontroller/SystemDeviceLockManagerImpl.java 12 | index 9bde80b4..fa3658c4 100644 13 | --- a/DeviceLockController/src/com/android/devicelockcontroller/SystemDeviceLockManagerImpl.java 14 | +++ b/DeviceLockController/src/com/android/devicelockcontroller/SystemDeviceLockManagerImpl.java 15 | @@ -48,7 +48,10 @@ public final class SystemDeviceLockManagerImpl implements SystemDeviceLockManage 16 | final DeviceLockManager deviceLockManager = 17 | context.getSystemService(DeviceLockManager.class); 18 | 19 | - mIDeviceLockService = deviceLockManager.getService(); 20 | + if (deviceLockManager != null) 21 | + mIDeviceLockService = deviceLockManager.getService(); 22 | + else 23 | + mIDeviceLockService = null; 24 | } 25 | 26 | private SystemDeviceLockManagerImpl() { 27 | -- 28 | 2.34.1 29 | 30 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0009-Allow-sys-vm-watermark_scale_factor-conflict-seen-on.patch: -------------------------------------------------------------------------------- 1 | From 8cd620d035d584906d4a7840ffe813fed9b456f9 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 20 Jul 2023 14:21:21 -0400 4 | Subject: [PATCH 09/10] Allow /sys/vm/watermark_scale_factor conflict -- seen 5 | on Freebox Player Pop 6 | 7 | --- 8 | libsepol/cil/src/cil_post.c | 9 +++++++++ 9 | 1 file changed, 9 insertions(+) 10 | 11 | diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c 12 | index 7f614c039..1703b3b6d 100644 13 | --- a/libsepol/cil/src/cil_post.c 14 | +++ b/libsepol/cil/src/cil_post.c 15 | @@ -502,6 +502,15 @@ static int cil_post_genfscon_context_compare(const void *a, const void *b) 16 | */ 17 | if(strcmp(a_genfscon->path_str, "/devices/virtual/block/") == 0) 18 | bypass = 1; 19 | + /* 20 | + * This conflict has been seen on Freebox Player Pop 21 | + * - AOSP T says (genfscon proc "/sys/vm/watermark_scale_factor" (u object_r proc_watermark_scale_factor ((s0) (s0)))) 22 | + * - stock rom says proc_vm_writable 23 | + * 24 | + * Stock ROM uses it only in recovery so it's safe to ignore 25 | + */ 26 | + if(strcmp(a_genfscon->path_str, "/sys/vm/watermark_scale_factor") == 0) 27 | + bypass = 1; 28 | if(strcmp(a_genfscon->fs_str, "exfat") == 0 || strcmp(a_genfscon->fs_str, "esdfs") == 0) { 29 | if(strcmp(a_genfscon->path_str, "/") == 0) 30 | bypass = 1; 31 | -- 32 | 2.34.1 33 | 34 | -------------------------------------------------------------------------------- /apk/handheld_product.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2019 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # This makefile contains the product partition contents for 18 | # a generic phone or tablet device. Only add something here if 19 | # it definitely doesn't belong on other types of devices (if it 20 | # does, use base_product.mk). 21 | $(call inherit-product, $(SRC_TARGET_DIR)/product/media_product.mk) 22 | 23 | # /product packages 24 | PRODUCT_PACKAGES += \ 25 | Browser2 \ 26 | Calendar \ 27 | Camera2 \ 28 | Contacts \ 29 | DeskClock \ 30 | Firefox \ 31 | Gallery2 \ 32 | GoogleGames \ 33 | LatinIME \ 34 | Music \ 35 | OneNote \ 36 | OneTimeInitializer \ 37 | preinstalled-packages-platform-handheld-product.xml \ 38 | QuickSearchBox \ 39 | SettingsIntelligence \ 40 | TotalCommander \ 41 | frameworks-base-overlays \ 42 | VLC 43 | 44 | PRODUCT_PACKAGES_DEBUG += \ 45 | frameworks-base-overlays-debug 46 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0004-Relax-requirement-for-visible-flag-to-sdcards.patch: -------------------------------------------------------------------------------- 1 | From 4b000b1bc5be0c19fecc7d550b4f5e5947e71646 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 28 Nov 2017 18:28:04 +0100 4 | Subject: [PATCH 04/49] Relax requirement for visible flag to sdcards 5 | 6 | The vast majority of sdcard readers are stable enough to be declared by 7 | the API. (I see no counter-example) 8 | FBE broke adoptable storage with SDCard, hence this need. 9 | 10 | Change-Id: Ia616671c03562d1eadaff5531a5c708a62d7ad3a 11 | --- 12 | .../core/java/com/android/server/StorageManagerService.java | 3 ++- 13 | 1 file changed, 2 insertions(+), 1 deletion(-) 14 | 15 | diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java 16 | index 2606757e008d..2fa53cf50770 100644 17 | --- a/services/core/java/com/android/server/StorageManagerService.java 18 | +++ b/services/core/java/com/android/server/StorageManagerService.java 19 | @@ -1533,7 +1533,8 @@ class StorageManagerService extends IStorageManager.Stub 20 | 21 | // Adoptable public disks are visible to apps, since they meet 22 | // public API requirement of being in a stable location. 23 | - if (vol.disk.isAdoptable()) { 24 | + // Assume all SDs match this as well 25 | + if (vol.disk.isAdoptable() || vol.disk.isSd()) { 26 | vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE_FOR_WRITE; 27 | } 28 | 29 | -- 30 | 2.34.1 31 | 32 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0004-Don-t-abandon-creating-property-tree-if-there-is-a-c.patch: -------------------------------------------------------------------------------- 1 | From 3906ace6972975d208547d61862b11d72bcd745f Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 18 Oct 2020 18:14:47 +0200 4 | Subject: [PATCH 04/26] Don't abandon creating property tree if there is a 5 | conflict, and hope for the best 6 | 7 | Change-Id: I194c815fdd58bfb84aaf7db02b8f0d00b4db21e8 8 | --- 9 | .../libpropertyinfoserializer/property_info_serializer.cpp | 3 ++- 10 | 1 file changed, 2 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/property_service/libpropertyinfoserializer/property_info_serializer.cpp b/property_service/libpropertyinfoserializer/property_info_serializer.cpp 13 | index 803657ab8e..ecdd0be201 100644 14 | --- a/property_service/libpropertyinfoserializer/property_info_serializer.cpp 15 | +++ b/property_service/libpropertyinfoserializer/property_info_serializer.cpp 16 | @@ -19,6 +19,7 @@ 17 | #include "property_info_parser/property_info_parser.h" 18 | 19 | #include 20 | +#include 21 | 22 | #include "trie_builder.h" 23 | #include "trie_serializer.h" 24 | @@ -34,7 +35,7 @@ bool BuildTrie(const std::vector& property_info, 25 | 26 | for (const auto& [name, context, type, is_exact] : property_info) { 27 | if (!trie_builder.AddToTrie(name, context, type, is_exact, error)) { 28 | - return false; 29 | + std::cerr << "Failed adding " << name << " to property trie... let's hope for the best" << std::endl; 30 | } 31 | } 32 | 33 | -- 34 | 2.34.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_opt_telephony/0003-Fix-baseband-being-too-long-to-fit-into-a-91-chars-p.patch: -------------------------------------------------------------------------------- 1 | From 813621855b2221af6444e751af328717f850395f Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 6 Dec 2021 16:28:22 -0500 4 | Subject: [PATCH 03/11] Fix baseband being too long to fit into a 91 chars 5 | property, preventing telephony subsystem from starting 6 | 7 | Change-Id: I1762e4a8cc137626be89f350229d6be162bdaf57 8 | --- 9 | src/java/com/android/internal/telephony/GsmCdmaPhone.java | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java 13 | index e48d10e8b5..3e97f0ab32 100644 14 | --- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java 15 | +++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java 16 | @@ -3288,7 +3288,7 @@ public class GsmCdmaPhone extends Phone { 17 | String version = (String)ar.result; 18 | if (version != null) { 19 | int length = version.length(); 20 | - final int MAX_VERSION_LEN = SystemProperties.PROP_VALUE_MAX/2; 21 | + final int MAX_VERSION_LEN = SystemProperties.PROP_VALUE_MAX/2 - 2; 22 | TelephonyManager.from(mContext).setBasebandVersionForPhone(getPhoneId(), 23 | length <= MAX_VERSION_LEN ? version 24 | : version.substring(length - MAX_VERSION_LEN, length)); 25 | -- 26 | 2.34.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0022-Add-a-prop-to-disable-AUDIO_OUTPUT_FLAG_FAST-from-au.patch: -------------------------------------------------------------------------------- 1 | From 4ee3d32e50005381ebb2d7bf6f6d2f2b842f8631 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 30 Oct 2023 10:30:58 -0400 4 | Subject: [PATCH 22/23] Add a prop to disable AUDIO_OUTPUT_FLAG_FAST from audio 5 | policies, when CPU can't really handle that kind of load 6 | 7 | --- 8 | .../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 4 ++++ 9 | 1 file changed, 4 insertions(+) 10 | 11 | diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 12 | index 8b3a1f0e4f..913cbc0e90 100644 13 | --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 14 | +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 15 | @@ -504,6 +504,10 @@ std::variant PolicySerializer::deserialize 3 | Date: Fri, 6 Oct 2023 10:57:13 -0400 4 | Subject: [PATCH 36/49] Catch NPE in SystemUI 5 | 6 | No idea why it triggers, but it crashes SystemUI on boot for my TV 7 | device 8 | --- 9 | .../com/android/systemui/keyguard/KeyguardViewMediator.java | 6 +++++- 10 | 1 file changed, 5 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java 13 | index 1ae5d0a1a39d..a68be64f7747 100644 14 | --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java 15 | +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java 16 | @@ -3451,7 +3451,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, 17 | Trace.beginSection("KeyguardViewMediator#handleMotifyStartedWakingUp"); 18 | synchronized (KeyguardViewMediator.this) { 19 | if (DEBUG) Log.d(TAG, "handleNotifyWakingUp"); 20 | - mKeyguardViewControllerLazy.get().onStartedWakingUp(); 21 | + try { 22 | + mKeyguardViewControllerLazy.get().onStartedWakingUp(); 23 | + } catch(Throwable t) { 24 | + android.util.Log.e("PHH", "handleNotifyStartedWakingUp crashed bip", t); 25 | + } 26 | } 27 | Trace.endSection(); 28 | } 29 | -- 30 | 2.34.1 31 | 32 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0024-Revert-Switch-long-press-power-behavior-in-AOSP.patch: -------------------------------------------------------------------------------- 1 | From 067705d8af50d92930cc6ab21319aba9a651d221 Mon Sep 17 00:00:00 2001 2 | From: Andy CrossGate Yan 3 | Date: Sat, 4 Sep 2021 08:26:30 +0000 4 | Subject: [PATCH 24/49] Revert "Switch long-press power behavior in AOSP." 5 | 6 | This reverts commit 803c77a0a24624111944832098c6f65158051dc4. 7 | --- 8 | core/res/res/values/config.xml | 4 ++-- 9 | 1 file changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml 12 | index 4b922e2a3643..badad2c71245 100644 13 | --- a/core/res/res/values/config.xml 14 | +++ b/core/res/res/values/config.xml 15 | @@ -1097,7 +1097,7 @@ 16 | 4 - Go to voice assist 17 | 5 - Go to assistant (Settings.Secure.ASSISTANT) 18 | --> 19 | - 5 20 | + 1 21 | 22 | 23 | 500 24 | @@ -1129,7 +1129,7 @@ 25 | 1 - Mute toggle 26 | 2 - Global actions menu 27 | --> 28 | - 2 29 | + 1 30 | 31 | 9 | 10 | ``` 11 | Device: 12 | GSI version: 13 | Vendor version: 14 | ``` 15 | 16 | ## Expected Behavior 17 | 18 | ``` 19 | Edit here 20 | ``` 21 | 22 | ## Current Behavior 23 | 24 | ``` 25 | Edit here 26 | ``` 27 | 28 | ## Possible Solution 29 | 30 | ``` 31 | Edit here 32 | ``` 33 | 34 | ## Steps to Reproduce 35 | 36 | 37 | ``` 38 | 1. 39 | 2. 40 | 3. 41 | 4. 42 | ``` 43 | 44 | ## Logs 45 | 46 | 47 | 48 | 49 | ## Acknowledgements 50 | 51 | - [ ] This is not a feature request. 52 | - [ ] This issue is not a duplicate of an existing issue. 53 | - [ ] This issue is not related with kernel or Magisk at all. 54 | - [ ] I am not running a custom vendor on my device. 55 | - [ ] This issue occurs with the latest available build. 56 | - [ ] I have chosen an appropriate title. 57 | - [ ] All requested information has been provided properly. 58 | - [ ] The issue is solely related to this AOSP GSI. 59 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0012-No-longer-make-re-assigning-legacy-audio-groups-fata.patch: -------------------------------------------------------------------------------- 1 | From 3f28e6f7c1206b84050e1d4c40203a2954efd34e Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 12 Sep 2020 12:32:50 +0200 4 | Subject: [PATCH 12/23] No longer make re-assigning legacy audio groups fatal. 5 | Mi9 declares AUDIO_STREAM_PATCH and AUDIO_STREAM_REROUTING which is defined 6 | by framework too 7 | 8 | Change-Id: I794fe22d63a8af705be4f5f09b9879ecaab3eae5 9 | --- 10 | services/audiopolicy/engine/common/src/EngineBase.cpp | 6 +++--- 11 | 1 file changed, 3 insertions(+), 3 deletions(-) 12 | 13 | diff --git a/services/audiopolicy/engine/common/src/EngineBase.cpp b/services/audiopolicy/engine/common/src/EngineBase.cpp 14 | index 218aff80e6..c7ea035191 100644 15 | --- a/services/audiopolicy/engine/common/src/EngineBase.cpp 16 | +++ b/services/audiopolicy/engine/common/src/EngineBase.cpp 17 | @@ -245,9 +245,9 @@ engineConfig::ParsingResult EngineBase::processParsingResult( 18 | } 19 | if (group.stream != AUDIO_STREAM_DEFAULT) { 20 | // A legacy stream can be assigned once to a volume group 21 | - LOG_ALWAYS_FATAL_IF(checkStreamForGroups(group.stream, mVolumeGroups), 22 | - "stream %s already assigned to a volume group, " 23 | - "review the configuration", toString(group.stream).c_str()); 24 | + if(checkStreamForGroups(group.stream, mVolumeGroups)) { 25 | + ALOGE("stream %s already assigned to a volume group, review the configuration", toString(group.stream).c_str()); 26 | + } 27 | volumeGroup->addSupportedStream(group.stream); 28 | } 29 | addSupportedAttributesToGroup(group, volumeGroup, strategy); 30 | -- 31 | 2.34.1 32 | 33 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0004-Allow-devices-virtual-block-genfscon-conflict-seen-o.patch: -------------------------------------------------------------------------------- 1 | From cd03927329ace671e78faf24458c894da012c012 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 6 Sep 2019 15:07:25 +0200 4 | Subject: [PATCH 04/10] Allow /devices/virtual/block/ genfscon conflict (seen 5 | on Xiaomi Mi 9) 6 | 7 | Change-Id: I06e4e9d5b82d61a8aeab595b47e2589249675895 8 | --- 9 | libsepol/cil/src/cil_post.c | 18 +++++++++++++++++- 10 | 1 file changed, 17 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c 13 | index a7c66eadb..99410da07 100644 14 | --- a/libsepol/cil/src/cil_post.c 15 | +++ b/libsepol/cil/src/cil_post.c 16 | @@ -491,7 +491,23 @@ static int cil_post_genfscon_context_compare(const void *a, const void *b) 17 | { 18 | struct cil_genfscon *a_genfscon = *(struct cil_genfscon**)a; 19 | struct cil_genfscon *b_genfscon = *(struct cil_genfscon**)b; 20 | - return context_compare(a_genfscon->context, b_genfscon->context); 21 | + int rc = context_compare(a_genfscon->context, b_genfscon->context); 22 | + if(rc) { 23 | + fprintf(stderr, "hello %s\n", a_genfscon->fs_str); 24 | + int bypass = 0; 25 | + /* 26 | + * This conflict has been seen on Xiaomi Mi 9: 27 | + * - AOSP Q says (genfscon sysfs /devices/virtual/block/ (u object_r sysfs_devices_block ((s0) (s0)))) 28 | + * - stock rom says (genfscon sysfs /devices/virtual/block/ (u object_r sysfs_ufs_target ((s0) (s0)))) 29 | + */ 30 | + if(strcmp(a_genfscon->path_str, "/devices/virtual/block/") == 0) 31 | + bypass = 1; 32 | + if(bypass == 1) { 33 | + fprintf(stderr, "Received conflicting %s vs %s but ignore\n", a_genfscon->path_str, b_genfscon->path_str); 34 | + return 0; 35 | + } 36 | + } 37 | + return rc; 38 | } 39 | 40 | static int cil_post_netifcon_context_compare(const void *a, const void *b) 41 | -- 42 | 2.34.1 43 | 44 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0002-Fallback-to-stupid-autobrightness-if-brightness-valu.patch: -------------------------------------------------------------------------------- 1 | From 390d348b51ad762c0037a6edc75f87a56c7f4354 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 5 Oct 2021 17:59:16 -0400 4 | Subject: [PATCH 02/49] Fallback to stupid autobrightness if brightness values 5 | are broken 6 | 7 | This is needed because of: 8 | `ava.lang.IllegalArgumentException: The control points must all have strictly increasing X values.` 9 | on some Samsung devices 10 | 11 | Change-Id: Ieb679b34239013a5e31b34cb010b12febd9ef6d9 12 | --- 13 | .../com/android/server/display/DisplayDeviceConfig.java | 9 +++++++-- 14 | 1 file changed, 7 insertions(+), 2 deletions(-) 15 | 16 | diff --git a/services/core/java/com/android/server/display/DisplayDeviceConfig.java b/services/core/java/com/android/server/display/DisplayDeviceConfig.java 17 | index 2464eb0141b8..b0ebab8e4002 100644 18 | --- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java 19 | +++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java 20 | @@ -777,9 +777,14 @@ public class DisplayDeviceConfig { 21 | * @return A configuration instance. 22 | */ 23 | public static DisplayDeviceConfig create(Context context, boolean useConfigXml) { 24 | - final DisplayDeviceConfig config; 25 | + DisplayDeviceConfig config; 26 | if (useConfigXml) { 27 | - config = getConfigFromGlobalXml(context); 28 | + try { 29 | + config = getConfigFromGlobalXml(context); 30 | + } catch(Exception e) { 31 | + android.util.Log.e("PHH", "Failed parsing automatic brightness values, fallbacking", e); 32 | + config = getConfigFromPmValues(context); 33 | + } 34 | } else { 35 | config = getConfigFromPmValues(context); 36 | } 37 | -- 38 | 2.34.1 39 | 40 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0002-Revert-libsepol-Make-an-unknown-permission-an-error-.patch: -------------------------------------------------------------------------------- 1 | From c0a820a83a2b9646e2c833d4ca9529deec59fd99 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 9 Sep 2020 22:36:42 +0200 4 | Subject: [PATCH 02/10] Revert "libsepol: Make an unknown permission an error 5 | in CIL" 6 | 7 | This reverts commit dc4e54126bf25dea4d51820922ccd1959be68fbc. 8 | 9 | This is required because some targets calls undefined permissions: 10 | - Realme X2 Pro calls sigcont 11 | - Honor 7X calls perf_event 12 | --- 13 | libsepol/cil/src/cil_resolve_ast.c | 12 ++++++++---- 14 | 1 file changed, 8 insertions(+), 4 deletions(-) 15 | 16 | diff --git a/libsepol/cil/src/cil_resolve_ast.c b/libsepol/cil/src/cil_resolve_ast.c 17 | index d2bfdc812..91fa10759 100644 18 | --- a/libsepol/cil/src/cil_resolve_ast.c 19 | +++ b/libsepol/cil/src/cil_resolve_ast.c 20 | @@ -136,14 +136,18 @@ static int __cil_resolve_perms(symtab_t *class_symtab, symtab_t *common_symtab, 21 | } 22 | } 23 | if (rc != SEPOL_OK) { 24 | + struct cil_list *empty_list; 25 | if (class_flavor == CIL_MAP_CLASS) { 26 | cil_log(CIL_ERR, "Failed to resolve permission %s for map class\n", (char*)curr->data); 27 | - } else { 28 | - cil_log(CIL_ERR, "Failed to resolve permission %s\n", (char*)curr->data); 29 | + goto exit; 30 | } 31 | - goto exit; 32 | + cil_log(CIL_WARN, "Failed to resolve permission %s\n", (char*)curr->data); 33 | + /* Use an empty list to represent unknown perm */ 34 | + cil_list_init(&empty_list, perm_strs->flavor); 35 | + cil_list_append(*perm_datums, CIL_LIST, empty_list); 36 | + } else { 37 | + cil_list_append(*perm_datums, CIL_DATUM, perm_datum); 38 | } 39 | - cil_list_append(*perm_datums, CIL_DATUM, perm_datum); 40 | } else { 41 | cil_list_append(*perm_datums, curr->flavor, curr->data); 42 | } 43 | -- 44 | 2.34.1 45 | 46 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0047-Replace-strings-with-strings.patch: -------------------------------------------------------------------------------- 1 | From b30b71584a13de3b0ccf232aa69a6244b1ae6ace Mon Sep 17 00:00:00 2001 2 | From: Jonathan Scott 3 | Date: Wed, 19 Jul 2023 11:10:44 +0000 4 | Subject: [PATCH 47/49] Replace ":strings" with "strings" 5 | 6 | It looks like this is a typo and can cause parse errors with some xml 7 | deserialization libraries. 8 | 9 | Test: manual - set User Control Disabled Packages - restart device - 10 | confirm that policy is still set 11 | Bug: 291711966 12 | (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4905c30a74d2037aef7e8e91912b08c4897e7dd5) 13 | Merged-In: Ib8eb2356ece3d9f0e85b7b8c455e58106a1d84f1 14 | Change-Id: Ib8eb2356ece3d9f0e85b7b8c455e58106a1d84f1 15 | --- 16 | .../android/server/devicepolicy/StringSetPolicySerializer.java | 3 +-- 17 | 1 file changed, 1 insertion(+), 2 deletions(-) 18 | 19 | diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/StringSetPolicySerializer.java b/services/devicepolicy/java/com/android/server/devicepolicy/StringSetPolicySerializer.java 20 | index 24d0521471f7..0265453eecc7 100644 21 | --- a/services/devicepolicy/java/com/android/server/devicepolicy/StringSetPolicySerializer.java 22 | +++ b/services/devicepolicy/java/com/android/server/devicepolicy/StringSetPolicySerializer.java 23 | @@ -32,9 +32,8 @@ import java.util.Set; 24 | 25 | // TODO(scottjonathan): Replace with generic set implementation 26 | final class StringSetPolicySerializer extends PolicySerializer> { 27 | - private static final String ATTR_VALUES = ":strings"; 28 | + private static final String ATTR_VALUES = "strings"; 29 | private static final String ATTR_VALUES_SEPARATOR = ";"; 30 | - 31 | @Override 32 | void saveToXml(PolicyKey policyKey, TypedXmlSerializer serializer, 33 | @NonNull Set value) throws IOException { 34 | -- 35 | 2.34.1 36 | 37 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_opt_telephony/0006-telephony-forward-port-support-for-forceCognitive.patch: -------------------------------------------------------------------------------- 1 | From 82ce22b4fdf4ed53e175889531fc2e9b96239468 Mon Sep 17 00:00:00 2001 2 | From: corneranchu 3 | Date: Sat, 1 Oct 2022 01:49:58 +0000 4 | Subject: [PATCH 06/11] telephony: forward-port support for forceCognitive 5 | 6 | * This is needed on some MTK devices. Android 10 refactored some code, 7 | so now the "non-persistent/cognitive" filter is relocated to RIL and 8 | also in DcTracker.setupData(). 9 | 10 | Change-Id: I7dd387a9f064a969ca5774e53b05388de12aa308 11 | --- 12 | src/java/com/android/internal/telephony/RadioDataProxy.java | 4 +++- 13 | 1 file changed, 3 insertions(+), 1 deletion(-) 14 | 15 | diff --git a/src/java/com/android/internal/telephony/RadioDataProxy.java b/src/java/com/android/internal/telephony/RadioDataProxy.java 16 | index 9671077b0f..561fceaa7d 100644 17 | --- a/src/java/com/android/internal/telephony/RadioDataProxy.java 18 | +++ b/src/java/com/android/internal/telephony/RadioDataProxy.java 19 | @@ -21,6 +21,7 @@ import android.net.LinkProperties; 20 | import android.os.AsyncResult; 21 | import android.os.Message; 22 | import android.os.RemoteException; 23 | +import android.os.SystemProperties; 24 | import android.telephony.Rlog; 25 | import android.telephony.ServiceState; 26 | import android.telephony.data.DataProfile; 27 | @@ -244,7 +245,8 @@ public class RadioDataProxy extends RadioServiceProxy { 28 | } else { 29 | ArrayList dpis = new ArrayList<>(); 30 | for (DataProfile dp : profiles) { 31 | - if (dp.isPersistent()) { 32 | + boolean forceCognitive = SystemProperties.getBoolean("persist.sys.phh.radio.force_cognitive", false); 33 | + if (dp.isPersistent() || forceCognitive) { 34 | dpis.add(RILUtils.convertToHalDataProfile10(dp)); 35 | } 36 | } 37 | -- 38 | 2.34.1 39 | 40 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_apps_Settings/0001-Act-as-usb-device-when-there-is-no-hal-but-we-believ.patch: -------------------------------------------------------------------------------- 1 | From 0bf516a976153cee0122478adce675bfd8606484 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 14 Aug 2018 21:48:19 +0200 4 | Subject: [PATCH 1/5] Act as usb device when there is no hal, but we believe we 5 | are a device 6 | 7 | Change-Id: I036090738525fd8cc63534d52d02ab1852950a7d 8 | --- 9 | .../usb/UsbConnectionBroadcastReceiver.java | 7 +++++++ 10 | 1 file changed, 7 insertions(+) 11 | 12 | diff --git a/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java b/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java 13 | index 16ea602bc4f..262afbcbb31 100644 14 | --- a/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java 15 | +++ b/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java 16 | @@ -93,6 +93,13 @@ public class UsbConnectionBroadcastReceiver extends BroadcastReceiver implements 17 | mFunctions = functions; 18 | mDataRole = mUsbBackend.getDataRole(); 19 | mPowerRole = mUsbBackend.getPowerRole(); 20 | + //If we have no USB HAL, mDataRole is invalid 21 | + //But we can't be connected AND have none data_role, so it's safe. 22 | + //It would be better to fix UsbManager when no HAL is available, but that's more work 23 | + if(mDataRole == UsbPortStatus.DATA_ROLE_NONE && 24 | + intent.getExtras().getBoolean(UsbManager.USB_CONNECTED) && 25 | + !intent.getExtras().getBoolean(UsbManager.USB_HOST_CONNECTED)) 26 | + mDataRole = UsbPortStatus.DATA_ROLE_DEVICE; 27 | } else if (UsbManager.ACTION_USB_PORT_CHANGED.equals(intent.getAction())) { 28 | UsbPortStatus portStatus = intent.getExtras() 29 | .getParcelable(UsbManager.EXTRA_PORT_STATUS); 30 | -- 31 | 2.34.1 32 | 33 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0017-Use-a-fake-volume-policy-when-none-has-been-found.patch: -------------------------------------------------------------------------------- 1 | From 1804d0af7874fd0da6e3e834cf49ed364f4008b5 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 28 Mar 2021 14:48:49 +0200 4 | Subject: [PATCH 17/23] Use a fake volume policy when none has been found 5 | 6 | This is useful, because on Samsung devices, the "real" 7 | (=non-gsi-cheating) audio policy doesn't have any volume policy. 8 | 9 | This requires actually adding the fake audio policy xml file (done in 10 | device/phh/treble) 11 | 12 | Change-Id: I461a3f22893ab2b1d96d67f22397369b2cae41e5 13 | --- 14 | services/audiopolicy/engine/config/src/EngineConfig.cpp | 7 ++++++- 15 | 1 file changed, 6 insertions(+), 1 deletion(-) 16 | 17 | diff --git a/services/audiopolicy/engine/config/src/EngineConfig.cpp b/services/audiopolicy/engine/config/src/EngineConfig.cpp 18 | index ca78ce7213..59211577c4 100644 19 | --- a/services/audiopolicy/engine/config/src/EngineConfig.cpp 20 | +++ b/services/audiopolicy/engine/config/src/EngineConfig.cpp 21 | @@ -800,7 +800,12 @@ android::status_t parseLegacyVolumeFile(const char* path, VolumeGroups &volumeGr 22 | android::status_t parseLegacyVolumes(VolumeGroups &volumeGroups) { 23 | if (std::string audioPolicyXmlConfigFile = audio_get_audio_policy_config_file(); 24 | !audioPolicyXmlConfigFile.empty()) { 25 | - return parseLegacyVolumeFile(audioPolicyXmlConfigFile.c_str(), volumeGroups); 26 | + int ret = parseLegacyVolumeFile(audioPolicyXmlConfigFile.c_str(), volumeGroups); 27 | + if (ret == NO_ERROR && volumeGroups.size() == 0) { 28 | + ret = parseLegacyVolumeFile("/system/etc/fake_audio_policy_volume.xml", volumeGroups); 29 | + ALOGE("Parsing volume for /system/etc/fake_audio_policy_volume.xml gave %zu", volumeGroups.size()); 30 | + } 31 | + return ret; 32 | } else { 33 | ALOGE("No readable audio policy config file found"); 34 | return BAD_VALUE; 35 | -- 36 | 2.34.1 37 | 38 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0012-FDE-is-dead.-Fallback-FDE-to-no-encryption-and-FDE-F.patch: -------------------------------------------------------------------------------- 1 | From 8c02037a112c62d0d10a62566a431c5e2d1c01cb Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 10 Nov 2022 13:30:50 -0500 4 | Subject: [PATCH 12/26] FDE is dead. Fallback FDE to no encryption, and FDE+FBE 5 | to FBE 6 | 7 | --- 8 | fs_mgr/fs_mgr_fstab.cpp | 7 +++---- 9 | 1 file changed, 3 insertions(+), 4 deletions(-) 10 | 11 | diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp 12 | index fad84c653b..f31d21ddd3 100644 13 | --- a/fs_mgr/fs_mgr_fstab.cpp 14 | +++ b/fs_mgr/fs_mgr_fstab.cpp 15 | @@ -188,7 +188,7 @@ bool ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { 16 | #undef CheckFlag 17 | 18 | // Then handle flags that take an argument. 19 | - if (StartsWith(flag, "encryptable=")) { 20 | + if (StartsWith(flag, "encryptable=") || StartsWith(flag, "forceencrypt=")) { 21 | // The "encryptable" flag identifies adoptable storage volumes. The 22 | // argument to this flag is ignored, but it should be "userdata". 23 | // 24 | @@ -198,9 +198,8 @@ bool ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { 25 | // storage volumes. Today, FDE is no longer supported, leaving only 26 | // the adoptable storage volume meaning for this flag. 27 | entry->fs_mgr_flags.crypt = true; 28 | - } else if (StartsWith(flag, "forceencrypt=") || StartsWith(flag, "forcefdeorfbe=")) { 29 | - LERROR << "flag no longer supported: " << flag; 30 | - return false; 31 | + } else if (StartsWith(flag, "forcefdeorfbe=")) { 32 | + ParseFileEncryption("aes-256-xts:aes-256-cts", entry); 33 | } else if (StartsWith(flag, "voldmanaged=")) { 34 | // The voldmanaged flag is followed by an = and the label, a colon and the partition 35 | // number or the word "auto", e.g. voldmanaged=sdcard:3 36 | -- 37 | 2.34.1 38 | 39 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_Bluetooth/0003-Add-option-to-change-eSCO-Transport-Unit-Size.patch: -------------------------------------------------------------------------------- 1 | From fac1258f13d9b78beaacafba7ac7a987c42ed529 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Thu, 17 Jun 2021 15:48:53 +0100 4 | Subject: [PATCH 3/8] Add option to change eSCO Transport Unit Size 5 | 6 | Fixes Bluetooth calls on some Samsung devices if set to 16. 7 | 8 | It's still unknown if other Treble devices need other values so it's preferred to leave this able to be configured with another integer. 9 | 10 | This applies to mSBC T2, T1 and CVSD codecs 11 | 12 | Change-Id: I3e5897c2ce983042b9a4bef9def6744ba4253bcb 13 | --- 14 | system/device/src/esco_parameters.cc | 8 +++++++- 15 | 1 file changed, 7 insertions(+), 1 deletion(-) 16 | 17 | diff --git a/system/device/src/esco_parameters.cc b/system/device/src/esco_parameters.cc 18 | index 48607e6d54a..3b19d7c3eaf 100644 19 | --- a/system/device/src/esco_parameters.cc 20 | +++ b/system/device/src/esco_parameters.cc 21 | @@ -22,7 +22,8 @@ 22 | 23 | #include "check.h" 24 | 25 | -static const enh_esco_params_t default_esco_parameters[ESCO_NUM_CODECS] = { 26 | +#include 27 | +static enh_esco_params_t default_esco_parameters[ESCO_NUM_CODECS] = { 28 | // CVSD D1 29 | { 30 | .transmit_bandwidth = TXRX_64KBITS_RATE, 31 | @@ -288,6 +289,11 @@ enh_esco_params_t esco_parameters_for_codec(esco_codec_t codec, bool offload) { 32 | CHECK(codec >= 0) << "codec index " << (int)codec << "< 0"; 33 | CHECK(codec < ESCO_NUM_CODECS) 34 | << "codec index " << (int)codec << " > " << ESCO_NUM_CODECS; 35 | + int escoTransportUnitSize = property_get_int32("persist.sys.bt.esco_transport_unit_size", 0); 36 | + if(escoTransportUnitSize) { 37 | + default_esco_parameters[codec].input_transport_unit_size = escoTransportUnitSize; 38 | + default_esco_parameters[codec].output_transport_unit_size = escoTransportUnitSize; 39 | + } 40 | if (offload) { 41 | return default_esco_parameters[codec]; 42 | } 43 | -- 44 | 2.34.1 45 | 46 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_Bluetooth/0001-gd-hci-Ignore-unexpected-status-events.patch: -------------------------------------------------------------------------------- 1 | From 9b384b93e1c9f18305f3172920e365afc3842bd5 Mon Sep 17 00:00:00 2001 2 | From: Peter Cai 3 | Date: Wed, 24 Aug 2022 10:41:29 -0400 4 | Subject: [PATCH 1/8] gd: hci: Ignore unexpected status events 5 | 6 | For some reason, on some old devices, the controller will report a 7 | remote to support SNIFF_SUBRATING even when it does not. Just ignore the 8 | error here (the status event comes from the failure response). 9 | 10 | Change-Id: Ifb9a65fd77f21d15a8dc1ced9240194d38218ef6 11 | --- 12 | system/gd/hci/hci_layer.cc | 15 +++++++-------- 13 | 1 file changed, 7 insertions(+), 8 deletions(-) 14 | 15 | diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc 16 | index c3312a557ce..3e8ab783714 100644 17 | --- a/system/gd/hci/hci_layer.cc 18 | +++ b/system/gd/hci/hci_layer.cc 19 | @@ -211,14 +211,13 @@ struct HciLayer::impl { 20 | command_queue_.front().GetCallback()->Invoke( 21 | std::move(command_complete_view)); 22 | } else { 23 | - ASSERT_LOG( 24 | - command_queue_.front().waiting_for_status_ == is_status, 25 | - "0x%02hx (%s) was not expecting %s event", 26 | - op_code, 27 | - OpCodeText(op_code).c_str(), 28 | - logging_id.c_str()); 29 | - 30 | - command_queue_.front().GetCallback()->Invoke(std::move(response_view)); 31 | + if (command_queue_.front().waiting_for_status_ == is_status) { 32 | + command_queue_.front().GetCallback()->Invoke(std::move(response_view)); 33 | + } else { 34 | + CommandCompleteView command_complete_view = CommandCompleteView::Create( 35 | + EventView::Create(PacketView(std::make_shared>(std::vector())))); 36 | + command_queue_.front().GetCallback()->Invoke(std::move(command_complete_view)); 37 | + } 38 | } 39 | 40 | command_queue_.pop_front(); 41 | -- 42 | 2.34.1 43 | 44 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_netd/0002-Don-t-fail-on-FTP-conntracking-failing.patch: -------------------------------------------------------------------------------- 1 | From d91817817a1012cc644237496c4b252cea9cbaa5 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 29 Jul 2019 18:09:12 +0200 4 | Subject: [PATCH 2/4] Don't fail on FTP conntracking failing 5 | 6 | The issue has been seen on some Samsung devices. 7 | See https://github.com/phhusson/treble_experimentations/issues/425 8 | 9 | Thanks @zamrih for pin-pointing the issue and validating fix 10 | 11 | Change-Id: I3d9c865eb5a4b421f9983210c2ceae62b4906234 12 | --- 13 | server/TetherController.cpp | 12 +++++++++--- 14 | 1 file changed, 9 insertions(+), 3 deletions(-) 15 | 16 | diff --git a/server/TetherController.cpp b/server/TetherController.cpp 17 | index d867cea4a..00c979d82 100644 18 | --- a/server/TetherController.cpp 19 | +++ b/server/TetherController.cpp 20 | @@ -722,13 +722,19 @@ int TetherController::setForwardRules(bool add, const char *intIface, const char 21 | return -EREMOTEIO; 22 | } 23 | 24 | - std::vector v4 = { 25 | + std::vector v4Ftp = { 26 | "*raw", 27 | - StringPrintf("%s %s -p tcp --dport 21 -i %s -j CT --helper ftp", op, 28 | - LOCAL_RAW_PREROUTING, intIface), 29 | + StringPrintf("%s %s -p tcp --dport 21 -i %s -j CT --helper ftp", 30 | + op, LOCAL_RAW_PREROUTING, intIface), 31 | StringPrintf("%s %s -p tcp --dport 1723 -i %s -j CT --helper pptp", op, 32 | LOCAL_RAW_PREROUTING, intIface), 33 | "COMMIT", 34 | + }; 35 | + if(iptablesRestoreFunction(V4, Join(v4Ftp, '\n'), nullptr) == -1) { 36 | + ALOGE("Failed adding iptables CT target on FTP."); 37 | + } 38 | + 39 | + std::vector v4 = { 40 | "*filter", 41 | StringPrintf("%s %s -i %s -o %s -m state --state ESTABLISHED,RELATED -g %s", op, 42 | LOCAL_FORWARD, extIface, intIface, LOCAL_TETHER_COUNTERS_CHAIN), 43 | -- 44 | 2.34.1 45 | 46 | -------------------------------------------------------------------------------- /patches/personal/platform_frameworks_base/0003-monet-Use-Style.SPRITZ-by-default.patch: -------------------------------------------------------------------------------- 1 | From 67b3854a3467be5f5b47c782643a16905c87dc9e Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Sun, 26 Feb 2023 22:13:35 +0000 4 | Subject: [PATCH 3/9] monet: Use Style.SPRITZ by default 5 | 6 | Change-Id: Ia44ba56c8daa07033b290de89bb300bda9d39d86 7 | --- 8 | .../com/android/systemui/theme/ThemeOverlayController.java | 6 +++--- 9 | 1 file changed, 3 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java 12 | index 5a9f5d5a72d2..c93693170126 100644 13 | --- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java 14 | +++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java 15 | @@ -147,7 +147,7 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { 16 | private float mContrast = 0; 17 | // Theme variant: Vibrant, Tonal, Expressive, etc 18 | @VisibleForTesting 19 | - protected Style mThemeStyle = Style.TONAL_SPOT; 20 | + protected Style mThemeStyle = Style.SPRITZ; 21 | // Accent colors overlay 22 | private FabricatedOverlay mSecondaryOverlay; 23 | // Neutral system colors overlay 24 | @@ -803,11 +803,11 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { 25 | style = Style.valueOf( 26 | object.getString(ThemeOverlayApplier.OVERLAY_CATEGORY_THEME_STYLE)); 27 | if (!validStyles.contains(style)) { 28 | - style = Style.TONAL_SPOT; 29 | + style = Style.SPRITZ; 30 | } 31 | } catch (JSONException | IllegalArgumentException e) { 32 | Log.i(TAG, "Failed to parse THEME_CUSTOMIZATION_OVERLAY_PACKAGES.", e); 33 | - style = Style.TONAL_SPOT; 34 | + style = Style.SPRITZ; 35 | } 36 | } 37 | return style; 38 | -- 39 | 2.34.1 40 | 41 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_vold/0004-Exfat-can-be-mounted-with-exfat-kernel-fs-driver-or-.patch: -------------------------------------------------------------------------------- 1 | From 142a57c74b41f207844352186980e613cedc084f Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 18 Oct 2022 16:08:09 -0400 4 | Subject: [PATCH 4/5] Exfat can be mounted with "exfat" kernel fs driver, or 5 | "sdfat" or "texfat" (Samsung and Sony variants) 6 | 7 | --- 8 | fs/Exfat.cpp | 11 ++++++++--- 9 | 1 file changed, 8 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp 12 | index c8b19e03..9e34347b 100644 13 | --- a/fs/Exfat.cpp 14 | +++ b/fs/Exfat.cpp 15 | @@ -35,7 +35,9 @@ static const char* kFsckPath = "/system/bin/fsck.exfat"; 16 | 17 | bool IsSupported() { 18 | return access(kMkfsPath, X_OK) == 0 && access(kFsckPath, X_OK) == 0 && 19 | - IsFilesystemSupported("exfat"); 20 | + (IsFilesystemSupported("exfat") || 21 | + IsFilesystemSupported("texfat") || 22 | + IsFilesystemSupported("sdfat")); 23 | } 24 | 25 | status_t Check(const std::string& source) { 26 | @@ -61,13 +63,16 @@ status_t Mount(const std::string& source, const std::string& target, int ownerUi 27 | auto mountData = android::base::StringPrintf("uid=%d,gid=%d,fmask=%o,dmask=%o", ownerUid, 28 | ownerGid, permMask, permMask); 29 | 30 | - if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) { 31 | + const char* fs = "exfat"; 32 | + if (IsFilesystemSupported("sdfat")) fs = "sdfat"; 33 | + if (IsFilesystemSupported("texfat")) fs = "texfat"; 34 | + if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) { 35 | return 0; 36 | } 37 | 38 | PLOG(ERROR) << "Mount failed; attempting read-only"; 39 | mountFlags |= MS_RDONLY; 40 | - if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) { 41 | + if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) { 42 | return 0; 43 | } 44 | 45 | -- 46 | 2.34.1 47 | 48 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0026-Dynamically-resize-boot-animation-to-match-screen-si.patch: -------------------------------------------------------------------------------- 1 | From 1c24625fe4c96b98df622db824c4f3a9fd0a2611 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 20 Dec 2021 15:01:41 -0500 4 | Subject: [PATCH 26/49] Dynamically resize boot animation to match screen size 5 | 6 | Change-Id: I54e49fc6b8c670103852e212d1416e27ff976205 7 | --- 8 | cmds/bootanimation/BootAnimation.cpp | 22 ++++++++++++++++++++++ 9 | 1 file changed, 22 insertions(+) 10 | 11 | diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp 12 | index a8b6c0b70804..9c50e954cee5 100644 13 | --- a/cmds/bootanimation/BootAnimation.cpp 14 | +++ b/cmds/bootanimation/BootAnimation.cpp 15 | @@ -605,6 +605,28 @@ status_t BootAnimation::readyToRun() { 16 | mFlingerSurface = s; 17 | mTargetInset = -1; 18 | 19 | + if ( mAnimation != nullptr ) { 20 | + SLOGE("Got screen size %d, animation size %d", mWidth, mAnimation->width); 21 | + int origWidth = mAnimation->width; 22 | + if ( mAnimation->width*2 < mWidth ) { 23 | + SLOGE("Making animation bigger"); 24 | + mAnimation->width *= 2; 25 | + mAnimation->height *= 2; 26 | + } else if ( mWidth < mAnimation->width ) { 27 | + SLOGE("Making animation smaller"); 28 | + mAnimation->width /= 2; 29 | + mAnimation->height /= 2; 30 | + } 31 | + for (Animation::Part& part : mAnimation->parts) { 32 | + for(auto& frame: part.frames) { 33 | + if(frame.trimWidth == origWidth && frame.trimX == 0 && frame.trimY == 0) { 34 | + frame.trimWidth = mAnimation->width; 35 | + frame.trimHeight = mAnimation->height; 36 | + } 37 | + } 38 | + } 39 | + } 40 | + 41 | // Rotate the boot animation according to the value specified in the sysprop 42 | // ro.bootanim.set_orientation_. Four values are supported: ORIENTATION_0, 43 | // ORIENTATION_90, ORIENTATION_180 and ORIENTATION_270. 44 | -- 45 | 2.34.1 46 | 47 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0007-Detect-allowed-sdcard-options-based-on-vndk.patch: -------------------------------------------------------------------------------- 1 | From e1098c0c5a7df486271a7a772c3ec8b36c42686d Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 14 Aug 2018 19:33:03 +0200 4 | Subject: [PATCH 07/26] Detect allowed sdcard options based on vndk 5 | 6 | Some kernel crashes when using too recent sdcardfs options 7 | 8 | Change-Id: I632e485f9b2a09a46d4a1fde2ea15217f8d92eff 9 | --- 10 | sdcard/sdcard.cpp | 8 +++++--- 11 | 1 file changed, 5 insertions(+), 3 deletions(-) 12 | 13 | diff --git a/sdcard/sdcard.cpp b/sdcard/sdcard.cpp 14 | index 622de5b7a1..e580190e9d 100644 15 | --- a/sdcard/sdcard.cpp 16 | +++ b/sdcard/sdcard.cpp 17 | @@ -32,6 +32,7 @@ 18 | #include 19 | #include 20 | #include 21 | +#include 22 | #include 23 | #include 24 | 25 | @@ -103,11 +104,12 @@ static bool sdcardfs_setup(const std::string& source_path, const std::string& de 26 | mode_t mask, bool derive_gid, bool default_normal, bool unshared_obb, 27 | bool use_esdfs) { 28 | // Add new options at the end of the vector. 29 | + int vndk = android::base::GetIntProperty("ro.vndk.version", 29); 30 | std::vector new_opts_list; 31 | if (multi_user) new_opts_list.push_back("multiuser,"); 32 | - if (derive_gid) new_opts_list.push_back("derive_gid,"); 33 | - if (default_normal) new_opts_list.push_back("default_normal,"); 34 | - if (unshared_obb) new_opts_list.push_back("unshared_obb,"); 35 | + if (derive_gid && vndk >= 27) new_opts_list.push_back("derive_gid,"); 36 | + if (default_normal && vndk >= 28) new_opts_list.push_back("default_normal,"); 37 | + if (unshared_obb && vndk >= 29) new_opts_list.push_back("unshared_obb,"); 38 | // Try several attempts, each time with one less option, to gracefully 39 | // handle older kernels that aren't updated yet. 40 | for (int i = 0; i <= new_opts_list.size(); ++i) { 41 | -- 42 | 2.34.1 43 | 44 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0014-Fix-brightness-range-not-being-complete-on-Samsung-d.patch: -------------------------------------------------------------------------------- 1 | From bf3fb33e5b715ab688e4b3f78837062c1dba0b74 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 29 Sep 2020 22:40:10 +0200 4 | Subject: [PATCH 14/49] Fix brightness range not being complete on Samsung 5 | devices 6 | 7 | On some devices, minimum brightness is 0, which totally messes with 8 | Brightness computations (minimum float brightness becomes -1.0 instead 9 | of 0.0...). 10 | Cheat and have them report 1 as minimum instead, which fixes the slope 11 | 12 | Change-Id: I4d97cbc32490949e83272b81ec6320a5483310b1 13 | --- 14 | .../java/com/android/server/power/PowerManagerService.java | 6 ++++-- 15 | 1 file changed, 4 insertions(+), 2 deletions(-) 16 | 17 | diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java 18 | index d82f7a56a830..fe397d53c5d6 100644 19 | --- a/services/core/java/com/android/server/power/PowerManagerService.java 20 | +++ b/services/core/java/com/android/server/power/PowerManagerService.java 21 | @@ -1191,9 +1191,11 @@ public final class PowerManagerService extends SystemService 22 | 23 | if (min == INVALID_BRIGHTNESS_IN_CONFIG || max == INVALID_BRIGHTNESS_IN_CONFIG 24 | || def == INVALID_BRIGHTNESS_IN_CONFIG) { 25 | + int correctedMin = mContext.getResources().getInteger(com.android.internal.R.integer 26 | + .config_screenBrightnessSettingMinimum); 27 | + if(correctedMin == 0) correctedMin = 1; 28 | mScreenBrightnessMinimum = BrightnessSynchronizer.brightnessIntToFloat( 29 | - mContext.getResources().getInteger(com.android.internal.R.integer 30 | - .config_screenBrightnessSettingMinimum)); 31 | + correctedMin); 32 | mScreenBrightnessMaximum = BrightnessSynchronizer.brightnessIntToFloat( 33 | mContext.getResources().getInteger(com.android.internal.R.integer 34 | .config_screenBrightnessSettingMaximum)); 35 | -- 36 | 2.34.1 37 | 38 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_Bluetooth/0007-Add-a-property-to-cap-declared-le-vendor-version.-Fo.patch: -------------------------------------------------------------------------------- 1 | From 3ff08cb17b5fcbc0c1c7cbbc1cf368692db78753 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 30 May 2023 17:34:03 -0400 4 | Subject: [PATCH 7/8] Add a property to cap declared le vendor version. Found 5 | needed on unisoc 6 | 7 | --- 8 | system/gd/hci/controller.cc | 11 +++++++++++ 9 | 1 file changed, 11 insertions(+) 10 | 11 | diff --git a/system/gd/hci/controller.cc b/system/gd/hci/controller.cc 12 | index 66b7de6b5e2..a51382cd0d8 100644 13 | --- a/system/gd/hci/controller.cc 14 | +++ b/system/gd/hci/controller.cc 15 | @@ -603,6 +603,13 @@ struct Controller::impl { 16 | if (complete_view.IsValid()) { 17 | vendor_capabilities_.is_supported_ = 0x01; 18 | 19 | + int vendor_cap_max = 0xffff; 20 | + std::string vendor_cap_max_prop = GetSystemProperty("persist.sys.bt.max_vendor_cap").value_or(""); 21 | + if (vendor_cap_max_prop != "") { 22 | + vendor_cap_max = std::stoi(vendor_cap_max_prop); 23 | + } 24 | + if (vendor_cap_max < 55) return; 25 | + 26 | // v0.55 27 | BaseVendorCapabilities base_vendor_capabilities = complete_view.GetBaseVendorCapabilities(); 28 | vendor_capabilities_.max_advt_instances_ = base_vendor_capabilities.max_advt_instances_; 29 | @@ -618,6 +625,8 @@ struct Controller::impl { 30 | return; 31 | } 32 | 33 | + if (vendor_cap_max < 95) return; 34 | + 35 | // v0.95 36 | auto v95 = LeGetVendorCapabilitiesComplete095View::Create(complete_view); 37 | if (!v95.IsValid()) { 38 | @@ -632,6 +641,7 @@ struct Controller::impl { 39 | return; 40 | } 41 | 42 | + if (vendor_cap_max < 96) return; 43 | // v0.96 44 | auto v96 = LeGetVendorCapabilitiesComplete096View::Create(v95); 45 | if (!v96.IsValid()) { 46 | @@ -643,6 +653,7 @@ struct Controller::impl { 47 | return; 48 | } 49 | 50 | + if (vendor_cap_max < 98) return; 51 | // v0.98 52 | auto v98 = LeGetVendorCapabilitiesComplete098View::Create(v96); 53 | if (!v98.IsValid()) { 54 | -- 55 | 2.34.1 56 | 57 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0005-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch: -------------------------------------------------------------------------------- 1 | From c29a02edb7f8e45f9e20ef0e5ef8961635e6bb4e Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 17 May 2018 20:28:35 +0200 4 | Subject: [PATCH 05/49] Don't crash if there is IR HAL is not declared 5 | 6 | Change-Id: I3afded27441bbee8244d5fda544b3e6d1238dc1b 7 | --- 8 | .../core/java/com/android/server/ConsumerIrService.java | 8 -------- 9 | .../core/jni/com_android_server_ConsumerIrService.cpp | 2 +- 10 | 2 files changed, 1 insertion(+), 9 deletions(-) 11 | 12 | diff --git a/services/core/java/com/android/server/ConsumerIrService.java b/services/core/java/com/android/server/ConsumerIrService.java 13 | index ee6d808aa549..be8e2bb95ece 100644 14 | --- a/services/core/java/com/android/server/ConsumerIrService.java 15 | +++ b/services/core/java/com/android/server/ConsumerIrService.java 16 | @@ -53,14 +53,6 @@ public class ConsumerIrService extends IConsumerIrService.Stub { 17 | mWakeLock.setReferenceCounted(true); 18 | 19 | mHasNativeHal = getHalService(); 20 | - 21 | - if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CONSUMER_IR)) { 22 | - if (!mHasNativeHal) { 23 | - throw new RuntimeException("FEATURE_CONSUMER_IR present, but no IR HAL loaded!"); 24 | - } 25 | - } else if (mHasNativeHal) { 26 | - throw new RuntimeException("IR HAL present, but FEATURE_CONSUMER_IR is not set!"); 27 | - } 28 | } 29 | 30 | @Override 31 | diff --git a/services/core/jni/com_android_server_ConsumerIrService.cpp b/services/core/jni/com_android_server_ConsumerIrService.cpp 32 | index 63daa3503bd5..d068ec06fc14 100644 33 | --- a/services/core/jni/com_android_server_ConsumerIrService.cpp 34 | +++ b/services/core/jni/com_android_server_ConsumerIrService.cpp 35 | @@ -36,7 +36,7 @@ static sp mHal; 36 | 37 | static jboolean getHidlHalService(JNIEnv * /* env */, jobject /* obj */) { 38 | // TODO(b/31632518) 39 | - mHal = IConsumerIr::getService(); 40 | + mHal = IConsumerIr::tryGetService(); 41 | return mHal != nullptr; 42 | } 43 | 44 | -- 45 | 2.34.1 46 | 47 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_libs_net/0001-Restore-back-the-behavior-of-isValid-It-is-legal-to-.patch: -------------------------------------------------------------------------------- 1 | From 59ec627f36542896a6d839cd33796c9fa79a8b40 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 26 Oct 2022 18:02:18 -0400 4 | Subject: [PATCH] Restore back the behavior of isValid(): It is legal to have 5 | non-working BpfMap. Dont abort a whole process (system_server...) just 6 | because we cant access bpf map. Also add isOk to include the additional 7 | checks for newer kernel versions 8 | 9 | Change-Id: Ie7815c186400614f0c6b483c04aa8971af348380 10 | --- 11 | common/native/bpf_headers/include/bpf/BpfMap.h | 16 ++++++++++------ 12 | 1 file changed, 10 insertions(+), 6 deletions(-) 13 | 14 | diff --git a/common/native/bpf_headers/include/bpf/BpfMap.h b/common/native/bpf_headers/include/bpf/BpfMap.h 15 | index 51e6d162..6d74ff3a 100644 16 | --- a/common/native/bpf_headers/include/bpf/BpfMap.h 17 | +++ b/common/native/bpf_headers/include/bpf/BpfMap.h 18 | @@ -54,21 +54,25 @@ class BpfMap { 19 | 20 | private: 21 | void abortOnKeyOrValueSizeMismatch() { 22 | - if (!mMapFd.ok()) abort(); 23 | - if (isAtLeastKernelVersion(4, 14, 0)) { 24 | - if (bpfGetFdKeySize(mMapFd) != sizeof(Key)) abort(); 25 | - if (bpfGetFdValueSize(mMapFd) != sizeof(Value)) abort(); 26 | - } 27 | + if (!isOk()) abort(); 28 | } 29 | 30 | protected: 31 | // flag must be within BPF_OBJ_FLAG_MASK, ie. 0, BPF_F_RDONLY, BPF_F_WRONLY 32 | BpfMap(const char* pathname, uint32_t flags) { 33 | mMapFd.reset(mapRetrieve(pathname, flags)); 34 | - abortOnKeyOrValueSizeMismatch(); 35 | } 36 | 37 | public: 38 | + bool isOk() { 39 | + if (!mMapFd.ok()) return false; 40 | + if (isAtLeastKernelVersion(4, 14, 0)) { 41 | + if (bpfGetFdKeySize(mMapFd) != sizeof(Key)) return false; 42 | + if (bpfGetFdValueSize(mMapFd) != sizeof(Value)) return false; 43 | + } 44 | + return true; 45 | + } 46 | + 47 | explicit BpfMap(const char* pathname) : BpfMap(pathname, 0) {} 48 | 49 | #ifdef BPF_MAP_MAKE_VISIBLE_FOR_TESTING 50 | -- 51 | 2.34.1 52 | 53 | -------------------------------------------------------------------------------- /manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0001-Disable-vendor-mismatch-warning.patch: -------------------------------------------------------------------------------- 1 | From c8c8583a915b469b6adbe8cdd3808487175d8268 Mon Sep 17 00:00:00 2001 2 | From: Andy CrossGate Yan 3 | Date: Thu, 5 Apr 2018 10:01:19 +0800 4 | Subject: [PATCH 01/49] Disable vendor mismatch warning 5 | 6 | Change-Id: Ieb8fe91e2f02462f074312ed0f4885d183e9780b 7 | --- 8 | .../server/wm/ActivityTaskManagerService.java | 16 ++-------------- 9 | 1 file changed, 2 insertions(+), 14 deletions(-) 10 | 11 | diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java 12 | index d7489f2c7b91..8e890a39e6de 100644 13 | --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java 14 | +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java 15 | @@ -6094,20 +6094,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { 16 | } 17 | 18 | if (!Build.isBuildConsistent()) { 19 | - Slog.e(TAG, "Build fingerprint is not consistent, warning user"); 20 | - mUiHandler.post(() -> { 21 | - if (mShowDialogs) { 22 | - AlertDialog d = new BaseErrorDialog(mUiContext); 23 | - d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR); 24 | - d.setCancelable(false); 25 | - d.setTitle(mUiContext.getText(R.string.android_system_label)); 26 | - d.setMessage(mUiContext.getText(R.string.system_error_manufacturer)); 27 | - d.setButton(DialogInterface.BUTTON_POSITIVE, 28 | - mUiContext.getText(R.string.ok), 29 | - mUiHandler.obtainMessage(DISMISS_DIALOG_UI_MSG, d)); 30 | - d.show(); 31 | - } 32 | - }); 33 | + Slog.e(TAG, "Build fingerprint is not consistent"); 34 | + // Do not emit warning about vendor mismatch 35 | } 36 | } 37 | } 38 | -- 39 | 2.34.1 40 | 41 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0010-Add-a-property-to-force-camera-timestamp-source.patch: -------------------------------------------------------------------------------- 1 | From de6ccad028f04d3489280a4637322fe825283209 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 19 May 2020 14:01:14 +0200 4 | Subject: [PATCH 10/23] Add a property to force camera timestamp source 5 | 6 | Some devices wrongly report their timesource 7 | Camera's timesource can either be CLOCK_MONOTONIC, or CLOCK_BOOTTIME 8 | The former doesn't increment in sleep, while the later does. 9 | There is a camera HAL property for that, though some devices don't 10 | report it properly. 11 | 12 | This issue happens on Xiaomi Redmi 7A, it needs to force the value to 1 13 | 14 | Add a property persist.sys.phh.camera.force_timestampsource to force 15 | timestamp source. 16 | --- 17 | .../libcameraservice/device3/Camera3Device.cpp | 12 ++++++++++-- 18 | 1 file changed, 10 insertions(+), 2 deletions(-) 19 | 20 | diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp 21 | index c3f6e4925e..971d40f7fd 100644 22 | --- a/services/camera/libcameraservice/device3/Camera3Device.cpp 23 | +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp 24 | @@ -211,8 +211,16 @@ status_t Camera3Device::initializeCommonLocked() { 25 | mTimestampOffset = getMonoToBoottimeOffset(); 26 | camera_metadata_entry timestampSource = 27 | mDeviceInfo.find(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE); 28 | - if (timestampSource.count > 0 && timestampSource.data.u8[0] == 29 | - ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME) { 30 | + int timestampSourceValue = 0; 31 | + if ((timestampSource.count > 0 && timestampSource.data.u8[0] == 32 | + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME)) { 33 | + timestampSourceValue = 1; 34 | + } 35 | + int forceTimestampSource = property_get_int32("persist.sys.phh.camera.force_timestampsource", -1); 36 | + //Don't override if it's -1, default value 37 | + if(forceTimestampSource == 0) timestampSourceValue = 0; 38 | + if(forceTimestampSource == 1) timestampSourceValue = 1; 39 | + if (timestampSourceValue == 1) { 40 | mDeviceTimeBaseIsRealtime = true; 41 | } 42 | 43 | -- 44 | 2.34.1 45 | 46 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0023-Add-a-prop-to-fix-echo-on-incoming-or-outgoing-calls.patch: -------------------------------------------------------------------------------- 1 | From 524489bffa97448b4e80cde2fcd63a0bcb39cc6d Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Sun, 5 Nov 2023 15:18:03 +0000 4 | Subject: [PATCH 23/23] Add a prop to fix echo on incoming or outgoing calls 5 | 6 | May even fix audio calls altogether. 7 | 8 | Change-Id: I3a05608ad7b3f0876160d5f6a12b7c529b8f0961 9 | --- 10 | .../common/managerdefinitions/src/Serializer.cpp | 6 ++++++ 11 | 1 file changed, 6 insertions(+) 12 | 13 | diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 14 | index 913cbc0e90..6bf5d14c3c 100644 15 | --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 16 | +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 17 | @@ -667,6 +667,9 @@ std::variant PolicySerializer::deserialize PolicySerializer::deserialize source = ctx->findPortByTagName(devTag); 36 | if (source == NULL) { 37 | -- 38 | 2.34.1 39 | 40 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0021-Automatically-detect-pick-up-sensor-so-that-an-overl.patch: -------------------------------------------------------------------------------- 1 | From 6a3eb0f2aa29512d606e0709d6775e8278d1a520 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 20 Mar 2021 14:31:01 +0100 4 | Subject: [PATCH 21/49] Automatically detect pick up sensor, so that an overlay 5 | is required for the sole purpose of enabling pulse doze on pick up sensor 6 | 7 | --- 8 | .../display/AmbientDisplayConfiguration.java | 19 +++++++++++++++++-- 9 | 1 file changed, 17 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/core/java/android/hardware/display/AmbientDisplayConfiguration.java b/core/java/android/hardware/display/AmbientDisplayConfiguration.java 12 | index 47541ca16cda..28168b9208f5 100644 13 | --- a/core/java/android/hardware/display/AmbientDisplayConfiguration.java 14 | +++ b/core/java/android/hardware/display/AmbientDisplayConfiguration.java 15 | @@ -25,6 +25,9 @@ import android.text.TextUtils; 16 | import android.util.ArrayMap; 17 | import android.util.SparseArray; 18 | 19 | +import android.hardware.SensorManager; 20 | +import android.hardware.Sensor; 21 | + 22 | import com.android.internal.R; 23 | import com.android.internal.util.ArrayUtils; 24 | 25 | @@ -105,8 +108,20 @@ public class AmbientDisplayConfiguration { 26 | 27 | /** @hide */ 28 | public boolean dozePickupSensorAvailable() { 29 | - return mContext.getResources().getBoolean(R.bool.config_dozePulsePickup); 30 | - } 31 | + SensorManager sm = mContext.getSystemService(SensorManager.class); 32 | + boolean found = false; 33 | + if(sm == null) { 34 | + android.util.Log.d("PHH", "Failed getting sensor manager, can't detect pickup sensor"); 35 | + } else { 36 | + java.util.List sensors = sm.getSensorList(Sensor.TYPE_ALL); 37 | + for(Sensor s : sensors) { 38 | + if(Sensor.STRING_TYPE_PICK_UP_GESTURE.equals(s.getStringType())) { 39 | + found = true; 40 | + break; 41 | + } 42 | + } 43 | + } 44 | + return mContext.getResources().getBoolean(R.bool.config_dozePulsePickup) || found; } 45 | 46 | /** @hide */ 47 | public boolean tapGestureEnabled(int user) { 48 | -- 49 | 2.34.1 50 | 51 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0008-Re-order-services-so-that-it-works-even-without-qtag.patch: -------------------------------------------------------------------------------- 1 | From e2181e1008b5d0cefa4e0ae543ae4ce2a47cdd14 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 8 Nov 2018 23:04:03 +0100 4 | Subject: [PATCH 08/49] Re-order services so that it works even without qtaguid 5 | 6 | Change-Id: I0c0f527b3ae151d45c68f7ac6c205da3f34e74df 7 | --- 8 | .../android/server/net/NetworkPolicyManagerService.java | 8 ++++---- 9 | 1 file changed, 4 insertions(+), 4 deletions(-) 10 | 11 | diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java 12 | index b7082690276c..ab190a39e2e6 100644 13 | --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java 14 | +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java 15 | @@ -925,6 +925,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { 16 | Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "systemReady"); 17 | final int oldPriority = Process.getThreadPriority(Process.myTid()); 18 | try { 19 | + mUsageStats = LocalServices.getService(UsageStatsManagerInternal.class); 20 | + mAppStandby = LocalServices.getService(AppStandbyInternal.class); 21 | + mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class); 22 | + 23 | // Boost thread's priority during system server init 24 | Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND); 25 | if (!isBandwidthControlEnabled()) { 26 | @@ -932,10 +936,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { 27 | return; 28 | } 29 | 30 | - mUsageStats = LocalServices.getService(UsageStatsManagerInternal.class); 31 | - mAppStandby = LocalServices.getService(AppStandbyInternal.class); 32 | - mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class); 33 | - 34 | synchronized (mUidRulesFirstLock) { 35 | synchronized (mNetworkPoliciesSecondLock) { 36 | updatePowerSaveWhitelistUL(); 37 | -- 38 | 2.34.1 39 | 40 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0008-There-are-three-SCO-devices.-Fallback-from-one-to-th.patch: -------------------------------------------------------------------------------- 1 | From d8bb35a09967c6d0f42950595dc1b396594b4835 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 13 Apr 2020 21:01:16 +0200 4 | Subject: [PATCH 08/23] There are three SCO devices. Fallback from one to the 5 | others if needed 6 | 7 | Change-Id: I414dcb6b154855c00cb8520b23dc1069827864b2 8 | --- 9 | .../managerdefinitions/src/HwModule.cpp | 21 +++++++++++++++++++ 10 | 1 file changed, 21 insertions(+) 11 | 12 | diff --git a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp 13 | index 5f14ee4623..166ab7acbb 100644 14 | --- a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp 15 | +++ b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp 16 | @@ -318,6 +318,27 @@ sp HwModuleCollection::getModuleForDeviceType(audio_devices_t type, 17 | } 18 | } 19 | } 20 | + //We didn't find one? Ok but all SCOs are equivalent surely? 21 | + if(type == AUDIO_DEVICE_OUT_BLUETOOTH_SCO || 22 | + type == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET || 23 | + type == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) { 24 | + ALOGE("Fallback SCO"); 25 | + if(type != AUDIO_DEVICE_OUT_BLUETOOTH_SCO) { 26 | + auto ret = getModuleForDeviceType(AUDIO_DEVICE_OUT_BLUETOOTH_SCO, encodedFormat); 27 | + ALOGE("Fallback SCO simple? %s", (ret != nullptr) ? "yes" : "no"); 28 | + if(ret != nullptr) return ret; 29 | + } 30 | + if(type != AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET) { 31 | + auto ret = getModuleForDeviceType(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET, encodedFormat); 32 | + ALOGE("Fallback SCO headset? %s", (ret != nullptr) ? "yes" : "no"); 33 | + if(ret != nullptr) return ret; 34 | + } 35 | + if(type != AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) { 36 | + auto ret = getModuleForDeviceType(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT, encodedFormat); 37 | + ALOGE("Fallback SCO carkit? %s", (ret != nullptr) ? "yes" : "no"); 38 | + if(ret != nullptr) return ret; 39 | + } 40 | + } 41 | return nullptr; 42 | } 43 | 44 | -- 45 | 2.34.1 46 | 47 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_opt_telephony/0004-Reintroduce-public-void-TelephonyMetrics.writeRilSen.patch: -------------------------------------------------------------------------------- 1 | From 983917e3066113b54855bc0c62f9fd6d3332076a Mon Sep 17 00:00:00 2001 2 | From: ironydelerium <42721860+ironydelerium@users.noreply.github.com> 3 | Date: Fri, 31 Dec 2021 02:20:28 -0800 4 | Subject: [PATCH 04/11] Reintroduce 'public void 5 | TelephonyMetrics.writeRilSendSms(int, int, int, int)'. (#8) 6 | 7 | The MediaTek IMS package for Android Q, at the very least (likely for the rest, too) 8 | invoke this method in their `sendSms` method; Google, in their infinite wisdom, 9 | decided that this method needed a message ID passed in as well, changing the signature 10 | to 'public void TelephonyMetrics.writeRilSendSms(int, int, int, int, long)' and resulting 11 | in a MethodNotFoundException being raised in com.mediatek.ims, crashing it. 12 | 13 | Fixes https://github.com/phhusson/treble_experimentations/issues/2125. 14 | 15 | Co-authored-by: Sarah Vandomelen 16 | --- 17 | .../telephony/metrics/TelephonyMetrics.java | 13 +++++++++++++ 18 | 1 file changed, 13 insertions(+) 19 | 20 | diff --git a/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java b/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java 21 | index 3fdbfe0ed7..fb8011c3df 100644 22 | --- a/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java 23 | +++ b/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java 24 | @@ -2320,6 +2320,19 @@ public class TelephonyMetrics { 25 | smsSession.increaseExpectedResponse(); 26 | } 27 | 28 | + /** 29 | + * Write Send SMS event (backwards-compatible method for R and earlier IMS implementations) 30 | + * 31 | + * @param phoneId Phone id 32 | + * @param rilSerial RIL request serial number 33 | + * @param tech SMS RAT 34 | + * @param format SMS format. Either {@link SmsMessage#FORMAT_3GPP} or 35 | + * {@link SmsMessage#FORMAT_3GPP2}. 36 | + */ 37 | + public void writeRilSendSms(int phoneId, int rilSerial, int tech, int format) { 38 | + writeRilSendSms(phoneId, rilSerial, tech, format, 0); 39 | + } 40 | + 41 | /** 42 | * Write Send SMS event using ImsService. Expecting response from 43 | * {@link #writeOnSmsSolicitedResponse}. 44 | -- 45 | 2.34.1 46 | 47 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0020-voip-Fix-high-pitched-voice-on-Qualcomm-devices.patch: -------------------------------------------------------------------------------- 1 | From 04c81572fcc09b2466f04feb4bf97480e087ba1b Mon Sep 17 00:00:00 2001 2 | From: ponces 3 | Date: Mon, 24 Oct 2022 09:38:34 +0100 4 | Subject: [PATCH 20/23] voip: Fix high pitched voice on Qualcomm devices 5 | 6 | --- 7 | .../common/managerdefinitions/src/Serializer.cpp | 9 +++++++++ 8 | 1 file changed, 9 insertions(+) 9 | 10 | diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 11 | index d2fcc13b00..fc6cc72c1c 100644 12 | --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 13 | +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 14 | @@ -252,6 +252,7 @@ private: 15 | std::string mChannelMasksSeparator = ","; 16 | std::string mSamplingRatesSeparator = ","; 17 | std::string mFlagsSeparator = "|"; 18 | + std::string mMixPortName = ""; 19 | 20 | // Children: ModulesTraits, VolumeTraits, SurroundSoundTraits (optional) 21 | }; 22 | @@ -436,6 +437,13 @@ PolicySerializer::deserialize( 23 | channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ","); 24 | } 25 | 26 | + // This breaks in-game voice chat and audio in some messaging apps causing it to play with a higher pitch and speed 27 | + bool disableStereoVoip = property_get_bool("persist.sys.phh.disable_stereo_voip", false); 28 | + if (disableStereoVoip && mMixPortName == "voip_rx") { 29 | + ALOGI("%s: disabling stereo support on voip_rx", __func__); 30 | + channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ","); 31 | + } 32 | + 33 | if (mIgnoreVendorExtensions && maybeVendorExtension(format)) { 34 | ALOGI("%s: vendor extension format \"%s\" skipped", __func__, format.c_str()); 35 | return NO_INIT; 36 | @@ -458,6 +466,7 @@ std::variant PolicySerializer::deserialize 3 | Date: Mon, 30 Oct 2023 19:25:27 -0400 4 | Subject: [PATCH 44/49] Add a prop to use linear backlight control 5 | 6 | --- 7 | .../settings/brightness/BrightnessController.java | 10 ++++++++-- 8 | 1 file changed, 8 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java 11 | index 6af9b739da52..65e32255dcad 100644 12 | --- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java 13 | +++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java 14 | @@ -346,9 +346,15 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig 15 | : MetricsEvent.ACTION_BRIGHTNESS; 16 | minBacklight = mBrightnessMin; 17 | maxBacklight = mBrightnessMax; 18 | - final float valFloat = MathUtils.min( 19 | + float valFloat = MathUtils.min( 20 | convertGammaToLinearFloat(value, minBacklight, maxBacklight), 21 | maxBacklight); 22 | + if (android.os.SystemProperties.getBoolean("persist.sys.phh.linear_brightness", false)) { 23 | + android.util.Log.e("PHH", "Linear brightness val " + value + " from " + minBacklight + " to " + maxBacklight + " makes " + valFloat); 24 | + valFloat = value / 65536.0f; 25 | + } 26 | + final float finalValFloat = valFloat; 27 | + 28 | if (stopTracking) { 29 | // TODO(brightnessfloat): change to use float value instead. 30 | MetricsLogger.action(mContext, metric, 31 | @@ -359,7 +365,7 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig 32 | if (!tracking) { 33 | AsyncTask.execute(new Runnable() { 34 | public void run() { 35 | - mDisplayManager.setBrightness(mDisplayId, valFloat); 36 | + mDisplayManager.setBrightness(mDisplayId, finalValFloat); 37 | } 38 | }); 39 | } 40 | -- 41 | 2.34.1 42 | 43 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0006-audiopolicy-try-again-with-trimmed-audio-port-name-i.patch: -------------------------------------------------------------------------------- 1 | From e2e2b65c9a34ac8b27b822a9bca3430da4b5e010 Mon Sep 17 00:00:00 2001 2 | From: Peter Cai 3 | Date: Thu, 23 Jan 2020 11:13:43 +0800 4 | Subject: [PATCH 06/23] audiopolicy: try again with trimmed audio port name if 5 | not found 6 | 7 | * In Spreadtrum BSP, some audio routes may contain ports with extra 8 | spaces at the beginning and the end, causing audiopolicy to refuse to 9 | load and leading to broken audio. 10 | 11 | * Fix this by retrying with trimmed port name when not found. Do not 12 | use trimmed name all the time because a white space is a valid 13 | character in port name, and we cannot be sure nobody is using it for 14 | legitimite purposes. 15 | 16 | Change-Id: I993708b28e8404bc8c483d71a850ac69382231bd 17 | --- 18 | .../common/managerdefinitions/src/Serializer.cpp | 14 ++++++++++++++ 19 | 1 file changed, 14 insertions(+) 20 | 21 | diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 22 | index b30ad7e8af..53fabcc71e 100644 23 | --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 24 | +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 25 | @@ -593,6 +593,17 @@ std::variant PolicySerializer::deserialize< 26 | return deviceDesc; 27 | } 28 | 29 | +char* trim(char * s) { 30 | + int l = strlen(s); 31 | + 32 | + if (l > 0) { 33 | + while (isspace(s[l - 1])) --l; 34 | + while (*s && isspace(*s)) ++s, --l; 35 | + } 36 | + 37 | + return strndup(s, l); 38 | +} 39 | + 40 | template<> 41 | std::variant PolicySerializer::deserialize( 42 | const xmlNode *cur, RouteTraits::PtrSerializingCtx ctx) 43 | @@ -640,6 +651,9 @@ std::variant PolicySerializer::deserialize source = ctx->findPortByTagName(devTag); 47 | + if (source == NULL) { 48 | + source = ctx->findPortByTagName(trim(devTag)); 49 | + } 50 | if (source == NULL && !mIgnoreVendorExtensions) { 51 | ALOGE("%s: no source found with name=%s", __func__, devTag); 52 | return BAD_VALUE; 53 | -- 54 | 2.34.1 55 | 56 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0029-Set-old-fingerprint-sensors-to-security-strong.patch: -------------------------------------------------------------------------------- 1 | From 2aa2d25cafb0e88a6f837c99e577c8a27f9b6e1c Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 3 Dec 2022 17:13:24 -0500 4 | Subject: [PATCH 29/49] Set old fingerprint sensors to security "strong" 5 | 6 | This allows removing config_biometric_sensors from overlays, which led 7 | to Pixels not booting, because they are using AIDL biometric sensor, and 8 | despite its name, config_biometric_sensors is HIDL-specific 9 | --- 10 | .../core/java/com/android/server/biometrics/AuthService.java | 4 ++-- 11 | 1 file changed, 2 insertions(+), 2 deletions(-) 12 | 13 | diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java 14 | index 4538cad513d6..bc741a5e2396 100644 15 | --- a/services/core/java/com/android/server/biometrics/AuthService.java 16 | +++ b/services/core/java/com/android/server/biometrics/AuthService.java 17 | @@ -653,7 +653,7 @@ public class AuthService extends SystemService { 18 | final int firstApiLevel = SystemProperties.getInt(SYSPROP_FIRST_API_LEVEL, 0); 19 | final int apiLevel = SystemProperties.getInt(SYSPROP_API_LEVEL, firstApiLevel); 20 | String[] configStrings = mInjector.getConfiguration(getContext()); 21 | - if (configStrings.length == 0 && apiLevel == Build.VERSION_CODES.R) { 22 | + if (configStrings.length == 0 && apiLevel <= Build.VERSION_CODES.R) { 23 | // For backwards compatibility with R where biometrics could work without being 24 | // configured in config_biometric_sensors. In the absence of a vendor provided 25 | // configuration, we assume the weakest biometric strength (i.e. convenience). 26 | @@ -688,7 +688,7 @@ public class AuthService extends SystemService { 27 | if (pm.hasSystemFeature(PackageManager.FEATURE_FACE)) { 28 | modalities.add(String.valueOf(BiometricAuthenticator.TYPE_FACE)); 29 | } 30 | - final String strength = String.valueOf(Authenticators.BIOMETRIC_CONVENIENCE); 31 | + final String strength = String.valueOf(Authenticators.BIOMETRIC_STRONG); 32 | final String[] configStrings = new String[modalities.size()]; 33 | for (int i = 0; i < modalities.size(); ++i) { 34 | final String id = String.valueOf(i); 35 | -- 36 | 2.34.1 37 | 38 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_apps_Settings/0003-Don-t-crash-when-we-get-no-DeviceLockManager.patch: -------------------------------------------------------------------------------- 1 | From dc41a1ccf6fa8391e9d87c003f66fd9746664c9b Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Sun, 29 Oct 2023 18:34:01 +0000 4 | Subject: [PATCH 3/5] Don't crash when we get no DeviceLockManager 5 | 6 | Change-Id: I8f87cdb00e0950ee6528598b8dff2cafff0309e7 7 | --- 8 | .../DeviceLockPreferenceController.java | 17 +++++++++-------- 9 | 1 file changed, 9 insertions(+), 8 deletions(-) 10 | 11 | diff --git a/src/com/android/settings/devicelock/DeviceLockPreferenceController.java b/src/com/android/settings/devicelock/DeviceLockPreferenceController.java 12 | index 4b6fe88f66c..0f65b1f725d 100644 13 | --- a/src/com/android/settings/devicelock/DeviceLockPreferenceController.java 14 | +++ b/src/com/android/settings/devicelock/DeviceLockPreferenceController.java 15 | @@ -47,13 +47,14 @@ public final class DeviceLockPreferenceController extends BasePreferenceControll 16 | @Override 17 | public void updateState(Preference preference) { 18 | super.updateState(preference); 19 | - mDeviceLockManager.getKioskApps(mContext.getMainExecutor(), 20 | - result -> { 21 | - // if kiosk apps present on the device, the device is provisioned by Device Lock 22 | - boolean isDeviceProvisionedByDeviceLock = result != null && !result.isEmpty(); 23 | - Log.d(TAG, "Set preference visibility to " + isDeviceProvisionedByDeviceLock); 24 | - // TODO(b/282179089): find alternatives instead of calling setVisible 25 | - preference.setVisible(isDeviceProvisionedByDeviceLock); 26 | - }); 27 | + if (mDeviceLockManager != null) 28 | + mDeviceLockManager.getKioskApps(mContext.getMainExecutor(), 29 | + result -> { 30 | + // if kiosk apps present on the device, the device is provisioned by Device Lock 31 | + boolean isDeviceProvisionedByDeviceLock = result != null && !result.isEmpty(); 32 | + Log.d(TAG, "Set preference visibility to " + isDeviceProvisionedByDeviceLock); 33 | + // TODO(b/282179089): find alternatives instead of calling setVisible 34 | + preference.setVisible(isDeviceProvisionedByDeviceLock); 35 | + }); 36 | } 37 | } 38 | -- 39 | 2.34.1 40 | 41 | -------------------------------------------------------------------------------- /patches/personal/platform_frameworks_base/0002-gmscompat-Spoof-Pixel-XL-for-Google-Photos.patch: -------------------------------------------------------------------------------- 1 | From 3412fcd5f280deb5e5dc4e807dff4386b321a066 Mon Sep 17 00:00:00 2001 2 | From: vladsendrix <83285656+vladsendrix@users.noreply.github.com> 3 | Date: Fri, 31 Dec 2021 03:18:04 +0100 4 | Subject: [PATCH 2/9] gmscompat: Spoof Pixel XL for Google Photos 5 | 6 | Change-Id: I905e40625b07ebf500cbb3ce1deadedee2e624c5 7 | --- 8 | .../internal/gmscompat/AttestationHooks.java | 14 ++++++++++++++ 9 | 1 file changed, 14 insertions(+) 10 | 11 | diff --git a/core/java/com/android/internal/gmscompat/AttestationHooks.java b/core/java/com/android/internal/gmscompat/AttestationHooks.java 12 | index 4faa4922716d..409352cb0a8f 100644 13 | --- a/core/java/com/android/internal/gmscompat/AttestationHooks.java 14 | +++ b/core/java/com/android/internal/gmscompat/AttestationHooks.java 15 | @@ -32,6 +32,7 @@ public final class AttestationHooks { 16 | 17 | private static final String PACKAGE_GMS = "com.google.android.gms"; 18 | private static final String PACKAGE_FINSKY = "com.android.vending"; 19 | + private static final String PACKAGE_PHOTOS = "com.google.android.apps.photos"; 20 | private static final String PROCESS_UNSTABLE = "com.google.android.gms.unstable"; 21 | 22 | private static volatile boolean sIsGms = false; 23 | @@ -74,6 +75,15 @@ public final class AttestationHooks { 24 | //setVersionField("DEVICE_INITIAL_SDK_INT", Build.VERSION_CODES.N); 25 | } 26 | 27 | + private static void spoofGooglePhotos() { 28 | + setBuildField("PRODUCT", "marlin"); 29 | + setBuildField("DEVICE", "marlin"); 30 | + setBuildField("MANUFACTURER", "Google"); 31 | + setBuildField("BRAND", "google"); 32 | + setBuildField("MODEL", "Pixel XL"); 33 | + setBuildField("FINGERPRINT", "google/marlin/marlin:10/QP1A.191005.007.A3/5972272:user/release-keys"); 34 | + } 35 | + 36 | public static void initApplicationBeforeOnCreate(Application app) { 37 | if (PACKAGE_GMS.equals(app.getPackageName()) && 38 | PROCESS_UNSTABLE.equals(Application.getProcessName())) { 39 | @@ -84,6 +94,10 @@ public final class AttestationHooks { 40 | if (PACKAGE_FINSKY.equals(app.getPackageName())) { 41 | sIsFinsky = true; 42 | } 43 | + 44 | + if (PACKAGE_PHOTOS.equals(app.getPackageName())) { 45 | + spoofGooglePhotos(); 46 | + } 47 | } 48 | 49 | private static boolean isCallerSafetyNet() { 50 | -- 51 | 2.34.1 52 | 53 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0014-Allow-apex-on-5.0-kernels.-This-is-needed-because-on.patch: -------------------------------------------------------------------------------- 1 | From 72acbfc3e8ff4e5af985232f8c7338ac0bb31fb5 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 28 Apr 2023 12:29:05 -0400 4 | Subject: [PATCH 14/26] Allow apex on > 5.0 kernels. This is needed because on 5 | Pixels, camera HAL are exclusively in vendor apex 6 | 7 | Change-Id: I334cde4c5557b0ff70d550205c5bb727d4b5dbf5 8 | --- 9 | init/property_service.cpp | 15 ++++++++++++++- 10 | 1 file changed, 14 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/init/property_service.cpp b/init/property_service.cpp 13 | index da69dbe69e..a1993c8224 100644 14 | --- a/init/property_service.cpp 15 | +++ b/init/property_service.cpp 16 | @@ -62,6 +62,7 @@ 17 | #include 18 | #include 19 | #include 20 | +#include 21 | 22 | #include "debug_ramdisk.h" 23 | #include "epoll.h" 24 | @@ -690,6 +691,16 @@ uint32_t InitPropertySet(const std::string& name, const std::string& value) { 25 | static Result load_properties_from_file(const char*, const char*, 26 | std::map*); 27 | 28 | +static bool kernel_supports_capex() { 29 | + //Put a threshold at >= 5.0 30 | + struct utsname buf; 31 | + uname(&buf); 32 | + const char *where = buf.release; 33 | + int a = atoi(where); 34 | + if(a <= 4) return false; 35 | + return true; 36 | +} 37 | + 38 | /* 39 | * Filter is used to decide which properties to load: NULL loads all keys, 40 | * "ro.foo.*" is a prefix match, and "ro.foo.bar" is an exact match. 41 | @@ -787,7 +798,9 @@ static void LoadProperties(char* data, const char* filter, const char* filename, 42 | } else if (it->second != value) { 43 | LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second 44 | << "' with new value '" << value << "'"; 45 | - if(strcmp("ro.apex.updatable", key) == 0 || strstr(key, "adb") || strstr(key, "secure")) { 46 | + if(strcmp("ro.apex.updatable", key) == 0 && !kernel_supports_capex()) { 47 | + LOG(WARNING) << "... Ignored apex by kernel version"; 48 | + } else if(strstr(key, "adb") || strstr(key, "secure")) { 49 | LOG(WARNING) << "... Ignored"; 50 | } else { 51 | it->second = value; 52 | -- 53 | 2.34.1 54 | 55 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0026-When-setting-ro.apex.updatable-actually-set-the-valu.patch: -------------------------------------------------------------------------------- 1 | From 30b8aa9a29b63a4f10768cbd007527511cf1d164 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 25 Jan 2024 15:20:10 -0500 4 | Subject: [PATCH 26/26] When setting ro.apex.updatable, actually set the value 5 | 6 | Before this change, we were only changing the override, but on newest 7 | Android 14 vendor, they don't explicitly set ro.apex.updatable=true 8 | so there is no override. 9 | But we do want apex for them (notably for vendor apex), 10 | hence always set based on kernel version. 11 | 12 | This fixes boot on Samsung Galaxy S24 13 | --- 14 | init/property_service.cpp | 13 +++++++++---- 15 | 1 file changed, 9 insertions(+), 4 deletions(-) 16 | 17 | diff --git a/init/property_service.cpp b/init/property_service.cpp 18 | index 679bece507..3a2118c0cd 100644 19 | --- a/init/property_service.cpp 20 | +++ b/init/property_service.cpp 21 | @@ -803,17 +803,22 @@ static void LoadProperties(char* data, const char* filter, const char* filename, 22 | std::string error; 23 | if (CheckPermissions(key, value, context, cr, &error) == PROP_SUCCESS) { 24 | auto it = properties->find(key); 25 | + const char *new_value = value; 26 | + 27 | + if(strcmp("ro.apex.updatable", key) == 0) { 28 | + new_value = kernel_supports_capex() ? "true" : "false"; 29 | + } 30 | if (it == properties->end()) { 31 | - (*properties)[key] = value; 32 | - } else if (it->second != value) { 33 | + (*properties)[key] = new_value; 34 | + } else if (it->second != new_value) { 35 | LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second 36 | << "' with new value '" << value << "'"; 37 | - if(strcmp("ro.apex.updatable", key) == 0 && !kernel_supports_capex()) { 38 | + if(strcmp("ro.apex.updatable", key) == 0) { 39 | LOG(WARNING) << "... Ignored apex by kernel version"; 40 | } else if(strstr(key, "adb") || strstr(key, "secure") || strstr(key, "ro.logd.kernel")) { 41 | LOG(WARNING) << "... Ignored"; 42 | } else { 43 | - it->second = value; 44 | + it->second = new_value; 45 | } 46 | } 47 | } else { 48 | -- 49 | 2.34.1 50 | 51 | --------------------------------------------------------------------------------