├── README.md ├── apply-patches.sh ├── build.sh ├── manifest.xml ├── ota.json ├── patches ├── personal │ ├── device_custom_sepolicy │ │ └── 0001-sepolicy-Nuke-fuseblk-genfs_context.patch │ ├── device_phh_treble │ │ ├── 0001-Rework-securize-tweak.patch │ │ ├── 0002-treble-Don-t-handle-apns-conf.patch │ │ └── 0003-treble-Force-enable-WifiDisplay.patch │ ├── platform_build │ │ ├── 0001-build-Don-t-handle-apns-conf.patch │ │ ├── 0002-build-Fix-device-name.patch │ │ └── 0003-build-Prefer-Aperture-over-Camera2.patch │ ├── platform_packages_apps_Settings │ │ └── 0001-Replace-PE-Updater-with-PHH-Updater.patch │ ├── platform_vendor_aosp │ │ ├── 0001-build_soong-Disable-generated_kernel_headers.patch │ │ ├── 0002-config-Remove-duplicate-ro.adb.secure.patch │ │ ├── 0003-build-Disable-inline-kernel-building.patch │ │ └── 0004-build-Fix-build-number.patch │ └── treble_app │ │ ├── 0001-misc-Remove-securize-preference.patch │ │ └── 0002-ota-Handle-slim-variant.patch ├── prerequisite │ ├── device_phh_treble │ │ └── 0001-Revert-treble-add-pixel-charger-2-3.patch │ ├── platform_frameworks_base │ │ ├── 0001-Revert-Biometrics-Allow-disabling-of-fingerprint-cle.patch │ │ ├── 0002-Revert-udfps-Restore-illumination-dot-for-global-hbm.patch │ │ ├── 0003-Revert-AuthService-Add-support-for-workaround-side-f.patch │ │ └── 0004-Revert-core-pm-Allow-wildcard-in-RRO-system-property.patch │ └── platform_packages_modules_Bluetooth │ │ └── 0001-Revert-gd-hci-Allow-disabling-selected-local-command.patch ├── slim.patch └── trebledroid │ ├── platform_bionic │ ├── 0001-Disable-vndklite-handling.patch │ ├── 0002-Add-new-mechanism-to-fake-vendor-props-on-a-per-proc.patch │ ├── 0003-Rework-property-overriding.patch │ └── 0004-Add-some-properties-to-fake-in-keymaster-prop-replac.patch │ ├── platform_bootable_recovery │ └── 0001-Don-t-reboot-if-we-couldn-t-get-bootctrl.patch │ ├── platform_build │ ├── 0001-build-remove-emulator-crap-from-GSI.patch │ ├── 0002-build-Bypass-vendor-calls.patch │ ├── 0003-Remove-init.vndk-nodef.rc.patch │ └── 0004-build-Remove-llkd.patch │ ├── platform_external_selinux │ ├── 0001-Increase-default-log_level-to-get-actual-selinux-err.patch │ ├── 0002-Revert-libsepol-Make-an-unknown-permission-an-error-.patch │ ├── 0003-Workaround-device-phh-treble-conflict-with-SELinux-p.patch │ ├── 0004-Allow-devices-virtual-block-genfscon-conflict-seen-o.patch │ ├── 0005-if-service-is-rcs-accept-conflict.-Seen-on-Moto-E5.patch │ ├── 0006-Allow-mismatches-of-exfat-genfscon.patch │ ├── 0007-Enable-multipl_decls-by-default.-This-is-needed-beca.patch │ ├── 0008-Fix-boot-on-Moto-devices-using-unknown-class.patch │ ├── 0009-Improve-SELinux-policy-workaround-on-device-phh-treb.patch │ └── 0010-Allow-sys-vm-watermark_scale_factor-conflict-seen-on.patch │ ├── platform_frameworks_av │ ├── 0001-APM-Restore-S-R-and-Q-behavior-respectively-for-tele.patch │ ├── 0002-Fix-BT-in-call-on-CAF-devices.patch │ ├── 0003-Add-partial-cam-id-is-hardcoded-support-for-Asus-ZF6.patch │ ├── 0004-APM-Optionally-force-load-audio-policy-for-system-si.patch │ ├── 0005-APM-Remove-A2DP-audio-ports-from-the-primary-HAL.patch │ ├── 0006-audiopolicy-try-again-with-trimmed-audio-port-name-i.patch │ ├── 0007-camera-Implement-property-to-override-default-camera.patch │ ├── 0008-There-are-three-SCO-devices.-Fallback-from-one-to-th.patch │ ├── 0009-Add-persist.sys.phh.samsung.camera_ids-property-to-a.patch │ ├── 0011-Add-a-property-to-force-camera-timestamp-source.patch │ ├── 0012-FIH-devices-Fix-Earpiece-audio-output.patch │ ├── 0013-No-longer-make-re-assigning-legacy-audio-groups-fata.patch │ ├── 0014-Make-camera-IDs-filter-out-optional.patch │ ├── 0015-Support-Samsung-R-multi-cams.patch │ ├── 0016-Don-t-crash-on-unknown-audio-devices.patch │ ├── 0017-Not-all-sources-in-a-route-are-valid.-Dont-ignore-th.patch │ ├── 0018-Use-a-fake-volume-policy-when-none-has-been-found.patch │ ├── 0019-When-aux-cameras-are-enabled-ignore-system-only-came.patch │ ├── 0020-Revert-Remove-support-for-audio-HAL-V2-from-the-fram.patch │ ├── 0021-Fix-parsing-audio-hal-7.0-audio-policies.patch │ ├── 0022-fixup-Not-all-sources-in-a-route-are-valid.-Dont-ign.patch │ ├── 0023-Add-a-prop-to-change-Samsung-flash-strength.patch │ ├── 0024-Support-variable-flash-strength-on-samsung-hal-4.0.patch │ ├── 0025-voip-Fix-high-pitched-voice-on-Qualcomm-devices.patch │ ├── 0026-Fix-audio-hal-2.0-support.-Fixup-of-Revert-Remove-su.patch │ ├── 0027-Allow-uname-syscall-in-all-seccomp-This-is-needed-be.patch │ └── 0028-audiopolicy-Fix-broken-mic-while-video-recording-on-.patch │ ├── platform_frameworks_base │ ├── 0001-Disable-vendor-mismatch-warning.patch │ ├── 0002-Fallback-to-stupid-autobrightness-if-brightness-valu.patch │ ├── 0003-Fix-env-empty-string-ANDROID_STORAGE.patch │ ├── 0005-Add-support-for-app-signature-spoofing.patch │ ├── 0006-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch │ ├── 0007-Implement-a-persistent-property-to-override-the-defa.patch │ ├── 0008-Show-APN-Settings-for-CDMA-carriers.patch │ ├── 0009-Re-order-services-so-that-it-works-even-without-qtag.patch │ ├── 0010-Support-samsung-Pie-and-Q-light-hal.patch │ ├── 0011-Add-support-for-samsung-touch-physical-and-hover-pro.patch │ ├── 0012-Always-allow-overriding-the-number-of-work-profiles.patch │ ├── 0013-HOME-deserves-to-wake-up-devices-just-as-well-as-bac.patch │ ├── 0014-Some-devices-have-proximity-sensor-reporting-NaN-as-.patch │ ├── 0015-Fix-brightness-range-not-being-complete-on-Samsung-d.patch │ ├── 0016-Re-implement-fnmatch-like-behaviour-for-RRO-java-sid.patch │ ├── 0017-Remove-useless-notification-about-console-service-be.patch │ ├── 0018-Revert-Remove-unused-SystemProperties.set.patch │ ├── 0019-TelephonyManager-bring-back-getNetworkClass.patch │ ├── 0020-TelephonyManager-add-API-annotations-for-setTelephon.patch │ ├── 0021-Fix-Wakelock-issue.patch │ ├── 0022-Automatically-detect-pick-up-sensor-so-that-an-overl.patch │ ├── 0023-Catch-broken-mainBuiltInDisplayCutoutRectApproximati.patch │ ├── 0024-backlight-Fix-backlight-control-on-Galaxy-S9.patch │ ├── 0025-Revert-Switch-long-press-power-behavior-in-AOSP.patch │ ├── 0026-Once-we-integrate-Samsung-Power-hal-in-libpowermanag.patch │ ├── 0027-Allow-disabling-of-fingerprint-cleanups-needed-on-so.patch │ ├── 0028-Reduce-the-size-of-udfps-enroll-progress-bar.-Some-d.patch │ ├── 0029-Dynamically-resize-boot-animation-to-match-screen-si.patch │ ├── 0030-Revert-Remove-more-FDE-methods-from-StorageManager.patch │ ├── 0032-Set-old-fingerprint-sensors-to-security-strong.patch │ ├── 0033-Call-Samsung-s-ISehSysInputDev-to-report-screen-stat.patch │ ├── 0034-Fixup-of-c50777-original-commit-only-cares-about-R-v.patch │ ├── 0035-FOD-support-for-Asus-ZF8-and-Samsung-devices.patch │ ├── 0036-Always-add-HIDL-fingerprint-config-Galaxy-A53-is-mis.patch │ ├── 0037-SystemUI-Implement-alternate-brightness-path-for-FOD.patch │ ├── 0038-bootanimation-Fix-bootanimation-when-using-mask-shin.patch │ ├── 0039-Try-catch-around-constrainNitsAndBacklightArrays-and.patch │ ├── 0040-Add-Mediatek-power-hints-on-touch.patch │ ├── 0041-Detect-Moto-dynamic-hardware-feature.patch │ └── 0042-Add-initial-Xiaomi-FOD-implementation-for-recent-Xia.patch │ ├── platform_frameworks_libs_net │ └── 0001-Restore-back-the-behavior-of-isValid-It-is-legal-to-.patch │ ├── platform_frameworks_native │ ├── 0001-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch │ ├── 0002-Matching-an-input-with-a-display-uses-uniqueId.patch │ ├── 0003-unshared_oob-didn-t-exist-in-O-P-so-detect-its-suppo.patch │ ├── 0004-Remove-Samsung-system-permission-on-sensors.patch │ ├── 0005-Mark-accelerometer-input-as-sensor-exclusively-if-th.patch │ ├── 0006-powermanager-Add-support-Samsung-miscpower-HAL.patch │ ├── 0007-Fix-loading-power-hidl-v1.0.patch │ ├── 0008-MIUI13-devices-hide-their-vibrator-HAL-behind-non-de.patch │ ├── 0009-FOD-support-for-Samsung-and-Asus.patch │ └── 0010-Fix-light-sensor-crash-on-Xiaomi-13.patch │ ├── platform_frameworks_opt_telephony │ ├── 0001-SubscriptionController-Do-not-override-default-calli.patch │ ├── 0002-Telephony-Don-not-call-onUssdRelease-for-Huawei-RIL.patch │ ├── 0003-Fix-baseband-being-too-long-to-fit-into-a-91-chars-p.patch │ ├── 0005-Fix-signalstrength-for-huawei-kirin-hi6250-hi3670.patch │ ├── 0006-telephony-forward-port-support-for-forceCognitive.patch │ └── 0010-Fix-3G-signalstrength-for-huawei-kirin-hi6250-hi3670.patch │ ├── platform_hardware_interfaces │ └── 0001-Add-a-vendor800-command-to-be-able-to-call-vendor-sp.patch │ ├── platform_packages_apps_Settings │ ├── 0001-Act-as-usb-device-when-there-is-no-hal-but-we-believ.patch │ └── 0002-Ignore-cancelled-fingerprint-events-they-are-expecte.patch │ ├── platform_packages_modules_Bluetooth │ ├── 0003-audio_hal_interface-Optionally-use-sysbta-HAL.patch │ ├── 0004-Add-option-to-change-eSCO-Transport-Unit-Size.patch │ ├── 0005-Don-t-abort-when-failing-to-get-real-time-priority.patch │ ├── 0006-On-Samsung-devices-we-need-to-tell-Audio-HAL-if-we-r.patch │ ├── 0007-Add-properties-to-disable-some-features-commands-sta.patch │ └── 0008-Add-a-property-to-cap-declared-le-vendor-version.-Fo.patch │ ├── platform_packages_modules_Connectivity │ ├── 0001-Allow-failing-to-load-bpf-programs-for-BPF-less-devi.patch │ ├── 0002-BpfMap-implemented-new-checks-for-kernel-4.14-but-as.patch │ └── 0003-Dont-delete-UID-from-BpfMap-on-BPF-less-kernel.patch │ ├── platform_system_bpf │ └── 0001-Support-no-bpf-usecase.patch │ ├── platform_system_core │ ├── 0001-Let-system-override-ro.apex.updatable.patch │ ├── 0002-If-Vboot2-fails-fall-back-to-Vboot1.patch │ ├── 0003-Revert-Remove-support-for-AVB-1.0.patch │ ├── 0004-Don-t-abandon-creating-property-tree-if-there-is-a-c.patch │ ├── 0005-init-Do-not-start-console-service-when-debuggable.patch │ ├── 0006-Panic-into-recovery-rather-than-bootloader.patch │ ├── 0007-Detect-allowed-sdcard-options-based-on-vndk.patch │ ├── 0008-Revert-Set-system-xbin-permissions-to-750.patch │ ├── 0009-Ugly-but-secure-Set-dev-uinput-as-0666-to-fix-finger.patch │ ├── 0010-Add-my-own-OTA-mechanism-going-over-data.patch │ ├── 0011-fs_mgr-Keep-allowing-encryptable-fstab-flag.patch │ ├── 0012-Fix-support-for-devices-without-cgroupv2-support.patch │ ├── 0013-FDE-is-dead.-Fallback-FDE-to-no-encryption-and-FDE-F.patch │ ├── 0014-Let-system-override-adb-secure-props-so-we-dont-get-.patch │ ├── 0015-Allow-apex-on-5.0-kernels.-This-is-needed-because-on.patch │ ├── 0016-watchdogd-Support-pinging-two-watchdogs.patch │ ├── 0017-healthd-offline-charger-fix-screen-off-3-3.patch │ ├── 0018-Disable-quotas-on-legacy-devices-with-encryption-dis.patch │ └── 0019-Add-vendor-firmware_mnt.-Moto-Razr-2019-look-for-fir.patch │ ├── platform_system_extras │ └── 0001-libfscrypt-Bail-out-if-we-can-t-open-directory.patch │ ├── platform_system_linkerconfig │ └── 0001-Disable-vndklite-handling.patch │ ├── platform_system_netd │ ├── 0001-Huawei-Kirin-960-accept-broken-rpfilter-match.patch │ ├── 0002-Don-t-fail-on-FTP-conntracking-failing.patch │ ├── 0003-Support-no-bpf-usecase.patch │ └── 0004-Don-t-abort-in-case-of-cgroup-bpf-setup-fail-since-s.patch │ ├── platform_system_nfc │ └── 0001-Let-vendor-have-priority-over-NFC-config-file-rather.patch │ └── platform_system_vold │ ├── 0001-Allow-deletion-of-symlink.patch │ ├── 0002-Failing-to-create-facedata-shouldn-t-be-fatal.patch │ ├── 0003-Don-t-unmount-rw-system.sh-binds.patch │ ├── 0004-Exfat-can-be-mounted-with-exfat-kernel-fs-driver-or-.patch │ └── 0005-Every-voldmanaged-storage-is-adoptable.patch └── pe.mk /README.md: -------------------------------------------------------------------------------- 1 | # Pixel Experience GSI 2 | 3 | ## Build 4 | To get started with building Pixel Experience GSI, you'll need to get familiar with [Git and Repo](https://source.android.com/source/using-repo.html) as well as [How to build a GSI](https://github.com/phhusson/treble_experimentations/wiki/How-to-build-a-GSI%3F). 5 | - Create a new working directory for your Pixel Experience build and navigate to it: 6 | ``` 7 | mkdir pixel; cd pixel 8 | ``` 9 | - Clone this repo: 10 | ``` 11 | git clone https://github.com/ponces/treble_build_pe -b thirteen 12 | ``` 13 | - Finally, start the build script: 14 | ``` 15 | bash treble_build_pe/build.sh 16 | ``` 17 | 18 | ## Notes 19 | - First and foremost, a huge thanks to David Dean for providing me with an incredible building server which helps (by a lot!!) delivering these builds as fast as possible. 20 | - If bluetooth calls or bluetooth media do not work well for you, make sure you have the "Use System Wide BT HAL" checkbox enabled on the Misc page of Treble App. If not, enable and reboot. 21 | - If you have a non-Samsung device with a Qualcomm chipset and VoLTE isn't working with the default IMS package provided by Treble App, try installing this [alternative IMS package](https://treble.phh.me/stable/ims-caf-s.apk). 22 | 23 | ## Credits 24 | These people have helped this project in some way or another, so they should be the ones who receive all the credit: 25 | - [Pixel Experience Team](https://download.pixelexperience.org/about) 26 | - [phhusson](https://github.com/phhusson) 27 | - [AndyYan](https://github.com/AndyCGYan) 28 | - [eremitein](https://github.com/eremitein) 29 | - [kdrag0n](https://github.com/kdrag0n) 30 | - [Peter Cai](https://github.com/PeterCxy) 31 | - [haridhayal11](https://github.com/haridhayal11) 32 | - [sooti](https://github.com/sooti) 33 | - [Iceows](https://github.com/Iceows) 34 | - [ChonDoit](https://github.com/ChonDoit) 35 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ota.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v2023.09.14", 3 | "date": "1694706864", 4 | "variants": [ 5 | { 6 | "name": "treble_arm64_bvN", 7 | "size": "1326754028", 8 | "url": "https://github.com/ponces/treble_build_pe/releases/download/v2023.09.14/PixelExperience_arm64-ab-13.0-20230914-UNOFFICIAL.img.xz" 9 | }, 10 | { 11 | "name": "treble_arm64_bvN-slim", 12 | "size": "1055338332", 13 | "url": "https://github.com/ponces/treble_build_pe/releases/download/v2023.09.14/PixelExperience_arm64-ab-slim-13.0-20230914-UNOFFICIAL.img.xz" 14 | }, 15 | { 16 | "name": "treble_arm64_bvN-vndklite", 17 | "size": "1291466592", 18 | "url": "https://github.com/ponces/treble_build_pe/releases/download/v2023.09.14/PixelExperience_arm64-ab-vndklite-13.0-20230914-UNOFFICIAL.img.xz" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /patches/personal/device_custom_sepolicy/0001-sepolicy-Nuke-fuseblk-genfs_context.patch: -------------------------------------------------------------------------------- 1 | From f9125a7dfacc50a1fe07b75f3686468cda416889 Mon Sep 17 00:00:00 2001 2 | From: ChonDoit 3 | Date: Wed, 13 Sep 2023 09:04:29 +0000 4 | Subject: [PATCH] sepolicy: Nuke fuseblk genfs_context 5 | 6 | Change-Id: I84331f579a6926b7fc641bd7f013ff905bdfacc0 7 | --- 8 | common/private/genfs_contexts | 4 ---- 9 | 1 file changed, 4 deletions(-) 10 | 11 | diff --git a/common/private/genfs_contexts b/common/private/genfs_contexts 12 | index 79a7736..d096874 100644 13 | --- a/common/private/genfs_contexts 14 | +++ b/common/private/genfs_contexts 15 | @@ -1,6 +1,2 @@ 16 | -ifelse(board_excludes_fuseblk_sepolicy, `true', , 17 | -genfscon fuseblk / u:object_r:vfat:s0 18 | -) 19 | - 20 | genfscon sysfs /devices/virtual/timed_output/vibrator u:object_r:sysfs_vibrator:s0 21 | genfscon sysfs /module/mmcblk/parameters/perdev_minors u:object_r:sysfs_perdev_minors:s0 22 | -- 23 | 2.34.1 24 | 25 | -------------------------------------------------------------------------------- /patches/personal/device_phh_treble/0002-treble-Don-t-handle-apns-conf.patch: -------------------------------------------------------------------------------- 1 | From 1e5aef82a995e0244b3eb084fca25c7f1eedc324 Mon Sep 17 00:00:00 2001 2 | From: Andy CrossGate Yan 3 | Date: Sun, 27 Jun 2021 15:37:56 +0000 4 | Subject: [PATCH 2/3] treble: Don't handle apns-conf 5 | 6 | PE has its own well-maintained copy 7 | 8 | Change-Id: If568101f21098c75879af8b9b6141af179566960 9 | --- 10 | base-pre.mk | 3 --- 11 | base.mk | 4 ---- 12 | 2 files changed, 7 deletions(-) 13 | 14 | diff --git a/base-pre.mk b/base-pre.mk 15 | index 6a317e4..e69de29 100644 16 | --- a/base-pre.mk 17 | +++ b/base-pre.mk 18 | @@ -1,3 +0,0 @@ 19 | -#Use a more decent APN config 20 | -PRODUCT_COPY_FILES += \ 21 | - device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml 22 | diff --git a/base.mk b/base.mk 23 | index ce2f218..8c53fa5 100644 24 | --- a/base.mk 25 | +++ b/base.mk 26 | @@ -17,10 +17,6 @@ PRODUCT_COPY_FILES += \ 27 | device/phh/treble/bluetooth/audio/config/sysbta_audio_policy_configuration.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/sysbta_audio_policy_configuration.xml \ 28 | device/phh/treble/bluetooth/audio/config/sysbta_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/sysbta_audio_policy_configuration_7_0.xml 29 | 30 | -#Use a more decent APN config 31 | -PRODUCT_COPY_FILES += \ 32 | - device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml 33 | - 34 | SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += device/phh/treble/sepolicy 35 | PRODUCT_PACKAGE_OVERLAYS += device/phh/treble/overlay 36 | 37 | -- 38 | 2.25.1 39 | 40 | -------------------------------------------------------------------------------- /patches/personal/device_phh_treble/0003-treble-Force-enable-WifiDisplay.patch: -------------------------------------------------------------------------------- 1 | From 965a8782b744b61291b827ee5506d449aa6e94f4 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Sun, 7 May 2023 22:39:30 +0000 4 | Subject: [PATCH 3/3] treble: Force enable WifiDisplay 5 | 6 | --- 7 | system.prop | 3 +++ 8 | 1 file changed, 3 insertions(+) 9 | 10 | diff --git a/system.prop b/system.prop 11 | index 986cb09..0ac85e3 100644 12 | --- a/system.prop 13 | +++ b/system.prop 14 | @@ -53,3 +53,6 @@ vendor.usb.use_ffs_mtp=1 15 | # Override media volume steps 16 | ro.config.media_vol_steps=25 17 | ro.config.media_vol_default=8 18 | + 19 | +# WifiDisplay 20 | +persist.debug.wfd.enable=1 21 | -- 22 | 2.34.1 23 | 24 | -------------------------------------------------------------------------------- /patches/personal/platform_build/0001-build-Don-t-handle-apns-conf.patch: -------------------------------------------------------------------------------- 1 | From e679bd168b2d45d552e43072f11786f2891358db Mon Sep 17 00:00:00 2001 2 | From: Andy CrossGate Yan 3 | Date: Mon, 5 Oct 2020 01:51:46 +0000 4 | Subject: [PATCH 1/3] build: Don't handle apns-conf 5 | 6 | Leave it to vendor/aosp instead 7 | 8 | Change-Id: I51fb1436ee0ee2e33b20ca0810b69e827f3f34dc 9 | --- 10 | target/product/full_base_telephony.mk | 5 ----- 11 | 1 file changed, 5 deletions(-) 12 | 13 | diff --git a/target/product/full_base_telephony.mk b/target/product/full_base_telephony.mk 14 | index a37fd48af..5470ad2be 100644 15 | --- a/target/product/full_base_telephony.mk 16 | +++ b/target/product/full_base_telephony.mk 17 | @@ -26,10 +26,5 @@ PRODUCT_VENDOR_PROPERTIES := \ 18 | PRODUCT_COPY_FILES := \ 19 | frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml 20 | 21 | -ifeq ($(CUSTOM_BUILD),) 22 | -PRODUCT_COPY_FILES += \ 23 | - device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml 24 | -endif 25 | - 26 | $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk) 27 | $(call inherit-product, $(SRC_TARGET_DIR)/product/telephony.mk) 28 | -- 29 | 2.25.1 30 | 31 | -------------------------------------------------------------------------------- /patches/personal/platform_build/0002-build-Fix-device-name.patch: -------------------------------------------------------------------------------- 1 | From 3959166887fc1872dfdbf79ff525f951d694432d Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Sat, 3 Oct 2020 14:28:35 -0700 4 | Subject: [PATCH 2/3] build: Fix device name 5 | 6 | This is only valid for GSI images. 7 | 8 | Change-Id: I55c8897d7d4d5c2a9e62b1a931b3856b2e38956e 9 | --- 10 | tools/buildinfo.sh | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh 14 | index e163b0ec6..5f8ff2d6a 100755 15 | --- a/tools/buildinfo.sh 16 | +++ b/tools/buildinfo.sh 17 | @@ -55,6 +55,6 @@ if [ -n "$BUILD_THUMBPRINT" ] ; then 18 | echo "ro.build.thumbprint=$BUILD_THUMBPRINT" 19 | fi 20 | 21 | -echo "org.pixelexperience.device=$CUSTOM_DEVICE" 22 | +echo "org.pixelexperience.device=$TARGET_PRODUCT" 23 | 24 | echo "# end build properties" 25 | -- 26 | 2.25.1 27 | 28 | -------------------------------------------------------------------------------- /patches/personal/platform_build/0003-build-Prefer-Aperture-over-Camera2.patch: -------------------------------------------------------------------------------- 1 | From 6d592f66226cde9611d32b469d9a8a5285bdd827 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Fri, 6 Jan 2023 09:44:51 +0000 4 | Subject: [PATCH] build: Prefer Aperture over Camera2 5 | 6 | Change-Id: Iec3e9cc4edf712ae75a667b503a7acc9b0a13a6c 7 | --- 8 | target/product/handheld_product.mk | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/target/product/handheld_product.mk b/target/product/handheld_product.mk 12 | index c3cd30e94..fee227955 100644 13 | --- a/target/product/handheld_product.mk 14 | +++ b/target/product/handheld_product.mk 15 | @@ -36,7 +36,7 @@ PRODUCT_PACKAGES += \ 16 | 17 | ifeq ($(CUSTOM_BUILD),) 18 | PRODUCT_PACKAGES += \ 19 | - Camera2 \ 20 | + Aperture \ 21 | LatinIME 22 | endif 23 | 24 | -- 25 | 2.34.1 26 | 27 | -------------------------------------------------------------------------------- /patches/personal/platform_packages_apps_Settings/0001-Replace-PE-Updater-with-PHH-Updater.patch: -------------------------------------------------------------------------------- 1 | From c019e37199cfc609ddc69d43d1e47057c3336e13 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Tue, 1 Feb 2022 13:47:00 +0000 4 | Subject: [PATCH] Replace PE Updater with PHH Updater 5 | 6 | Change-Id: I15b7b5e2938a906c2fa151d582c411d1db11eb55 7 | --- 8 | .../settings/system/SystemUpdatePreferenceController.java | 5 ++--- 9 | 1 file changed, 2 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/src/com/android/settings/system/SystemUpdatePreferenceController.java b/src/com/android/settings/system/SystemUpdatePreferenceController.java 12 | index 8db9722388..ad6c10a0e1 100644 13 | --- a/src/com/android/settings/system/SystemUpdatePreferenceController.java 14 | +++ b/src/com/android/settings/system/SystemUpdatePreferenceController.java 15 | @@ -35,7 +35,7 @@ public class SystemUpdatePreferenceController extends BasePreferenceController { 16 | private static final String KEY_SYSTEM_UPDATE_SETTINGS = "system_update_settings"; 17 | 18 | private static final String OTA_BUILD_TYPE_PROP = "org.pixelexperience.build_type"; 19 | - private static final String OTA_APP_PACKAGE = "org.pixelexperience.ota"; 20 | + private static final String OTA_APP_PACKAGE = "me.phh.treble.app"; 21 | 22 | private final UserManager mUm; 23 | 24 | @@ -46,8 +46,7 @@ public class SystemUpdatePreferenceController extends BasePreferenceController { 25 | 26 | @Override 27 | public int getAvailabilityStatus() { 28 | - String buildtype = SystemProperties.get(OTA_BUILD_TYPE_PROP,"unofficial"); 29 | - if (!mUm.isAdminUser() || (!buildtype.equalsIgnoreCase("official") && !buildtype.equalsIgnoreCase("ci"))){ 30 | + if (!mUm.isAdminUser()){ 31 | return UNSUPPORTED_ON_DEVICE; 32 | } 33 | try { 34 | -- 35 | 2.32.0 36 | 37 | -------------------------------------------------------------------------------- /patches/personal/platform_vendor_aosp/0001-build_soong-Disable-generated_kernel_headers.patch: -------------------------------------------------------------------------------- 1 | From e660f22fa44eb6d7051c64d4334e12cc96201e55 Mon Sep 17 00:00:00 2001 2 | From: AndyCGYan 3 | Date: Sun, 3 Mar 2019 14:07:33 +0800 4 | Subject: [PATCH 1/4] build_soong: Disable generated_kernel_headers 5 | 6 | ...but done in a way so that there's no need to remove generated_kernel_headers from individual projects - thanks @ExpressLuke 7 | 8 | Change-Id: I630857cec208f1830e776bf5031d7bb9bc4435d0 9 | --- 10 | build/soong/Android.bp | 12 ------------ 11 | 1 file changed, 12 deletions(-) 12 | 13 | diff --git a/build/soong/Android.bp b/build/soong/Android.bp 14 | index 08448db9..85b3e567 100644 15 | --- a/build/soong/Android.bp 16 | +++ b/build/soong/Android.bp 17 | @@ -20,9 +20,6 @@ bootstrap_go_package { 18 | custom_generator { 19 | name: "generated_kernel_includes", 20 | 21 | - // The headers make command 22 | - cmd: "$(PATH_OVERRIDE_SOONG) $(KERNEL_MAKE_CMD) $(KERNEL_MAKE_FLAGS) -C $(TARGET_KERNEL_HEADERS) O=$(KERNEL_BUILD_OUT_PREFIX)$(genDir) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) headers_install", 23 | - 24 | // Directories that can be imported by a cc_* module generated_headers property 25 | export_include_dirs: [ 26 | "usr/audio/include/uapi", 27 | @@ -31,15 +28,6 @@ custom_generator { 28 | "usr/include/audio/include/uapi", 29 | "usr/techpack/audio/include", 30 | ], 31 | - 32 | - // Sources for dependency tracking 33 | - dep_root: "$(TARGET_KERNEL_HEADERS)", 34 | - dep_files: [ 35 | - "Makefile", 36 | - "include/**/*", 37 | - "arch/$(KERNEL_ARCH)/include/**/*", 38 | - "techpack/audio/include/**/*", 39 | - ], 40 | } 41 | 42 | cc_library_headers { 43 | -- 44 | 2.25.1 45 | 46 | -------------------------------------------------------------------------------- /patches/personal/platform_vendor_aosp/0002-config-Remove-duplicate-ro.adb.secure.patch: -------------------------------------------------------------------------------- 1 | From 69faf67abb4ee23d15b7219a893b359641b88bca Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Wed, 20 Oct 2021 11:07:19 +0100 4 | Subject: [PATCH 2/4] config: Remove duplicate ro.adb.secure 5 | 6 | Change-Id: I7a507b06acd28dbc6ab507c8c14e85c16600288c 7 | --- 8 | config/common.mk | 3 --- 9 | 1 file changed, 3 deletions(-) 10 | 11 | diff --git a/config/common.mk b/config/common.mk 12 | index 4953b532..f8c6f1ec 100644 13 | --- a/config/common.mk 14 | +++ b/config/common.mk 15 | @@ -28,10 +28,6 @@ ifeq ($(TARGET_BUILD_VARIANT),eng) 16 | PRODUCT_SYSTEM_DEFAULT_PROPERTIES += ro.adb.secure=0 17 | PRODUCT_SYSTEM_DEFAULT_PROPERTIES += persist.sys.usb.config=adb 18 | else 19 | -# Enable ADB authentication 20 | -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += ro.adb.secure=1 21 | -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += persist.sys.usb.config=none 22 | - 23 | # Disable extra StrictMode features on all non-engineering builds 24 | PRODUCT_SYSTEM_DEFAULT_PROPERTIES += persist.sys.strictmode.disable=true 25 | endif 26 | -- 27 | 2.25.1 28 | 29 | -------------------------------------------------------------------------------- /patches/personal/platform_vendor_aosp/0003-build-Disable-inline-kernel-building.patch: -------------------------------------------------------------------------------- 1 | From f9a585a7a61eae3ec0a9e482269424668a27c8d3 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Wed, 20 Oct 2021 15:54:26 +0100 4 | Subject: [PATCH 3/4] build: Disable inline kernel building 5 | 6 | Change-Id: I4c01aa093474a8017366bd5e98586c58b2cd6452 7 | --- 8 | build/tasks/kernel.mk | 2 ++ 9 | config/common.mk | 2 ++ 10 | 2 files changed, 4 insertions(+) 11 | 12 | diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk 13 | index 7797d8ed..bfa106dc 100644 14 | --- a/build/tasks/kernel.mk 15 | +++ b/build/tasks/kernel.mk 16 | @@ -66,6 +66,7 @@ 17 | # modules in vendor_overlay instead of vendor 18 | 19 | ifneq ($(TARGET_NO_KERNEL),true) 20 | +ifneq ($(TARGET_NO_KERNEL_OVERRIDE),true) 21 | 22 | ## Externally influenced variables 23 | KERNEL_SRC := $(TARGET_KERNEL_SOURCE) 24 | @@ -515,4 +516,5 @@ dtboimage: $(INSTALLED_DTBOIMAGE_TARGET) 25 | .PHONY: dtbimage 26 | dtbimage: $(INSTALLED_DTBIMAGE_TARGET) 27 | 28 | +endif # TARGET_NO_KERNEL_OVERRIDE 29 | endif # TARGET_NO_KERNEL 30 | diff --git a/config/common.mk b/config/common.mk 31 | index 134ad01e..ea459b42 100644 32 | --- a/config/common.mk 33 | +++ b/config/common.mk 34 | @@ -177,6 +177,8 @@ PRODUCT_PACKAGES += \ 35 | PRODUCT_PRODUCT_PROPERTIES += \ 36 | ro.boot.vendor.overlay.theme=com.android.internal.systemui.navbar.gestural 37 | 38 | +TARGET_NO_KERNEL_OVERRIDE := true 39 | + 40 | # Pixel customization 41 | TARGET_SUPPORTS_GOOGLE_RECORDER ?= true 42 | TARGET_INCLUDE_STOCK_ARCORE ?= true 43 | -- 44 | 2.25.1 45 | 46 | -------------------------------------------------------------------------------- /patches/personal/platform_vendor_aosp/0004-build-Fix-build-number.patch: -------------------------------------------------------------------------------- 1 | From df6e77eabe8083191e2984182d8aa82da7d08247 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Sat, 3 Oct 2020 14:28:35 -0700 4 | Subject: [PATCH 4/4] build: Fix build number 5 | 6 | This is only valid for GSI images. 7 | 8 | Change-Id: I55c8897d7d4d5c2a9e62b1a931b3856b2e38956e 9 | --- 10 | build/core/main_version.mk | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/config/branding.mk b/config/branding.mk 14 | index 5f93620c..2716de28 100644 15 | --- a/config/branding.mk 16 | +++ b/config/branding.mk 17 | @@ -10,5 +10,5 @@ CUSTOM_BUILD_DATE := $(CUSTOM_DATE_YEAR)$(CUSTOM_DATE_MONTH)$(CUSTOM_DATE_DAY)-$ 18 | 19 | CUSTOM_PLATFORM_VERSION := 13.0 20 | 21 | -CUSTOM_VERSION := PixelExperience_$(CUSTOM_BUILD)-$(CUSTOM_PLATFORM_VERSION)-$(CUSTOM_BUILD_DATE)-$(CUSTOM_BUILD_TYPE) 22 | +CUSTOM_VERSION := PixelExperience_$(TARGET_PRODUCT)-$(CUSTOM_PLATFORM_VERSION)-$(CUSTOM_BUILD_DATE)-$(CUSTOM_BUILD_TYPE) 23 | CUSTOM_VERSION_PROP := thirteen 24 | \ No newline at end of file 25 | -- 26 | 2.25.1 27 | 28 | -------------------------------------------------------------------------------- /patches/personal/treble_app/0002-ota-Handle-slim-variant.patch: -------------------------------------------------------------------------------- 1 | From 6e64d6a080f4a8f41e8972311cab40c0a0009900 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Wed, 9 Feb 2022 12:41:30 +0000 4 | Subject: [PATCH 2/2] ota: Handle slim variant 5 | 6 | --- 7 | app/src/main/java/me/phh/treble/app/UpdaterActivity.kt | 6 +++--- 8 | 1 file changed, 3 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/app/src/main/java/me/phh/treble/app/UpdaterActivity.kt b/app/src/main/java/me/phh/treble/app/UpdaterActivity.kt 11 | index b90bc00..e8de382 100644 12 | --- a/app/src/main/java/me/phh/treble/app/UpdaterActivity.kt 13 | +++ b/app/src/main/java/me/phh/treble/app/UpdaterActivity.kt 14 | @@ -212,10 +212,10 @@ class UpdaterActivity : PreferenceActivity() { 15 | 16 | private fun getVariant() : String { 17 | var flavor = SystemProperties.get("ro.build.flavor").replace(Regex("-user(debug)?"), "") 18 | - val secure = File("/system/phh/secure") 19 | + val velvet = File("/system/product/priv-app/Velvet/Velvet.apk") 20 | val vndklite = File("/system_ext/apex/com.android.vndk.v27/etc/vndkcore.libraries.27.txt") 21 | - if (secure.exists()) { 22 | - flavor += "-secure" 23 | + if (!velvet.exists()) { 24 | + flavor += "-slim" 25 | } else if (vndklite.exists()) { 26 | flavor += "-vndklite" 27 | } 28 | -- 29 | 2.32.0 30 | 31 | -------------------------------------------------------------------------------- /patches/prerequisite/platform_frameworks_base/0001-Revert-Biometrics-Allow-disabling-of-fingerprint-cle.patch: -------------------------------------------------------------------------------- 1 | From 5c9cd9cce43b6f3b1f0f5d5002631f00ee007fce Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Sun, 16 Oct 2022 16:46:23 +0100 4 | Subject: [PATCH 1/4] Revert "Biometrics: Allow disabling of fingerprint cleanups" 5 | 6 | This reverts commit f4d94e695e8107fd5fcd043a3174c4d9583277a9. 7 | --- 8 | .../sensors/fingerprint/hidl/Fingerprint21.java | 8 -------- 9 | 1 file changed, 8 deletions(-) 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 aff0387658db..1f8e1791c030 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 | @@ -128,8 +128,6 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider 16 | private final int mSensorId; 17 | private final boolean mIsPowerbuttonFps; 18 | 19 | - private boolean mCleanup; 20 | - 21 | private final class BiometricTaskStackListener extends TaskStackListener { 22 | @Override 23 | public void onTaskStackChanged() { 24 | @@ -351,9 +349,6 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider 25 | mCurrentUserId = UserHandle.USER_NULL; 26 | }); 27 | 28 | - mCleanup = context.getResources().getBoolean( 29 | - com.android.internal.R.bool.config_cleanupUnusedFingerprints); 30 | - 31 | try { 32 | ActivityManager.getService().registerUserSwitchObserver(mUserSwitchObserver, TAG); 33 | } catch (RemoteException e) { 34 | @@ -734,9 +729,6 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider 35 | 36 | private void scheduleInternalCleanup(int userId, 37 | @Nullable ClientMonitorCallback callback) { 38 | - if (!mCleanup) { 39 | - return; 40 | - } 41 | mHandler.post(() -> { 42 | scheduleUpdateActiveUserWithoutHandler(userId); 43 | 44 | -- 45 | 2.34.1 46 | 47 | -------------------------------------------------------------------------------- /patches/prerequisite/platform_frameworks_base/0004-Revert-core-pm-Allow-wildcard-in-RRO-system-property.patch: -------------------------------------------------------------------------------- 1 | From 7bba06b86b03fcf3f673f4099f61c3ef043c9d1c Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Wed, 13 Sep 2023 11:24:15 +0000 4 | Subject: [PATCH 4/4] Revert "core: pm: Allow wildcard in RRO system property 5 | value checks" 6 | 7 | This reverts commit 2d8e30614ff873ee83203a92eba62f263a001eee. 8 | --- 9 | .../pm/parsing/FrameworkParsingPackageUtils.java | 16 ++++------------ 10 | 1 file changed, 4 insertions(+), 12 deletions(-) 11 | 12 | diff --git a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java 13 | index b75ba82ad091..3e1c5bb3d7ec 100644 14 | --- a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java 15 | +++ b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java 16 | @@ -186,8 +186,8 @@ public class FrameworkParsingPackageUtils { 17 | * Returns {@code true} if both the property name and value are empty or if the given system 18 | * property is set to the specified value. Properties can be one or more, and if properties are 19 | * more than one, they must be separated by comma, and count of names and values must be equal, 20 | - * and also every given system property must be set to the corresponding value or it's a 21 | - * wildcard. In all other cases, returns {@code false} 22 | + * and also every given system property must be set to the corresponding value. 23 | + * In all other cases, returns {@code false} 24 | */ 25 | public static boolean checkRequiredSystemProperties(@Nullable String rawPropNames, 26 | @Nullable String rawPropValues) { 27 | @@ -213,17 +213,9 @@ public class FrameworkParsingPackageUtils { 28 | return false; 29 | } 30 | for (int i = 0; i < propNames.length; i++) { 31 | + // Check property value: make sure it is both set and equal to expected value 32 | final String currValue = SystemProperties.get(propNames[i]); 33 | - // 1. Make sure prop is set. 34 | - if (currValue == null) { 35 | - return false; 36 | - } 37 | - // 2. Check next prop if expected value is a wildcard. 38 | - if ("*".equals(propValues[i])) { 39 | - continue; 40 | - } 41 | - // 3. Check if prop is equal to expected value. 42 | - if (!currValue.equals(propValues[i])) { 43 | + if (!TextUtils.equals(currValue, propValues[i])) { 44 | return false; 45 | } 46 | } 47 | -- 48 | 2.34.1 49 | 50 | -------------------------------------------------------------------------------- /patches/prerequisite/platform_packages_modules_Bluetooth/0001-Revert-gd-hci-Allow-disabling-selected-local-command.patch: -------------------------------------------------------------------------------- 1 | From 7cf56d80f82f3058a8a63da5e3f25fd2ac5bd988 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Mon, 21 Aug 2023 12:59:47 +0000 4 | Subject: [PATCH] Revert "gd: hci: Allow disabling selected local commands" 5 | 6 | This reverts commit d7c59612960e6ed25c7458b0d6f690861765ac0d. 7 | --- 8 | system/gd/hci/controller.cc | 14 -------------- 9 | 1 file changed, 14 deletions(-) 10 | 11 | diff --git a/system/gd/hci/controller.cc b/system/gd/hci/controller.cc 12 | index 58ee4726cf..6af46d02ad 100644 13 | --- a/system/gd/hci/controller.cc 14 | +++ b/system/gd/hci/controller.cc 15 | @@ -16,7 +16,6 @@ 16 | 17 | #include "hci/controller.h" 18 | 19 | -#include 20 | #include 21 | #include 22 | #include 23 | @@ -26,14 +25,10 @@ 24 | #include "hci/hci_layer.h" 25 | #include "hci_controller_generated.h" 26 | #include "os/metrics.h" 27 | -#include "os/system_properties.h" 28 | 29 | namespace bluetooth { 30 | namespace hci { 31 | 32 | -static const char kPropertyDisabledCommands[] = 33 | - "bluetooth.hci.disabled_commands"; 34 | - 35 | using os::Handler; 36 | 37 | struct Controller::impl { 38 | @@ -265,15 +260,6 @@ struct Controller::impl { 39 | ErrorCode status = complete_view.GetStatus(); 40 | ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); 41 | local_supported_commands_ = complete_view.GetSupportedCommands(); 42 | - 43 | - if (auto disabledCommands = os::GetSystemProperty(kPropertyDisabledCommands)) { 44 | - for (const auto& command : android::base::Split(*disabledCommands, ",")) { 45 | - uint16_t index = std::stoi(command); 46 | - uint16_t byte_index = index / 10; 47 | - uint16_t bit_index = index % 10; 48 | - local_supported_commands_[byte_index] &= ~(1 << bit_index); 49 | - } 50 | - } 51 | } 52 | 53 | void read_local_extended_features_complete_handler(std::promise promise, CommandCompleteView view) { 54 | -- 55 | 2.34.1 56 | 57 | -------------------------------------------------------------------------------- /patches/slim.patch: -------------------------------------------------------------------------------- 1 | From 73e69ceb324f5f096400420cf088408d247496ab Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Wed, 15 Feb 2023 09:52:57 +0000 4 | Subject: [PATCH] Slim Pixel Experience 13 5 | 6 | --- 7 | common/common-vendor.mk | 4 ---- 8 | extras/config.mk | 12 ------------ 9 | 2 files changed, 16 deletions(-) 10 | 11 | diff --git a/common/common-vendor.mk b/common/common-vendor.mk 12 | index 328ea71..4f068a4 100644 13 | --- a/common/common-vendor.mk 14 | +++ b/common/common-vendor.mk 15 | @@ -41,14 +41,11 @@ PRODUCT_PACKAGES += \ 16 | CalendarGooglePrebuilt \ 17 | Chrome-Stub \ 18 | GoogleContacts \ 19 | - GoogleTTS \ 20 | LatinIMEGooglePrebuilt \ 21 | LocationHistoryPrebuilt \ 22 | MarkupGoogle \ 23 | - Photos \ 24 | PixelThemesStub \ 25 | PrebuiltDeskClockGoogle \ 26 | - SoundAmplifierPrebuilt \ 27 | SoundPickerPrebuilt \ 28 | TrichromeLibrary-Stub \ 29 | WebViewGoogle-Stub \ 30 | @@ -72,7 +69,6 @@ PRODUCT_PACKAGES += \ 31 | SettingsIntelligenceGooglePrebuilt \ 32 | SetupWizardPrebuilt \ 33 | TurboPrebuilt \ 34 | - Velvet \ 35 | WellbeingPrebuilt \ 36 | EmergencyInfoGoogleNoUi \ 37 | Flipendo \ 38 | diff --git a/extras/config.mk b/extras/config.mk 39 | index ec046a7..bd77c23 100644 40 | --- a/extras/config.mk 41 | +++ b/extras/config.mk 42 | @@ -1,21 +1,9 @@ 43 | -# Recorder 44 | -ifeq ($(TARGET_SUPPORTS_GOOGLE_RECORDER), true) 45 | -PRODUCT_PACKAGES += \ 46 | - RecorderPrebuilt 47 | -endif 48 | - 49 | # arcore 50 | ifeq ($(TARGET_INCLUDE_STOCK_ARCORE),true) 51 | PRODUCT_PACKAGES += \ 52 | arcore 53 | endif 54 | 55 | -# Live Wallpapers 56 | -ifeq ($(TARGET_INCLUDE_LIVE_WALLPAPERS),true) 57 | -PRODUCT_PACKAGES += \ 58 | - PixelLiveWallpaperPrebuilt 59 | -endif 60 | - 61 | # Quick Tap 62 | ifeq ($(TARGET_SUPPORTS_QUICK_TAP),true) 63 | PRODUCT_PACKAGES += \ 64 | -- 65 | 2.34.1 66 | 67 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_bionic/0001-Disable-vndklite-handling.patch: -------------------------------------------------------------------------------- 1 | From 9feb90012e1718c8b7ae736134d4465192e52223 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/4] 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 c6588d2cd..545426fd9 100644 13 | --- a/linker/linker.cpp 14 | +++ b/linker/linker.cpp 15 | @@ -93,7 +93,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 | @@ -3365,10 +3364,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.25.1 36 | 37 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_bionic/0002-Add-new-mechanism-to-fake-vendor-props-on-a-per-proc.patch: -------------------------------------------------------------------------------- 1 | From 43efb3e3d15e3831d5d08d144df79c1615e36c1f Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 19 Feb 2022 08:20:25 -0500 4 | Subject: [PATCH 2/4] Add new mechanism to fake vendor props on a per-process 5 | basis 6 | 7 | This reads debug.phh.props.. If its value is "vendor", 8 | then ro.product.device/ro.product.manufacturer is read from vendor 9 | --- 10 | libc/system_properties/system_properties.cpp | 38 ++++++++++++++++++++ 11 | 1 file changed, 38 insertions(+) 12 | 13 | diff --git a/libc/system_properties/system_properties.cpp b/libc/system_properties/system_properties.cpp 14 | index 1cb15c3df..d6e7e3e68 100644 15 | --- a/libc/system_properties/system_properties.cpp 16 | +++ b/libc/system_properties/system_properties.cpp 17 | @@ -35,6 +35,7 @@ 18 | #include 19 | #include 20 | #include 21 | +#include 22 | 23 | #include 24 | 25 | @@ -50,6 +51,32 @@ 26 | #define SERIAL_DIRTY(serial) ((serial)&1) 27 | #define SERIAL_VALUE_LEN(serial) ((serial) >> 24) 28 | 29 | +static char comm[128]; 30 | +static bool self_ok = false; 31 | +static char comm_override[PROP_VALUE_MAX]; 32 | + 33 | +static void read_self() { 34 | + //NB: Not atomic, but should be good enough, there is no possible corruption from concurrency 35 | + if(self_ok) return; 36 | + self_ok = true; 37 | + 38 | + int fd = open("/proc/self/comm", O_RDONLY); 39 | + if(fd<0) return; 40 | + read(fd, comm, sizeof(comm)-1); 41 | + for(unsigned i=0; i0) return r; 67 | + } 68 | + if(strcmp(name, "ro.product.manufacturer") == 0) { 69 | + int r = Get("ro.product.vendor.manufacturer", value); 70 | + if(r>0) return r; 71 | + } 72 | + } 73 | const prop_info* pi = Find(name); 74 | 75 | if (pi != nullptr) { 76 | -- 77 | 2.25.1 78 | 79 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_bionic/0004-Add-some-properties-to-fake-in-keymaster-prop-replac.patch: -------------------------------------------------------------------------------- 1 | From faebb06332fd42fd15316e21a891348ebc7e9406 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 28 May 2023 16:46:46 -0400 4 | Subject: [PATCH 4/4] Add some properties to fake in "keymaster" prop 5 | replacement mode, to expose unlocked vbmeta state and orange 6 | verifiedbootstate 7 | 8 | --- 9 | libc/system_properties/system_properties.cpp | 6 ++++++ 10 | 1 file changed, 6 insertions(+) 11 | 12 | diff --git a/libc/system_properties/system_properties.cpp b/libc/system_properties/system_properties.cpp 13 | index 40ff48bad..057199318 100644 14 | --- a/libc/system_properties/system_properties.cpp 15 | +++ b/libc/system_properties/system_properties.cpp 16 | @@ -121,6 +121,12 @@ static const char* redirectToProp(const char *name) { 17 | if(strcmp(name, "ro.build.version.security_patch") == 0) { 18 | return "ro.keymaster.xxx.security_patch"; 19 | } 20 | + if(strcmp(name, "ro.boot.vbmeta.device_state") == 0) { 21 | + return "ro.keymaster.xxx.vbmeta_state"; 22 | + } 23 | + if(strcmp(name, "ro.boot.verifiedbootstate") == 0) { 24 | + return "ro.keymaster.xxx.verifiedbootstate"; 25 | + } 26 | } 27 | return name; 28 | } 29 | -- 30 | 2.25.1 31 | 32 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_bootable_recovery/0001-Don-t-reboot-if-we-couldn-t-get-bootctrl.patch: -------------------------------------------------------------------------------- 1 | From 3ca17e76a836a951415d087d160c5b805a7e2d22 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 88fcfa50..097a2c4e 100644 13 | --- a/update_verifier/update_verifier.cpp 14 | +++ b/update_verifier/update_verifier.cpp 15 | @@ -332,7 +332,7 @@ int update_verifier(int argc, char** argv) { 16 | sp module = IBootControl::getService(); 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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_build/0001-build-remove-emulator-crap-from-GSI.patch: -------------------------------------------------------------------------------- 1 | From 069fc1320095c7a37fc8f24b372e7f9213ee6aa9 Mon Sep 17 00:00:00 2001 2 | From: sooti 3 | Date: Tue, 12 Oct 2021 14:32:52 +0300 4 | Subject: [PATCH 1/4] build: remove emulator crap from GSI 5 | 6 | Change-Id: Id45f3ff1d31e3d4492f956e68a1eb4b2fb82ce63 7 | --- 8 | target/product/emulator.mk | 6 +++--- 9 | target/product/emulator_vendor.mk | 6 +++--- 10 | 2 files changed, 6 insertions(+), 6 deletions(-) 11 | 12 | diff --git a/target/product/emulator.mk b/target/product/emulator.mk 13 | index 36da1f7034..1497c061fc 100644 14 | --- a/target/product/emulator.mk 15 | +++ b/target/product/emulator.mk 16 | @@ -36,7 +36,7 @@ PRODUCT_PACKAGES += \ 17 | 18 | PRODUCT_PACKAGE_OVERLAYS := device/generic/goldfish/overlay 19 | 20 | -PRODUCT_CHARACTERISTICS := emulator 21 | +# PRODUCT_CHARACTERISTICS := emulator 22 | 23 | PRODUCT_FULL_TREBLE_OVERRIDE := true 24 | 25 | @@ -56,5 +56,5 @@ PRODUCT_SYSTEM_EXT_PROPERTIES += \ 26 | ro.com.google.locationfeatures=1 27 | 28 | # disable setupwizard 29 | -PRODUCT_SYSTEM_EXT_PROPERTIES += \ 30 | - ro.setupwizard.mode=DISABLED 31 | +# PRODUCT_SYSTEM_EXT_PROPERTIES += \ 32 | +# ro.setupwizard.mode=DISABLED 33 | diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk 34 | index f71b275b0e..62984253f3 100644 35 | --- a/target/product/emulator_vendor.mk 36 | +++ b/target/product/emulator_vendor.mk 37 | @@ -28,7 +28,7 @@ PRODUCT_PACKAGES += \ 38 | 39 | DEVICE_PACKAGE_OVERLAYS := device/generic/goldfish/overlay 40 | 41 | -PRODUCT_CHARACTERISTICS := emulator 42 | +# PRODUCT_CHARACTERISTICS := emulator 43 | 44 | PRODUCT_FULL_TREBLE_OVERRIDE := true 45 | 46 | @@ -48,5 +48,5 @@ PRODUCT_SYSTEM_EXT_PROPERTIES += \ 47 | ro.com.google.locationfeatures=1 48 | 49 | # disable setupwizard 50 | -PRODUCT_SYSTEM_EXT_PROPERTIES += \ 51 | - ro.setupwizard.mode?=DISABLED 52 | +# PRODUCT_SYSTEM_EXT_PROPERTIES += \ 53 | +# ro.setupwizard.mode?=DISABLED 54 | -- 55 | 2.25.1 56 | 57 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_build/0002-build-Bypass-vendor-calls.patch: -------------------------------------------------------------------------------- 1 | From 8acba28c3cb28e469268ed57df773fc37a1b0e36 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/4] 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 01897b77d2..a0a7c0d2fc 100644 13 | --- a/target/product/aosp_arm64.mk 14 | +++ b/target/product/aosp_arm64.mk 15 | @@ -51,9 +51,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.25.1 30 | 31 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_build/0003-Remove-init.vndk-nodef.rc.patch: -------------------------------------------------------------------------------- 1 | From d0da7fbdcc0cc4a65cd6f7c3ada20d36b0aed418 Mon Sep 17 00:00:00 2001 2 | From: Andy CrossGate Yan 3 | Date: Wed, 8 Dec 2021 07:04:53 +0000 4 | Subject: [PATCH 3/4] Remove init.vndk-nodef.rc 5 | 6 | This partially reverts "Deprecate VNDK-lite support from Legacy GSI". 7 | 8 | Paired with https://github.com/LineageOS/android_system_core/commit/0b265e35ddf42638fa807f5349a10c40e3d46446, it kicks permissive devices into bootloader. 9 | Given that GSI+permissive won't ever be a Lineage official scenario, revert this only on our side. 10 | Thanks @Kethen for the insight! 11 | 12 | Change-Id: I7c14fe5229e953f620bb225fa5c981752d0ac5f9 13 | --- 14 | target/product/gsi/Android.mk | 13 ------------- 15 | target/product/gsi/init.gsi.rc | 2 -- 16 | target/product/gsi/init.vndk-nodef.rc | 3 --- 17 | target/product/gsi_release.mk | 1 - 18 | 4 files changed, 19 deletions(-) 19 | delete mode 100644 target/product/gsi/init.vndk-nodef.rc 20 | 21 | diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk 22 | index 85e551d3f2..c1f37e07fa 100644 23 | --- a/target/product/gsi/Android.mk 24 | +++ b/target/product/gsi/Android.mk 25 | @@ -247,16 +247,3 @@ LOCAL_SYSTEM_EXT_MODULE := true 26 | LOCAL_MODULE_RELATIVE_PATH := init 27 | 28 | include $(BUILD_PREBUILT) 29 | - 30 | - 31 | -include $(CLEAR_VARS) 32 | -LOCAL_MODULE := init.vndk-nodef.rc 33 | -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 34 | -LOCAL_LICENSE_CONDITIONS := notice 35 | -LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE 36 | -LOCAL_SRC_FILES := $(LOCAL_MODULE) 37 | -LOCAL_MODULE_CLASS := ETC 38 | -LOCAL_SYSTEM_EXT_MODULE := true 39 | -LOCAL_MODULE_RELATIVE_PATH := gsi 40 | - 41 | -include $(BUILD_PREBUILT) 42 | diff --git a/target/product/gsi/init.gsi.rc b/target/product/gsi/init.gsi.rc 43 | index 69c8e467be..c6faba78d9 100644 44 | --- a/target/product/gsi/init.gsi.rc 45 | +++ b/target/product/gsi/init.gsi.rc 46 | @@ -1,5 +1,3 @@ 47 | # 48 | # Android init script for GSI required initialization 49 | # 50 | - 51 | -import /system/system_ext/etc/gsi/init.vndk-${ro.vndk.version:-nodef}.rc 52 | diff --git a/target/product/gsi/init.vndk-nodef.rc b/target/product/gsi/init.vndk-nodef.rc 53 | deleted file mode 100644 54 | index 1b141a05e7..0000000000 55 | --- a/target/product/gsi/init.vndk-nodef.rc 56 | +++ /dev/null 57 | @@ -1,3 +0,0 @@ 58 | -on early-init 59 | - # Reboot if BOARD_VNDK_VERSION is not defined 60 | - exec - root -- /system/bin/reboot bootloader 61 | diff --git a/target/product/gsi_release.mk b/target/product/gsi_release.mk 62 | index 74501cd1f1..575e90b148 100644 63 | --- a/target/product/gsi_release.mk 64 | +++ b/target/product/gsi_release.mk 65 | @@ -60,7 +60,6 @@ PRODUCT_PACKAGES += com.android.apex.cts.shim.v1_with_prebuilts.flattened 66 | PRODUCT_PACKAGES += \ 67 | gsi_skip_mount.cfg \ 68 | init.gsi.rc \ 69 | - init.vndk-nodef.rc \ 70 | 71 | # Support additional VNDK snapshots 72 | PRODUCT_EXTRA_VNDK_VERSIONS := \ 73 | -- 74 | 2.25.1 75 | 76 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_build/0004-build-Remove-llkd.patch: -------------------------------------------------------------------------------- 1 | From 5529146869934316d087ebf5a0d118512bcbc818 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/4] 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 b0870c32aa..310876804c 100644 15 | --- a/target/product/base_system.mk 16 | +++ b/target/product/base_system.mk 17 | @@ -203,7 +203,6 @@ PRODUCT_PACKAGES += \ 18 | libwilhelm \ 19 | linker \ 20 | linkerconfig \ 21 | - llkd \ 22 | lmkd \ 23 | LocalTransport \ 24 | locksettings \ 25 | -- 26 | 2.25.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0001-Increase-default-log_level-to-get-actual-selinux-err.patch: -------------------------------------------------------------------------------- 1 | From e6137af9827acb0134cdf51d70b18c4e9ef67998 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 80d3583d..a51630b2 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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0002-Revert-libsepol-Make-an-unknown-permission-an-error-.patch: -------------------------------------------------------------------------------- 1 | From d75d33515d4e39d6165f6b88b0558358736fb587 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 69a8a2ed..b63c1359 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.25.1 45 | 46 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0004-Allow-devices-virtual-block-genfscon-conflict-seen-o.patch: -------------------------------------------------------------------------------- 1 | From 7cbbd5b16ba622aef077df4d7caf24ece6451a71 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 09c02af9..5c0e99c3 100644 14 | --- a/libsepol/cil/src/cil_post.c 15 | +++ b/libsepol/cil/src/cil_post.c 16 | @@ -491,7 +491,23 @@ 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 | int cil_post_netifcon_context_compare(const void *a, const void *b) 41 | -- 42 | 2.25.1 43 | 44 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0005-if-service-is-rcs-accept-conflict.-Seen-on-Moto-E5.patch: -------------------------------------------------------------------------------- 1 | From 53f1d10bbab3d7d5a70456be39851538118ee122 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 12 Sep 2019 20:37:04 +0200 4 | Subject: [PATCH 05/10] if service is "rcs", accept conflict. Seen on Moto E5 5 | 6 | Change-Id: I0cc2d0fad83f403f2b5d7458039b1564ce5ed9dd 7 | --- 8 | libselinux/src/label_backends_android.c | 14 ++++++++++++-- 9 | 1 file changed, 12 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c 12 | index e52b44d4..3b8a2bd8 100644 13 | --- a/libselinux/src/label_backends_android.c 14 | +++ b/libselinux/src/label_backends_android.c 15 | @@ -62,14 +62,24 @@ static int nodups_specs(struct saved_data *data) 16 | curr_spec->property_key)) { 17 | if (strcmp(spec_arr[jj].lr.ctx_raw, 18 | curr_spec->lr.ctx_raw)) { 19 | - rc = -1; 20 | - errno = EINVAL; 21 | selinux_log 22 | (SELINUX_ERROR, 23 | "Multiple different specifications for %s (%s and %s).\n", 24 | curr_spec->property_key, 25 | spec_arr[jj].lr.ctx_raw, 26 | curr_spec->lr.ctx_raw); 27 | + int ignore = 0; 28 | + /* 29 | + * This issue has been found on Moto E5 30 | + * E SELinux : Multiple different specifications for rcs (u:object_r:radio_service:s0 and u:object_r:mot_rcs_service:s0). 31 | + */ 32 | + if(!strcmp(curr_spec->property_key, "rcs")) 33 | + ignore = 1; 34 | + 35 | + if(!ignore) { 36 | + rc = -1; 37 | + errno = EINVAL; 38 | + } 39 | } else { 40 | selinux_log 41 | (SELINUX_WARNING, 42 | -- 43 | 2.25.1 44 | 45 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0006-Allow-mismatches-of-exfat-genfscon.patch: -------------------------------------------------------------------------------- 1 | From 207b6ab1b4fe3bdafc66b65edd4e486a80541ee8 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 5c0e99c3..97bf54f8 100644 12 | --- a/libsepol/cil/src/cil_post.c 13 | +++ b/libsepol/cil/src/cil_post.c 14 | @@ -502,6 +502,10 @@ 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.25.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0007-Enable-multipl_decls-by-default.-This-is-needed-beca.patch: -------------------------------------------------------------------------------- 1 | From d79ea4efefc24741fcc9e664f4e7e5f3607b414d Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 2 Mar 2018 22:49:55 +0100 4 | Subject: [PATCH 07/10] Enable multipl_decls by default. This is needed because 5 | 8.0 init doesn't add -m 6 | 7 | Change-Id: I43dc661d519f7b8576d72a828d8cbd444592bf5e 8 | --- 9 | secilc/secilc.c | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/secilc/secilc.c b/secilc/secilc.c 13 | index a51630b2..d9841ab0 100644 14 | --- a/secilc/secilc.c 15 | +++ b/secilc/secilc.c 16 | @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) 17 | int target = SEPOL_TARGET_SELINUX; 18 | int mls = -1; 19 | int disable_dontaudit = 0; 20 | - int multiple_decls = 0; 21 | + int multiple_decls = 1; 22 | int disable_neverallow = 0; 23 | int preserve_tunables = 0; 24 | int qualified_names = 0; 25 | -- 26 | 2.25.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0009-Improve-SELinux-policy-workaround-on-device-phh-treb.patch: -------------------------------------------------------------------------------- 1 | From 1a18553654f2b6e307f99b256cc272ee63b7b651 Mon Sep 17 00:00:00 2001 2 | From: ponces 3 | Date: Mon, 7 Nov 2022 16:14:20 +0000 4 | Subject: [PATCH 09/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 023fd6c7..61c8864b 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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_external_selinux/0010-Allow-sys-vm-watermark_scale_factor-conflict-seen-on.patch: -------------------------------------------------------------------------------- 1 | From 24b3713d636c6869b35a511a00495642c9b23ccd 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 10/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 97bf54f8..4cf1f2d3 100644 13 | --- a/libsepol/cil/src/cil_post.c 14 | +++ b/libsepol/cil/src/cil_post.c 15 | @@ -502,6 +502,15 @@ 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.25.1 33 | 34 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0004-APM-Optionally-force-load-audio-policy-for-system-si.patch: -------------------------------------------------------------------------------- 1 | From 87c7df3a8aef5bd56c658b692b71c9f7ddacfc12 Mon Sep 17 00:00:00 2001 2 | From: Peter Cai 3 | Date: Wed, 24 Aug 2022 15:42:39 -0400 4 | Subject: [PATCH 04/28] APM: Optionally force-load audio policy for system-side 5 | bt audio HAL 6 | 7 | Required to support our system-side bt audio implementation, i.e. 8 | `sysbta`. 9 | 10 | Co-authored-by: Pierre-Hugues Husson 11 | Change-Id: I279fff541a531f922f3fa55b8f14d00237db59ff 12 | --- 13 | .../managerdefinitions/src/Serializer.cpp | 25 +++++++++++++++++++ 14 | 1 file changed, 25 insertions(+) 15 | 16 | diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 17 | index 2f0ce75e47..b35d34a599 100644 18 | --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 19 | +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 20 | @@ -25,6 +25,7 @@ 21 | #include 22 | #include 23 | #include 24 | +#include 25 | #include 26 | #include 27 | #include 28 | @@ -983,6 +984,30 @@ status_t PolicySerializer::deserialize(const char *configFile, AudioPolicyConfig 29 | if (status != NO_ERROR) { 30 | return status; 31 | } 32 | + 33 | + // Remove modules called bluetooth, bluetooth_qti or a2dp, and inject our own 34 | + if (property_get_bool("persist.bluetooth.system_audio_hal.enabled", false)) { 35 | + for (auto it = modules.begin(); it != modules.end(); it++) { 36 | + const char *name = (*it)->getName(); 37 | + if (strcmp(name, "a2dp") == 0 || 38 | + strcmp(name, "a2dpsink") == 0 || 39 | + strcmp(name, "bluetooth") == 0 || 40 | + strcmp(name, "bluetooth_qti") == 0) { 41 | + 42 | + ALOGE("Removed module %s\n", name); 43 | + it = modules.erase(it); 44 | + } 45 | + if (it == modules.end()) break; 46 | + } 47 | + const char* a2dpFileName = "/system/etc/sysbta_audio_policy_configuration.xml"; 48 | + if (version == "7.0") 49 | + a2dpFileName = "/system/etc/sysbta_audio_policy_configuration_7_0.xml"; 50 | + auto doc = make_xmlUnique(xmlParseFile(a2dpFileName)); 51 | + xmlNodePtr root = xmlDocGetRootElement(doc.get()); 52 | + auto maybeA2dpModule = deserialize(root, config); 53 | + modules.add(std::get<1>(maybeA2dpModule)); 54 | + } 55 | + 56 | config->setHwModules(modules); 57 | 58 | // Global Configuration 59 | -- 60 | 2.25.1 61 | 62 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0006-audiopolicy-try-again-with-trimmed-audio-port-name-i.patch: -------------------------------------------------------------------------------- 1 | From f310ec6095f06709cbb087a1a34642e51e4f1b91 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/28] 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 456c5a935c..45ee70ab6e 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.25.1 55 | 56 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0007-camera-Implement-property-to-override-default-camera.patch: -------------------------------------------------------------------------------- 1 | From da5a18b71f25d6c8de39f3299bb6c25ed6b8ecb3 Mon Sep 17 00:00:00 2001 2 | From: Peter Cai 3 | Date: Wed, 1 Jun 2022 16:56:46 -0400 4 | Subject: [PATCH 07/28] camera: Implement property to override default camera 5 | 6 | Complement to the frameworks/base patch. 7 | 8 | Change-Id: I002bfa974bafc2cc01365eeea31c7a5dcb5a2028 9 | --- 10 | .../common/CameraProviderManager.cpp | 22 +++++++++++++++++++ 11 | 1 file changed, 22 insertions(+) 12 | 13 | diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp 14 | index 43f92a9927..d9fc2ef135 100644 15 | --- a/services/camera/libcameraservice/common/CameraProviderManager.cpp 16 | +++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp 17 | @@ -36,6 +36,7 @@ 18 | #include 19 | #include 20 | #include 21 | +#include 22 | #include 23 | #include 24 | #include 25 | @@ -210,6 +211,15 @@ std::vector CameraProviderManager::getCameraDeviceIds(std::unordere 26 | } 27 | } 28 | } 29 | + 30 | + int32_t altPrimaryCamera = property_get_int32("persist.sys.alt_primary_camera", 0); 31 | + 32 | + if (altPrimaryCamera != 0 && deviceIds.size() > (size_t) altPrimaryCamera) { 33 | + const std::string origPrimary = deviceIds[0]; 34 | + deviceIds[0] = deviceIds[altPrimaryCamera]; 35 | + deviceIds[altPrimaryCamera] = origPrimary; 36 | + } 37 | + 38 | return deviceIds; 39 | } 40 | 41 | @@ -276,6 +286,18 @@ std::vector CameraProviderManager::getAPI1CompatibleCameraDeviceIds 42 | std::sort(systemDeviceIds.begin(), systemDeviceIds.end(), sortFunc); 43 | deviceIds.insert(deviceIds.end(), publicDeviceIds.begin(), publicDeviceIds.end()); 44 | deviceIds.insert(deviceIds.end(), systemDeviceIds.begin(), systemDeviceIds.end()); 45 | + 46 | + // Default camera ID hack should match with android.hardware.camera2.CameraManager.sortCameraIds 47 | + // Note that the alt primary camera may not be available here due to filterLogicalCameraIdsLocked() 48 | + // in which case we will just ignore it. 49 | + int altPrimaryCameraId = base::GetIntProperty("persist.sys.alt_primary_camera", -1); 50 | + 51 | + if (altPrimaryCameraId > 0 && altPrimaryCameraId < (int) deviceIds.size()) { 52 | + std::string origPrimary = deviceIds[0]; 53 | + deviceIds[0] = deviceIds[altPrimaryCameraId]; 54 | + deviceIds[altPrimaryCameraId] = origPrimary; 55 | + } 56 | + 57 | return deviceIds; 58 | } 59 | 60 | -- 61 | 2.25.1 62 | 63 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0008-There-are-three-SCO-devices.-Fallback-from-one-to-th.patch: -------------------------------------------------------------------------------- 1 | From a75f8ef23865c64ea6cb340623b6b2425d8dfa54 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/28] 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 418b7ebe88..a97f76be59 100644 14 | --- a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp 15 | +++ b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp 16 | @@ -311,6 +311,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.25.1 46 | 47 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0011-Add-a-property-to-force-camera-timestamp-source.patch: -------------------------------------------------------------------------------- 1 | From aa3472198d0129de4e727b23e82a1f718d34dd91 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 11/28] 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 e55d724b9f..5362312085 100644 22 | --- a/services/camera/libcameraservice/device3/Camera3Device.cpp 23 | +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp 24 | @@ -194,8 +194,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.25.1 45 | 46 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0013-No-longer-make-re-assigning-legacy-audio-groups-fata.patch: -------------------------------------------------------------------------------- 1 | From 75fe77e64dabd520ccf814eca4ad0d4ad5bff5bf 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 13/28] 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 99507eee5d..e31cc21b17 100644 15 | --- a/services/audiopolicy/engine/common/src/EngineBase.cpp 16 | +++ b/services/audiopolicy/engine/common/src/EngineBase.cpp 17 | @@ -222,9 +222,9 @@ engineConfig::ParsingResult EngineBase::loadAudioPolicyEngineConfig() 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.25.1 32 | 33 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0014-Make-camera-IDs-filter-out-optional.patch: -------------------------------------------------------------------------------- 1 | From a10dd094dfbdc44e7ccdeab5437e6bc9925b922f Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 21 Dec 2020 20:19:11 +0100 4 | Subject: [PATCH 14/28] Make camera IDs filter-out optional 5 | 6 | Nowadays most people have Camera 2 apps, and would like to have all 7 | cameras, rather than limit which cameras are available. 8 | Add a property for that. 9 | --- 10 | .../camera/libcameraservice/common/CameraProviderManager.cpp | 4 +++- 11 | 1 file changed, 3 insertions(+), 1 deletion(-) 12 | 13 | diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp 14 | index d9fc2ef135..292342238d 100644 15 | --- a/services/camera/libcameraservice/common/CameraProviderManager.cpp 16 | +++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp 17 | @@ -260,7 +260,9 @@ std::vector CameraProviderManager::getAPI1CompatibleCameraDeviceIds 18 | // API1 app doesn't handle logical and physical camera devices well. So 19 | // for each camera facing, only take the first id advertised by HAL in 20 | // all [logical, physical1, physical2, ...] id combos, and filter out the rest. 21 | - filterLogicalCameraIdsLocked(providerDeviceIds); 22 | + if(!property_get_bool("persist.sys.phh.include_all_cameras", false)) { 23 | + filterLogicalCameraIdsLocked(providerDeviceIds); 24 | + } 25 | collectDeviceIdsLocked(providerDeviceIds, publicDeviceIds, systemDeviceIds); 26 | } 27 | auto sortFunc = 28 | -- 29 | 2.25.1 30 | 31 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0016-Don-t-crash-on-unknown-audio-devices.patch: -------------------------------------------------------------------------------- 1 | From c187aaef80cf27f231faffa8029e2dfb89e1a1eb Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 23 Mar 2021 00:16:42 +0100 4 | Subject: [PATCH 16/28] Don't crash on unknown audio devices 5 | 6 | Change-Id: I2df8d88f742da6a84aa8888cdf19de25444de919 7 | --- 8 | .../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 12 | index 2bf5705512..78812b1098 100644 13 | --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 14 | +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 15 | @@ -867,7 +867,7 @@ std::variant PolicySerializer::deserialize device = module->getDeclaredDevices(). 17 | getDeviceFromTagName(std::string(reinterpret_cast( 18 | attachedDevice.get()))); 19 | - if (device == nullptr && mIgnoreVendorExtensions) { 20 | + if (device == nullptr) { 21 | ALOGW("Skipped attached device \"%s\" because it likely uses a vendor" 22 | "extension type", 23 | reinterpret_cast(attachedDevice.get())); 24 | -- 25 | 2.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0017-Not-all-sources-in-a-route-are-valid.-Dont-ignore-th.patch: -------------------------------------------------------------------------------- 1 | From 117b4744f247ba6b0e6404ddfb6869e2540f7d17 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 17/28] 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 78812b1098..9addf7dbdc 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) { 22 | ALOGE("%s: no source found with name=%s", __func__, devTag); 23 | return BAD_VALUE; 24 | } else if (source == NULL) { 25 | -- 26 | 2.25.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0018-Use-a-fake-volume-policy-when-none-has-been-found.patch: -------------------------------------------------------------------------------- 1 | From 3e0c434220216a0fb1fa0846554bade8cb99eb4e 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 18/28] 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 6f560d558d..92cf03e418 100644 19 | --- a/services/audiopolicy/engine/config/src/EngineConfig.cpp 20 | +++ b/services/audiopolicy/engine/config/src/EngineConfig.cpp 21 | @@ -724,7 +724,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.25.1 37 | 38 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0019-When-aux-cameras-are-enabled-ignore-system-only-came.patch: -------------------------------------------------------------------------------- 1 | From bf517313198b46533ea87c534a0d7592eb6573ce Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 7 Aug 2021 11:11:39 +0200 4 | Subject: [PATCH 19/28] When aux cameras are enabled, ignore "system only" 5 | camera flag (it shouldnt be q security issue since secure cameras are listed 6 | otherwise) 7 | 8 | --- 9 | .../libcameraservice/common/CameraProviderManager.cpp | 10 ++++++---- 10 | 1 file changed, 6 insertions(+), 4 deletions(-) 11 | 12 | diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp 13 | index 292342238d..4a2fb94da3 100644 14 | --- a/services/camera/libcameraservice/common/CameraProviderManager.cpp 15 | +++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp 16 | @@ -978,10 +978,12 @@ SystemCameraKind CameraProviderManager::ProviderInfo::DeviceInfo3::getSystemCame 17 | 18 | // Go through the capabilities and check if it has 19 | // ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA 20 | - for (size_t i = 0; i < entryCap.count; ++i) { 21 | - uint8_t capability = entryCap.data.u8[i]; 22 | - if (capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA) { 23 | - return SystemCameraKind::SYSTEM_ONLY_CAMERA; 24 | + if(!property_get_bool("persist.sys.phh.include_all_cameras", false)) { 25 | + for (size_t i = 0; i < entryCap.count; ++i) { 26 | + uint8_t capability = entryCap.data.u8[i]; 27 | + if (capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA) { 28 | + return SystemCameraKind::SYSTEM_ONLY_CAMERA; 29 | + } 30 | } 31 | } 32 | return SystemCameraKind::PUBLIC; 33 | -- 34 | 2.25.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0021-Fix-parsing-audio-hal-7.0-audio-policies.patch: -------------------------------------------------------------------------------- 1 | From e67d36dfa5bfad87870ad8c5fb3cba154ab05048 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 30 Jan 2022 07:40:19 -0500 4 | Subject: [PATCH 21/28] Fix parsing audio hal 7.0 audio policies 5 | 6 | Google changed separator from natural "," to weird " " 7 | We broke its support in "FIH devices: Fix "Earpiece" audio output" 8 | 9 | Change-Id: I458b8b6a6498dd9cf748e00843ff65c561579902 10 | --- 11 | .../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 15 | index 9addf7dbdc..9d3d9fd169 100644 16 | --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 17 | +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 18 | @@ -428,7 +428,7 @@ PolicySerializer::deserialize( 19 | std::string samplingRates = getXmlAttribute(cur, Attributes::samplingRates); 20 | std::string format = getXmlAttribute(cur, Attributes::format); 21 | std::string channels = getXmlAttribute(cur, Attributes::channelMasks); 22 | - ChannelTraits::Collection channelsMask = channelMasksFromString(channels, ","); 23 | + ChannelTraits::Collection channelsMask = channelMasksFromString(channels, mChannelMasksSeparator.c_str()); 24 | 25 | //Some Foxconn devices have wrong earpiece channel mask, leading to no channel mask 26 | if(channelsMask.size() == 1 && *channelsMask.begin() == AUDIO_CHANNEL_IN_MONO && isOutput) { 27 | -- 28 | 2.25.1 29 | 30 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0022-fixup-Not-all-sources-in-a-route-are-valid.-Dont-ign.patch: -------------------------------------------------------------------------------- 1 | From 9bb7c55d10974225ec09f5e5b7e7b18ad4c53d80 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 12 Mar 2022 18:07:43 -0500 4 | Subject: [PATCH 22/28] fixup! Not all sources in a route are valid. Dont 5 | ignore the whole route because of one broken source 6 | 7 | --- 8 | .../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 12 | index 9d3d9fd169..95d2463230 100644 13 | --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 14 | +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp 15 | @@ -667,7 +667,7 @@ std::variant PolicySerializer::deserializefindPortByTagName(trim(devTag)); 18 | } 19 | - if (source == NULL) { 20 | + if (source == NULL && false) { 21 | ALOGE("%s: no source found with name=%s", __func__, devTag); 22 | return BAD_VALUE; 23 | } else if (source == NULL) { 24 | -- 25 | 2.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0023-Add-a-prop-to-change-Samsung-flash-strength.patch: -------------------------------------------------------------------------------- 1 | From 618216bf303f76f6cb62d04de25eefe0d4a39494 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 16 Apr 2022 14:30:14 -0400 4 | Subject: [PATCH 23/28] Add a prop to change Samsung flash strength 5 | 6 | --- 7 | services/camera/libcameraservice/Android.bp | 1 + 8 | .../common/hidl/HidlProviderInfo.cpp | 14 +++++++++++++- 9 | 2 files changed, 14 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp 12 | index 1faeb60ba7..8c588065cf 100644 13 | --- a/services/camera/libcameraservice/Android.bp 14 | +++ b/services/camera/libcameraservice/Android.bp 15 | @@ -166,6 +166,7 @@ cc_library_shared { 16 | "android.hardware.camera.device-V1-ndk", 17 | "vendor.samsung.hardware.camera.provider@3.0", 18 | "vendor.samsung.hardware.camera.provider@4.0", 19 | + "vendor.samsung.hardware.camera.device@5.0", 20 | "media_permission-aidl-cpp", 21 | ], 22 | 23 | diff --git a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp 24 | index 367ffb8cdc..362945a1ea 100644 25 | --- a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp 26 | +++ b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp 27 | @@ -29,6 +29,7 @@ 28 | #include 29 | #include 30 | #include 31 | +#include 32 | 33 | namespace { 34 | const bool kEnableLazyHal(property_get_bool("ro.camera.enableLazyHal", false)); 35 | @@ -781,7 +782,18 @@ HidlProviderInfo::HidlDeviceInfo3::HidlDeviceInfo3( 36 | status_t HidlProviderInfo::HidlDeviceInfo3::setTorchMode(bool enabled) { 37 | using hardware::camera::common::V1_0::TorchMode; 38 | const sp interface = startDeviceInterface(); 39 | - Status s = interface->setTorchMode(enabled ? TorchMode::ON : TorchMode::OFF); 40 | + int32_t flashStrength = property_get_int32("persist.sys.phh.flash_strength", 1); 41 | + 42 | + auto sehCast = vendor::samsung::hardware::camera::device::V5_0::ISehCameraDevice::castFrom(interface); 43 | + android::sp seh = sehCast; 44 | + 45 | + Status s; 46 | + if(seh != nullptr) { 47 | + s = seh->sehSetTorchModeStrength(enabled ? TorchMode::ON : TorchMode::OFF, flashStrength); 48 | + } else { 49 | + s = interface->setTorchMode(enabled ? TorchMode::ON : TorchMode::OFF); 50 | + } 51 | + 52 | return mapToStatusT(s); 53 | } 54 | 55 | -- 56 | 2.25.1 57 | 58 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0024-Support-variable-flash-strength-on-samsung-hal-4.0.patch: -------------------------------------------------------------------------------- 1 | From 77d472080eb00e2da0d4892bfb9426d7977517c0 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 2 May 2022 17:37:09 -0400 4 | Subject: [PATCH 24/28] Support variable flash strength on samsung hal 4.0 5 | 6 | --- 7 | services/camera/libcameraservice/Android.bp | 1 + 8 | .../libcameraservice/common/hidl/HidlProviderInfo.cpp | 6 ++++++ 9 | 2 files changed, 7 insertions(+) 10 | 11 | diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp 12 | index 8c588065cf..769862aaa2 100644 13 | --- a/services/camera/libcameraservice/Android.bp 14 | +++ b/services/camera/libcameraservice/Android.bp 15 | @@ -167,6 +167,7 @@ cc_library_shared { 16 | "vendor.samsung.hardware.camera.provider@3.0", 17 | "vendor.samsung.hardware.camera.provider@4.0", 18 | "vendor.samsung.hardware.camera.device@5.0", 19 | + "vendor.samsung.hardware.camera.device@4.0", 20 | "media_permission-aidl-cpp", 21 | ], 22 | 23 | diff --git a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp 24 | index 362945a1ea..62c57cd4f7 100644 25 | --- a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp 26 | +++ b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp 27 | @@ -30,6 +30,7 @@ 28 | #include 29 | #include 30 | #include 31 | +#include 32 | 33 | namespace { 34 | const bool kEnableLazyHal(property_get_bool("ro.camera.enableLazyHal", false)); 35 | @@ -787,9 +788,14 @@ status_t HidlProviderInfo::HidlDeviceInfo3::setTorchMode(bool enabled) { 36 | auto sehCast = vendor::samsung::hardware::camera::device::V5_0::ISehCameraDevice::castFrom(interface); 37 | android::sp seh = sehCast; 38 | 39 | + auto sehCast2 = vendor::samsung::hardware::camera::device::V4_0::ISehCameraDevice::castFrom(interface); 40 | + android::sp seh2 = sehCast2; 41 | + 42 | Status s; 43 | if(seh != nullptr) { 44 | s = seh->sehSetTorchModeStrength(enabled ? TorchMode::ON : TorchMode::OFF, flashStrength); 45 | + } else if(seh2 != nullptr) { 46 | + s = seh2->sehSetTorchModeStrength(enabled ? TorchMode::ON : TorchMode::OFF, flashStrength); 47 | } else { 48 | s = interface->setTorchMode(enabled ? TorchMode::ON : TorchMode::OFF); 49 | } 50 | -- 51 | 2.25.1 52 | 53 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_av/0025-voip-Fix-high-pitched-voice-on-Qualcomm-devices.patch: -------------------------------------------------------------------------------- 1 | From 43d61efb58d846901e3d08925537fe2710717917 Mon Sep 17 00:00:00 2001 2 | From: ponces 3 | Date: Mon, 24 Oct 2022 09:38:34 +0100 4 | Subject: [PATCH 25/28] 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 95d2463230..ef310977b2 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: Thu, 5 Apr 2018 10:01:19 +0800 4 | Subject: [PATCH 01/42] 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 863bf94b13c1..1a3a7902872f 100644 13 | --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java 14 | +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java 15 | @@ -5853,20 +5853,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.25.1 40 | 41 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0002-Fallback-to-stupid-autobrightness-if-brightness-valu.patch: -------------------------------------------------------------------------------- 1 | From 3cb9a996acd0b18c8e8fc795a6ad0d2a16b86192 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/42] 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 482dd7a726b2..44150f8f68d0 100644 18 | --- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java 19 | +++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java 20 | @@ -676,9 +676,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.25.1 39 | 40 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0003-Fix-env-empty-string-ANDROID_STORAGE.patch: -------------------------------------------------------------------------------- 1 | From cad0be943e66c3699978426224aa88fdccc76f57 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/42] 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 5177cb4f8549..f593dc38bc1c 100644 13 | --- a/core/java/android/os/Environment.java 14 | +++ b/core/java/android/os/Environment.java 15 | @@ -1471,7 +1471,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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0006-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch: -------------------------------------------------------------------------------- 1 | From c50f5495f8354163524edd70a1b0486b5b2c0ba5 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 06/42] 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 c4e84a4cd138..2654f499db09 100644 14 | --- a/services/core/java/com/android/server/ConsumerIrService.java 15 | +++ b/services/core/java/com/android/server/ConsumerIrService.java 16 | @@ -49,14 +49,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.25.1 46 | 47 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0007-Implement-a-persistent-property-to-override-the-defa.patch: -------------------------------------------------------------------------------- 1 | From 4989f0c12573887465bdec33d79725b0af3d0895 Mon Sep 17 00:00:00 2001 2 | From: Peter Cai 3 | Date: Wed, 1 Jun 2022 16:56:20 -0400 4 | Subject: [PATCH 07/42] Implement a persistent property to override the default 5 | primary camera (0) 6 | 7 | Change-Id: I49b45d00bf71d7932591b3516d49a680e1b6568b 8 | --- 9 | core/java/android/hardware/Camera.java | 6 ++++++ 10 | core/java/android/hardware/camera2/CameraManager.java | 9 +++++++++ 11 | 2 files changed, 15 insertions(+) 12 | 13 | diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java 14 | index ccc39b6080d7..a21bfdce6f05 100644 15 | --- a/core/java/android/hardware/Camera.java 16 | +++ b/core/java/android/hardware/Camera.java 17 | @@ -409,6 +410,11 @@ public class Camera { 18 | * @see #open(int) 19 | */ 20 | public static Camera open() { 21 | + int altPrimaryCamera = SystemProperties.getInt("persist.sys.alt_primary_camera", -1); 22 | + if (altPrimaryCamera > 0) { 23 | + return new Camera(altPrimaryCamera); 24 | + } 25 | + 26 | int numberOfCameras = getNumberOfCameras(); 27 | CameraInfo cameraInfo = new CameraInfo(); 28 | for (int i = 0; i < numberOfCameras; i++) { 29 | diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java 30 | index 56592ab43143..26b14d374d65 100644 31 | --- a/core/java/android/hardware/camera2/CameraManager.java 32 | +++ b/core/java/android/hardware/camera2/CameraManager.java 33 | @@ -1825,6 +1825,15 @@ public final class CameraManager { 34 | } 35 | }}); 36 | 37 | + // HAXX: Allow overriding default primary camera (assumed to be camera 0) via property 38 | + // Should match with libcameraservice/common/CameraProviderManager.cpp 39 | + int altPrimaryCamera = SystemProperties.getInt("persist.sys.alt_primary_camera", -1); 40 | + if (altPrimaryCamera > 0 && altPrimaryCamera < cameraIds.length) { 41 | + String origPrimary = cameraIds[0]; 42 | + cameraIds[0] = cameraIds[altPrimaryCamera]; 43 | + cameraIds[altPrimaryCamera] = origPrimary; 44 | + } 45 | + 46 | } 47 | 48 | public static boolean cameraStatusesContains(CameraStatus[] cameraStatuses, String id) { 49 | -- 50 | 2.25.1 51 | 52 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0008-Show-APN-Settings-for-CDMA-carriers.patch: -------------------------------------------------------------------------------- 1 | From 24a73637a51b62872071165d3270591b8b60aca1 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 08/42] 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 741721d14ac1..2b08fa644779 100644 12 | --- a/telephony/java/android/telephony/CarrierConfigManager.java 13 | +++ b/telephony/java/android/telephony/CarrierConfigManager.java 14 | @@ -8712,7 +8712,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.25.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0009-Re-order-services-so-that-it-works-even-without-qtag.patch: -------------------------------------------------------------------------------- 1 | From eb97b9394d81ca4cc349189870849aa104bb9235 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 09/42] 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 2f818fa10b72..b0b63174d660 100644 13 | --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java 14 | +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java 15 | @@ -923,6 +923,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 | @@ -930,10 +934,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.25.1 39 | 40 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0010-Support-samsung-Pie-and-Q-light-hal.patch: -------------------------------------------------------------------------------- 1 | From 40d6977f78106d0d7cd425b17dded76d2514b9f8 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 10/42] 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 0d49f5fffb4b..1fc974ebc56f 100644 13 | --- a/services/core/jni/Android.bp 14 | +++ b/services/core/jni/Android.bp 15 | @@ -186,6 +186,8 @@ cc_defaults { 16 | "android.system.suspend.control.internal-cpp", 17 | "android.system.suspend-V1-ndk", 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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0012-Always-allow-overriding-the-number-of-work-profiles.patch: -------------------------------------------------------------------------------- 1 | From 164389e58c9c7bde6c6227f794e6c02753e42a4b Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 5 Apr 2020 16:32:46 +0200 4 | Subject: [PATCH 12/42] Always allow overriding the number of work profiles 5 | 6 | Change-Id: I6eb09aa71663c6fbe7563e3038bffcabdba0ff6a 7 | --- 8 | .../java/com/android/server/pm/UserManagerService.java | 8 ++------ 9 | 1 file changed, 2 insertions(+), 6 deletions(-) 10 | 11 | diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java 12 | index 88aeb17dc2b4..03eb0cd15aac 100644 13 | --- a/services/core/java/com/android/server/pm/UserManagerService.java 14 | +++ b/services/core/java/com/android/server/pm/UserManagerService.java 15 | @@ -6490,12 +6490,8 @@ public class UserManagerService extends IUserManager.Stub { 16 | */ 17 | private static int getMaxUsersOfTypePerParent(UserTypeDetails userTypeDetails) { 18 | final int defaultMax = userTypeDetails.getMaxAllowedPerParent(); 19 | - if (!Build.IS_DEBUGGABLE) { 20 | - return defaultMax; 21 | - } else { 22 | - if (userTypeDetails.isManagedProfile()) { 23 | - return SystemProperties.getInt("persist.sys.max_profiles", defaultMax); 24 | - } 25 | + if (userTypeDetails.isManagedProfile()) { 26 | + return SystemProperties.getInt("persist.sys.max_profiles", defaultMax); 27 | } 28 | return defaultMax; 29 | } 30 | -- 31 | 2.25.1 32 | 33 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0013-HOME-deserves-to-wake-up-devices-just-as-well-as-bac.patch: -------------------------------------------------------------------------------- 1 | From af7c4f8dbb3df3e0fa72a270aea6e99844cb4475 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 13/42] 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 c3a638c4c36a..a392a953371d 100644 14 | --- a/core/java/android/view/KeyEvent.java 15 | +++ b/core/java/android/view/KeyEvent.java 16 | @@ -2035,6 +2035,7 @@ public class KeyEvent extends InputEvent implements Parcelable { 17 | case KeyEvent.KEYCODE_CAMERA: 18 | case KeyEvent.KEYCODE_FOCUS: 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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0014-Some-devices-have-proximity-sensor-reporting-NaN-as-.patch: -------------------------------------------------------------------------------- 1 | From 8d3db32e7e61573363d5d22215e1776bdf63c503 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 14/42] 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 5ae16b4de0a6..53aace7b505c 100644 14 | --- a/services/core/java/com/android/server/display/DisplayPowerController.java 15 | +++ b/services/core/java/com/android/server/display/DisplayPowerController.java 16 | @@ -2175,6 +2175,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.25.1 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0015-Fix-brightness-range-not-being-complete-on-Samsung-d.patch: -------------------------------------------------------------------------------- 1 | From a976f4f5c99d23bf747a95f8d4ae6b57d64d5a97 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 15/42] 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 5d1a5810a01e..f2773e3bb48d 100644 19 | --- a/services/core/java/com/android/server/power/PowerManagerService.java 20 | +++ b/services/core/java/com/android/server/power/PowerManagerService.java 21 | @@ -1092,9 +1092,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.25.1 37 | 38 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0017-Remove-useless-notification-about-console-service-be.patch: -------------------------------------------------------------------------------- 1 | From eddf53831fcaa84a5fc8c8598a4b896a53f3f8ae 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 17/42] 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 ba0aaa1b7d8c..e48736fcfb6e 100644 13 | --- a/services/core/java/com/android/server/am/ActivityManagerService.java 14 | +++ b/services/core/java/com/android/server/am/ActivityManagerService.java 15 | @@ -5203,7 +5203,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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0020-TelephonyManager-add-API-annotations-for-setTelephon.patch: -------------------------------------------------------------------------------- 1 | From 4d4e1b0cdbb31a848e744f3c1fc988a56a0c478c Mon Sep 17 00:00:00 2001 2 | From: Peter Cai 3 | Date: Wed, 16 Dec 2020 21:26:45 +0800 4 | Subject: [PATCH 20/42] TelephonyManager: add API annotations for 5 | setTelephonyProperty 6 | 7 | * This method was added back by reverting commit 8 | debb4616ef67f9ed5054eca51ec58592358ff55f, but they do not conform to 9 | the new R API requirements. 10 | 11 | * R requires such annotations. 12 | --- 13 | telephony/java/android/telephony/TelephonyManager.java | 5 +++-- 14 | 1 file changed, 3 insertions(+), 2 deletions(-) 15 | 16 | diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java 17 | index 960824e9dd15..f66168b21d2b 100644 18 | --- a/telephony/java/android/telephony/TelephonyManager.java 19 | +++ b/telephony/java/android/telephony/TelephonyManager.java 20 | @@ -8092,7 +8092,7 @@ public class TelephonyManager { 21 | * @hide 22 | */ 23 | @UnsupportedAppUsage 24 | - public static void setTelephonyProperty(int phoneId, String property, String value) { 25 | + public static void setTelephonyProperty(int phoneId, @NonNull String property, @Nullable String value) { 26 | String propVal = ""; 27 | String p[] = null; 28 | String prop = SystemProperties.get(property); 29 | @@ -8146,7 +8146,8 @@ public class TelephonyManager { 30 | * 31 | * @hide 32 | */ 33 | - public static void setTelephonyProperty(String property, String value) { 34 | + @UnsupportedAppUsage 35 | + public static void setTelephonyProperty(@NonNull String property, @Nullable String value) { 36 | if (value == null) { 37 | value = ""; 38 | } 39 | -- 40 | 2.25.1 41 | 42 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0021-Fix-Wakelock-issue.patch: -------------------------------------------------------------------------------- 1 | From 3c0faf6ba0cf4ee36ede539e0ebcf617549afeef Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Tue, 2 Feb 2021 10:20:51 +0000 4 | Subject: [PATCH 21/42] 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 f320d071b54f..9f98937c2a06 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 | @@ -123,7 +123,9 @@ public interface WakeLock { 16 | } else { 17 | mActiveClients.put(why, count - 1); 18 | } 19 | - inner.release(); 20 | + if (inner.isHeld()) { 21 | + inner.release(); 22 | + } 23 | } 24 | 25 | /** @see PowerManager.WakeLock#wrap(Runnable) */ 26 | -- 27 | 2.25.1 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0022-Automatically-detect-pick-up-sensor-so-that-an-overl.patch: -------------------------------------------------------------------------------- 1 | From 214975755dfae5f2b2a265b89214d3e1fd1bdd54 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 22/42] 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.25.1 50 | 51 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0023-Catch-broken-mainBuiltInDisplayCutoutRectApproximati.patch: -------------------------------------------------------------------------------- 1 | From 7193d2f219f5b6feedc689d06b50ae7e43a7c433 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Tue, 23 Mar 2021 19:43:26 +0100 4 | Subject: [PATCH 23/42] Catch broken mainBuiltInDisplayCutoutRectApproximation 5 | 6 | Some devices (Redmi Note 9T) have: 7 | mainBuiltInDisplayCutoutRectApproximation = @android:mainBuiltInDisplayCutout 8 | Since mainBuiltInDisplayCutout is private, its ID is dynamic and can't 9 | be relied upon. 10 | This means that we'll get garbage in mainBuiltInDisplayCutoutRectApproximation 11 | The SVG Path parser will fail, triggering an exception. 12 | 13 | Fix it by catching it, and parsing mainBuiltInDisplayCutout instead 14 | 15 | Change-Id: I03b6e78bac2cc38f3a623c8add801405ad6ba7ba 16 | --- 17 | core/java/android/view/DisplayCutout.java | 18 +++++++++++++----- 18 | 1 file changed, 13 insertions(+), 5 deletions(-) 19 | 20 | diff --git a/core/java/android/view/DisplayCutout.java b/core/java/android/view/DisplayCutout.java 21 | index 83a7b3f01a95..78c74ed51910 100644 22 | --- a/core/java/android/view/DisplayCutout.java 23 | +++ b/core/java/android/view/DisplayCutout.java 24 | @@ -1055,11 +1055,19 @@ public final class DisplayCutout { 25 | public static DisplayCutout fromResourcesRectApproximation(Resources res, 26 | String displayUniqueId, int physicalDisplayWidth, int physicalDisplayHeight, 27 | int displayWidth, int displayHeight) { 28 | - return pathAndDisplayCutoutFromSpec(getDisplayCutoutPath(res, displayUniqueId), 29 | - getDisplayCutoutApproximationRect(res, displayUniqueId), physicalDisplayWidth, 30 | - physicalDisplayHeight, displayWidth, displayHeight, 31 | - DENSITY_DEVICE_STABLE / (float) DENSITY_DEFAULT, 32 | - getWaterfallInsets(res, displayUniqueId)).second; 33 | + try { 34 | + return pathAndDisplayCutoutFromSpec(getDisplayCutoutPath(res, displayUniqueId), 35 | + getDisplayCutoutApproximationRect(res, displayUniqueId), physicalDisplayWidth, 36 | + physicalDisplayHeight, displayWidth, displayHeight, 37 | + DENSITY_DEVICE_STABLE / (float) DENSITY_DEFAULT, 38 | + getWaterfallInsets(res, displayUniqueId)).second; 39 | + } catch(Throwable t) { 40 | + return pathAndDisplayCutoutFromSpec(getDisplayCutoutPath(res, displayUniqueId), 41 | + null, physicalDisplayWidth, 42 | + physicalDisplayHeight, displayWidth, displayHeight, 43 | + DENSITY_DEVICE_STABLE / (float) DENSITY_DEFAULT, 44 | + getWaterfallInsets(res, displayUniqueId)).second; 45 | + } 46 | } 47 | 48 | /** 49 | -- 50 | 2.25.1 51 | 52 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0025-Revert-Switch-long-press-power-behavior-in-AOSP.patch: -------------------------------------------------------------------------------- 1 | From 4be42d7a0e772a3aa13e44744c01ad2c7432f5b8 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 25/42] 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 9891409a08bb..72176d4dbf6a 100644 13 | --- a/core/res/res/values/config.xml 14 | +++ b/core/res/res/values/config.xml 15 | @@ -1085,7 +1085,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 | @@ -1117,7 +1117,7 @@ 25 | 1 - Mute toggle 26 | 2 - Global actions menu 27 | --> 28 | - 2 29 | + 1 30 | 31 | 32 | false 33 | -- 34 | 2.25.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0026-Once-we-integrate-Samsung-Power-hal-in-libpowermanag.patch: -------------------------------------------------------------------------------- 1 | From 61cf5dadd82d5378ddda800a9b3b5ad77e679a7d 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 26/42] 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 1fc974ebc56f..c73b29739cbf 100644 15 | --- a/services/core/jni/Android.bp 16 | +++ b/services/core/jni/Android.bp 17 | @@ -188,6 +188,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.25.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0027-Allow-disabling-of-fingerprint-cleanups-needed-on-so.patch: -------------------------------------------------------------------------------- 1 | From 865d6d98996995628dba6f9abf8a8cb398cf2216 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 27/42] 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 c1a86386dfd4..47f130b95267 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 | @@ -734,6 +734,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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0028-Reduce-the-size-of-udfps-enroll-progress-bar.-Some-d.patch: -------------------------------------------------------------------------------- 1 | From 3b668048f88b9b9659a1056fb6a31ba61c685ea4 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Fri, 17 Dec 2021 17:16:14 -0500 4 | Subject: [PATCH 28/42] Reduce the size of udfps enroll progress bar. Some 5 | devices have their udfps pretty low, and the progress bar would make the icon 6 | at the wrong place 7 | 8 | Change-Id: I1609ad9ca316293dcaaf07f7e681d11aadfcd29c 9 | --- 10 | packages/SystemUI/res/values/config.xml | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml 14 | index f545dae05b56..58db73d49744 100644 15 | --- a/packages/SystemUI/res/values/config.xml 16 | +++ b/packages/SystemUI/res/values/config.xml 17 | @@ -585,7 +585,7 @@ 18 | 19 | 20 | 21 | - 280 22 | + 70 23 | 24 | 25 | 26 | -- 27 | 2.25.1 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0029-Dynamically-resize-boot-animation-to-match-screen-si.patch: -------------------------------------------------------------------------------- 1 | From 8d0a5df772234c6ebcda0af344a01c215b86a337 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 29/42] Dynamically resize boot animation to match screen size 5 | 6 | Change-Id: I54e49fc6b8c670103852e212d1416e27ff976205 7 | --- 8 | cmds/bootanimation/BootAnimation.cpp | 20 ++++++++++++++++++++ 9 | 1 file changed, 20 insertions(+) 10 | 11 | diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp 12 | index 53a84bd1b21e..327d12f6d299 100644 13 | --- a/cmds/bootanimation/BootAnimation.cpp 14 | +++ b/cmds/bootanimation/BootAnimation.cpp 15 | @@ -583,6 +583,26 @@ status_t BootAnimation::readyToRun() { 16 | mFlingerSurface = s; 17 | mTargetInset = -1; 18 | 19 | + SLOGE("Got screen size %d, animation size %d", mWidth, mAnimation->width); 20 | + int origWidth = mAnimation->width; 21 | + if ( mAnimation->width*2 < mWidth ) { 22 | + SLOGE("Making animation bigger"); 23 | + mAnimation->width *= 2; 24 | + mAnimation->height *= 2; 25 | + } else if ( mWidth < mAnimation->width ) { 26 | + SLOGE("Making animation smaller"); 27 | + mAnimation->width /= 2; 28 | + mAnimation->height /= 2; 29 | + } 30 | + for (Animation::Part& part : mAnimation->parts) { 31 | + for(auto& frame: part.frames) { 32 | + if(frame.trimWidth == origWidth && frame.trimX == 0 && frame.trimY == 0) { 33 | + frame.trimWidth = mAnimation->width; 34 | + frame.trimHeight = mAnimation->height; 35 | + } 36 | + } 37 | + } 38 | + 39 | // Rotate the boot animation according to the value specified in the sysprop 40 | // ro.bootanim.set_orientation_. Four values are supported: ORIENTATION_0, 41 | // ORIENTATION_90, ORIENTATION_180 and ORIENTATION_270. 42 | -- 43 | 2.25.1 44 | 45 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0032-Set-old-fingerprint-sensors-to-security-strong.patch: -------------------------------------------------------------------------------- 1 | From 011a49d754b789ead651f9e0db56bd8181c112ab 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 32/42] 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 | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 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 bc550d311370..2fad2bd10832 100644 15 | --- a/services/core/java/com/android/server/biometrics/AuthService.java 16 | +++ b/services/core/java/com/android/server/biometrics/AuthService.java 17 | @@ -666,7 +666,7 @@ public class AuthService extends SystemService { 18 | if (pm.hasSystemFeature(PackageManager.FEATURE_FACE)) { 19 | modalities.add(String.valueOf(BiometricAuthenticator.TYPE_FACE)); 20 | } 21 | - final String strength = String.valueOf(Authenticators.BIOMETRIC_CONVENIENCE); 22 | + final String strength = String.valueOf(Authenticators.BIOMETRIC_STRONG); 23 | final String[] configStrings = new String[modalities.size()]; 24 | for (int i = 0; i < modalities.size(); ++i) { 25 | final String id = String.valueOf(i); 26 | -- 27 | 2.25.1 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0034-Fixup-of-c50777-original-commit-only-cares-about-R-v.patch: -------------------------------------------------------------------------------- 1 | From 177fd4fc057dfddeaec1686abfb58939e19b85bb Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 15 Dec 2022 15:54:50 -0500 4 | Subject: [PATCH 34/42] Fixup of c50777 -- original commit only cares about R 5 | vendors, but not about older ones. Apply that on older ones as well 6 | 7 | --- 8 | .../core/java/com/android/server/biometrics/AuthService.java | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java 12 | index 2fad2bd10832..6fbc3c66c1bc 100644 13 | --- a/services/core/java/com/android/server/biometrics/AuthService.java 14 | +++ b/services/core/java/com/android/server/biometrics/AuthService.java 15 | @@ -631,7 +631,7 @@ public class AuthService extends SystemService { 16 | final int firstApiLevel = SystemProperties.getInt(SYSPROP_FIRST_API_LEVEL, 0); 17 | final int apiLevel = SystemProperties.getInt(SYSPROP_API_LEVEL, firstApiLevel); 18 | String[] configStrings = mInjector.getConfiguration(getContext()); 19 | - if (configStrings.length == 0 && apiLevel == Build.VERSION_CODES.R) { 20 | + if (configStrings.length == 0 && apiLevel <= Build.VERSION_CODES.R) { 21 | // For backwards compatibility with R where biometrics could work without being 22 | // configured in config_biometric_sensors. In the absence of a vendor provided 23 | // configuration, we assume the weakest biometric strength (i.e. convenience). 24 | -- 25 | 2.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0037-SystemUI-Implement-alternate-brightness-path-for-FOD.patch: -------------------------------------------------------------------------------- 1 | From 76ac493824964c94ac2b4d172ebbb0220592a688 Mon Sep 17 00:00:00 2001 2 | From: ItsLynix <71310187+ItsLynix@users.noreply.github.com> 3 | Date: Sat, 28 Jan 2023 10:25:16 +0100 4 | Subject: [PATCH 37/42] SystemUI: Implement alternate brightness path for FOD 5 | 6 | --- 7 | .../com/android/systemui/biometrics/UdfpsView.kt | 15 +++++++++++++-- 8 | 1 file changed, 13 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt 11 | index cdaad81b9222..6cc9ab3da570 100644 12 | --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt 13 | +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt 14 | @@ -228,8 +228,19 @@ Log.d("PHH", "Surface destroyed!") 15 | mySurfaceView.setVisibility(VISIBLE) 16 | Log.d("PHH", "setting surface visible!") 17 | 18 | - val brightness = File("/sys/class/backlight/panel0-backlight/brightness").readText().toDouble() 19 | - val maxBrightness = File("/sys/class/backlight/panel0-backlight/max_brightness").readText().toDouble() 20 | + val brightnessFile = File("/sys/class/backlight/panel/brightness") 21 | + val maxBrightnessFile = File("/sys/class/backlight/panel/max_brightness") 22 | + 23 | + var brightness: Double = 0.0 24 | + var maxBrightness: Double = 0.0 25 | + 26 | + if (brightnessFile.exists() && maxBrightnessFile.exists()) { 27 | + brightness = brightnessFile.readText().toDouble() 28 | + maxBrightness = maxBrightnessFile.readText().toDouble() 29 | + } else { 30 | + brightness = File("/sys/class/backlight/panel0-backlight/brightness").readText().toDouble() 31 | + maxBrightness = File("/sys/class/backlight/panel0-backlight/max_brightness").readText().toDouble() 32 | + } 33 | 34 | // Assume HBM is max brightness 35 | val dim = 1.0 - Math.pow( (brightness / maxBrightness), 1/2.3); 36 | -- 37 | 2.25.1 38 | 39 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0038-bootanimation-Fix-bootanimation-when-using-mask-shin.patch: -------------------------------------------------------------------------------- 1 | From 17fcd67ba118704047fb48be063edbdfa1ccfc11 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 10 May 2023 11:28:27 -0400 4 | Subject: [PATCH 38/42] bootanimation: Fix bootanimation when using mask+shine 5 | rather than animation 6 | 7 | This was broken by the commit that automatically resizes animations 8 | 9 | Fixes: e27e0e177fe88584a280e0f7f624c249623efea1 10 | --- 11 | cmds/bootanimation/BootAnimation.cpp | 38 +++++++++++++++------------- 12 | 1 file changed, 20 insertions(+), 18 deletions(-) 13 | 14 | diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp 15 | index 327d12f6d299..2449b27aae3d 100644 16 | --- a/cmds/bootanimation/BootAnimation.cpp 17 | +++ b/cmds/bootanimation/BootAnimation.cpp 18 | @@ -583,24 +583,26 @@ status_t BootAnimation::readyToRun() { 19 | mFlingerSurface = s; 20 | mTargetInset = -1; 21 | 22 | - SLOGE("Got screen size %d, animation size %d", mWidth, mAnimation->width); 23 | - int origWidth = mAnimation->width; 24 | - if ( mAnimation->width*2 < mWidth ) { 25 | - SLOGE("Making animation bigger"); 26 | - mAnimation->width *= 2; 27 | - mAnimation->height *= 2; 28 | - } else if ( mWidth < mAnimation->width ) { 29 | - SLOGE("Making animation smaller"); 30 | - mAnimation->width /= 2; 31 | - mAnimation->height /= 2; 32 | - } 33 | - for (Animation::Part& part : mAnimation->parts) { 34 | - for(auto& frame: part.frames) { 35 | - if(frame.trimWidth == origWidth && frame.trimX == 0 && frame.trimY == 0) { 36 | - frame.trimWidth = mAnimation->width; 37 | - frame.trimHeight = mAnimation->height; 38 | - } 39 | - } 40 | + if ( mAnimation != nullptr ) { 41 | + SLOGE("Got screen size %d, animation size %d", mWidth, mAnimation->width); 42 | + int origWidth = mAnimation->width; 43 | + if ( mAnimation->width*2 < mWidth ) { 44 | + SLOGE("Making animation bigger"); 45 | + mAnimation->width *= 2; 46 | + mAnimation->height *= 2; 47 | + } else if ( mWidth < mAnimation->width ) { 48 | + SLOGE("Making animation smaller"); 49 | + mAnimation->width /= 2; 50 | + mAnimation->height /= 2; 51 | + } 52 | + for (Animation::Part& part : mAnimation->parts) { 53 | + for(auto& frame: part.frames) { 54 | + if(frame.trimWidth == origWidth && frame.trimX == 0 && frame.trimY == 0) { 55 | + frame.trimWidth = mAnimation->width; 56 | + frame.trimHeight = mAnimation->height; 57 | + } 58 | + } 59 | + } 60 | } 61 | 62 | // Rotate the boot animation according to the value specified in the sysprop 63 | -- 64 | 2.25.1 65 | 66 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_base/0041-Detect-Moto-dynamic-hardware-feature.patch: -------------------------------------------------------------------------------- 1 | From 5b9136a99bdfe96381f1c6a7286232ec82ce2ff6 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 5 Jul 2023 10:50:36 -0400 4 | Subject: [PATCH 41/42] Detect Moto dynamic hardware feature 5 | 6 | Moto added a custom node in sysconfig XMLs: 7 | 8 | This node reads a property and enables a feature based on it. 9 | 10 | Take those into account to enable NFC on Moto devices which have 11 | NFC-less variants 12 | --- 13 | .../java/com/android/server/SystemConfig.java | 19 +++++++++++++++++++ 14 | 1 file changed, 19 insertions(+) 15 | 16 | diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java 17 | index 00b01051adae..ffcc75e63d66 100644 18 | --- a/core/java/com/android/server/SystemConfig.java 19 | +++ b/core/java/com/android/server/SystemConfig.java 20 | @@ -979,6 +979,25 @@ public class SystemConfig { 21 | } 22 | XmlUtils.skipCurrentTag(parser); 23 | } break; 24 | + case "unavailable-feature-conditional": { 25 | + if (allowFeatures) { 26 | + String fname = parser.getAttributeValue(null, "name"); 27 | + String prop = parser.getAttributeValue(null, "prop"); 28 | + if (fname == null || prop == null) { 29 | + Slog.w(TAG, "<" + name + "> without name in " + permFile 30 | + + " at " + parser.getPositionDescription()); 31 | + } else { 32 | + if(android.os.SystemProperties.getBoolean(prop, false)) { 33 | + addFeature(fname, 0); 34 | + } else { 35 | + mUnavailableFeatures.add(fname); 36 | + } 37 | + } 38 | + } else { 39 | + logNotAllowedInPartition(name, permFile, parser); 40 | + } 41 | + XmlUtils.skipCurrentTag(parser); 42 | + } break; 43 | case "allow-in-power-save-except-idle": { 44 | if (allowOverrideAppRestrictions) { 45 | String pkgname = parser.getAttributeValue(null, "package"); 46 | -- 47 | 2.25.1 48 | 49 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_libs_net/0001-Restore-back-the-behavior-of-isValid-It-is-legal-to-.patch: -------------------------------------------------------------------------------- 1 | From d66a62317bf5b3eb67b4c0a904377e5ec8c8088b 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 | 13 ++++++++----- 12 | 1 file changed, 8 insertions(+), 5 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 2bee2ee4..9e8a7836 100644 16 | --- a/common/native/bpf_headers/include/bpf/BpfMap.h 17 | +++ b/common/native/bpf_headers/include/bpf/BpfMap.h 18 | @@ -50,14 +50,17 @@ class BpfMap { 19 | // flag must be within BPF_OBJ_FLAG_MASK, ie. 0, BPF_F_RDONLY, BPF_F_WRONLY 20 | BpfMap(const char* pathname, uint32_t flags) { 21 | mMapFd.reset(mapRetrieve(pathname, flags)); 22 | - if (mMapFd < 0) abort(); 23 | - if (isAtLeastKernelVersion(4, 14, 0)) { 24 | - if (bpfGetFdKeySize(mMapFd) != sizeof(Key)) abort(); 25 | - if (bpfGetFdValueSize(mMapFd) != sizeof(Value)) abort(); 26 | - } 27 | } 28 | 29 | public: 30 | + bool isOk() { 31 | + if (mMapFd < 0) return false; 32 | + if (isAtLeastKernelVersion(4, 14, 0)) { 33 | + if (bpfGetFdKeySize(mMapFd) != sizeof(Key)) return false; 34 | + if (bpfGetFdValueSize(mMapFd) != sizeof(Value)) return false; 35 | + } 36 | + return true; 37 | + } 38 | explicit BpfMap(const char* pathname) : BpfMap(pathname, 0) {} 39 | 40 | BpfMap(bpf_map_type map_type, uint32_t max_entries, uint32_t map_flags = 0) { 41 | -- 42 | 2.25.1 43 | 44 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0001-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch: -------------------------------------------------------------------------------- 1 | From a05e7866b74891933d1c5d244b00029ee0a5fbe3 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 de050e02d0..3daeece62b 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::hardware::Return; 23 | using android::util::ProtoOutputStream; 24 | @@ -77,6 +78,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.25.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0002-Matching-an-input-with-a-display-uses-uniqueId.patch: -------------------------------------------------------------------------------- 1 | From a7cbe8cc5d115838fee3eaa3bb22abb58cd03b75 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 22 Oct 2020 23:22:46 +0200 4 | Subject: [PATCH 02/10] Matching an input with a display uses uniqueId 5 | 6 | Not all devices have a `location`, notably bluetooth devices. 7 | However, we might still want to associate them with a screen, 8 | so match them with uniqueId indeed. 9 | 10 | This is useful to have bluetooth keyboard in desktop mode for instance. 11 | 12 | Change-Id: Ifcbc8329d54386f58e013270d9888316c0f516b6 13 | --- 14 | services/inputflinger/reader/InputDevice.cpp | 5 ++++- 15 | 1 file changed, 4 insertions(+), 1 deletion(-) 16 | 17 | diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp 18 | index 989700f6cf..e45222103b 100644 19 | --- a/services/inputflinger/reader/InputDevice.cpp 20 | +++ b/services/inputflinger/reader/InputDevice.cpp 21 | @@ -309,7 +309,10 @@ void InputDevice::configure(nsecs_t when, const InputReaderConfiguration* config 22 | mAssociatedDisplayUniqueId = std::nullopt; 23 | mAssociatedViewport = std::nullopt; 24 | // Find the display port that corresponds to the current input port. 25 | - const std::string& inputPort = mIdentifier.location; 26 | + std::string inputPort = mIdentifier.location; 27 | + if (inputPort.empty()) { 28 | + inputPort = mIdentifier.uniqueId; 29 | + } 30 | if (!inputPort.empty()) { 31 | const std::unordered_map& ports = config->portAssociations; 32 | const auto& displayPort = ports.find(inputPort); 33 | -- 34 | 2.25.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0003-unshared_oob-didn-t-exist-in-O-P-so-detect-its-suppo.patch: -------------------------------------------------------------------------------- 1 | From 5326cafc09d407c5eef4c6bad2d27468afb8bf18 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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0004-Remove-Samsung-system-permission-on-sensors.patch: -------------------------------------------------------------------------------- 1 | From 189acf03a98cc75f2560faa61e5b202a1fbbae27 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 b865c4d5d6..56dc219f33 100644 13 | --- a/libs/sensor/Sensor.cpp 14 | +++ b/libs/sensor/Sensor.cpp 15 | @@ -433,6 +433,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.25.1 37 | 38 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0005-Mark-accelerometer-input-as-sensor-exclusively-if-th.patch: -------------------------------------------------------------------------------- 1 | From cd3a75cd1efea5defcfb9c349b5328182b34dc4d Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sun, 12 Dec 2021 08:45:36 -0500 4 | Subject: [PATCH 05/10] Mark accelerometer input as sensor exclusively if there 5 | are ABS axis 6 | 7 | The reason this is needed is that on -fucked up- Xiami Mi A2 Lite and 8 | Galaxy J8, the input device reporting power button/vol- reports ACCELEROMETER 9 | input prop. 10 | This leads to wrong timestamping ioctl, leading to crashes and broken UI 11 | 12 | Change-Id: I491ab89724c908ef09a23a6427d24a8889bf806a 13 | --- 14 | services/inputflinger/reader/EventHub.cpp | 8 +++++++- 15 | 1 file changed, 7 insertions(+), 1 deletion(-) 16 | 17 | diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp 18 | index d6a6bd214e..febce0ae6b 100644 19 | --- a/services/inputflinger/reader/EventHub.cpp 20 | +++ b/services/inputflinger/reader/EventHub.cpp 21 | @@ -2124,7 +2124,13 @@ void EventHub::openDeviceLocked(const std::string& devicePath) { 22 | 23 | // Check whether this device is an accelerometer. 24 | if (device->propBitmask.test(INPUT_PROP_ACCELEROMETER)) { 25 | - device->classes |= InputDeviceClass::SENSOR; 26 | + bool hasAxis = false; 27 | + for (int i = 0; i <= ABS_MAX; i++) { 28 | + if (device->absBitmask.test(i)) hasAxis = true; 29 | + } 30 | + if(hasAxis) { 31 | + device->classes |= InputDeviceClass::SENSOR; 32 | + } 33 | } 34 | 35 | // Check whether this device has switches. 36 | -- 37 | 2.25.1 38 | 39 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0007-Fix-loading-power-hidl-v1.0.patch: -------------------------------------------------------------------------------- 1 | From f96b8fab171c56dc6b28673c057010db96f9ce63 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 12 Jan 2022 04:07:34 -0500 4 | Subject: [PATCH 07/10] Fix loading power hidl v1.0 5 | 6 | Change-Id: Ife20a98d2a11c79c7b42f359f30c28e2dede1f25 7 | --- 8 | services/powermanager/PowerHalLoader.cpp | 5 +++-- 9 | 1 file changed, 3 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/services/powermanager/PowerHalLoader.cpp b/services/powermanager/PowerHalLoader.cpp 12 | index 9b20e67f7a..cd7f2312e2 100644 13 | --- a/services/powermanager/PowerHalLoader.cpp 14 | +++ b/services/powermanager/PowerHalLoader.cpp 15 | @@ -93,10 +93,11 @@ sp PowerHalLoader::lo 16 | } 17 | 18 | sp PowerHalLoader::loadHidlV1_0Locked() { 19 | - static bool gHalExists = true; 20 | + static bool gSecHalExists = true; 21 | static auto loadFnSec = []() { return V1_0::IPower::getService("power"); }; 22 | - auto hal = loadHal(gHalExists, gHalHidlV1_0, loadFnSec, "HIDL v1.0"); 23 | + auto hal = loadHal(gSecHalExists, gHalHidlV1_0, loadFnSec, "HIDL v1.0"); 24 | 25 | + static bool gHalExists = true; 26 | static auto loadFn = []() { return V1_0::IPower::getService(); }; 27 | if(hal == nullptr) 28 | hal = loadHal(gHalExists, gHalHidlV1_0, loadFn, "HIDL v1.0"); 29 | -- 30 | 2.25.1 31 | 32 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0008-MIUI13-devices-hide-their-vibrator-HAL-behind-non-de.patch: -------------------------------------------------------------------------------- 1 | From 3f457addf69b543f40bc9ba1567f679d0257321e 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 08/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.25.1 30 | 31 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_native/0010-Fix-light-sensor-crash-on-Xiaomi-13.patch: -------------------------------------------------------------------------------- 1 | From 23a5c722770910262cf3d525c40dcfaa716578cc Mon Sep 17 00:00:00 2001 2 | From: Andy CrossGate Yan 3 | Date: Tue, 18 Apr 2023 23:48:15 +0000 4 | Subject: [PATCH 10/10] Fix light sensor crash on Xiaomi 13 5 | 6 | SensorService expects a scalar, but Xiaomi HAL returns a pose6DOF vector encapsulation 7 | Thanks @phhusson for the analysis 8 | 9 | Change-Id: Ie358321d5328d01541f455d6af86944ff413c9c9 10 | --- 11 | services/sensorservice/AidlSensorHalWrapper.cpp | 9 ++++++++- 12 | 1 file changed, 8 insertions(+), 1 deletion(-) 13 | 14 | diff --git a/services/sensorservice/AidlSensorHalWrapper.cpp b/services/sensorservice/AidlSensorHalWrapper.cpp 15 | index f67c610550..32fd9240b3 100644 16 | --- a/services/sensorservice/AidlSensorHalWrapper.cpp 17 | +++ b/services/sensorservice/AidlSensorHalWrapper.cpp 18 | @@ -171,7 +171,14 @@ void convertToSensorEvent(const Event &src, sensors_event_t *dst) { 19 | case SensorType::MOTION_DETECT: 20 | case SensorType::HEART_BEAT: 21 | case SensorType::LOW_LATENCY_OFFBODY_DETECT: { 22 | - dst->data[0] = src.payload.get(); 23 | + if (src.payload.getTag() == Event::EventPayload::pose6DOF) { 24 | + auto d = src.payload.get(); 25 | + auto dstr = ::android::internal::ToString(d); 26 | + // ALOGE("Received 6DOF for expected scalar %s", dstr.c_str()); 27 | + dst->data[0] = d.values[0]; 28 | + } else { 29 | + dst->data[0] = src.payload.get(); 30 | + } 31 | break; 32 | } 33 | 34 | -- 35 | 2.25.1 36 | 37 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_opt_telephony/0001-SubscriptionController-Do-not-override-default-calli.patch: -------------------------------------------------------------------------------- 1 | From 0778c18d10a6131f0418bc685003a32713b05ad4 Mon Sep 17 00:00:00 2001 2 | From: Peter Cai 3 | Date: Mon, 5 Sep 2022 14:02:37 -0400 4 | Subject: [PATCH 01/10] SubscriptionController: Do not override default calling 5 | account from third-party apps 6 | 7 | When the user has selected a calling account from a third-party app as 8 | default, it should not be overridden by the rest of the telephony 9 | subsystem (e.g. SIM subcription updates, or default SIM slot selection). 10 | 11 | Otherwise, it creates a somewhat annoying situation where the user has 12 | to keep re-selecting the desired calling account after every reboot. 13 | 14 | Test: manual 15 | Change-Id: Iccab64e9b3b3ab4773bd8944d47c2006f229d472 16 | --- 17 | .../telephony/SubscriptionController.java | 19 ++++++++++++++++--- 18 | 1 file changed, 16 insertions(+), 3 deletions(-) 19 | 20 | diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java 21 | index 82799bea8b..a9131f6b7a 100644 22 | --- a/src/java/com/android/internal/telephony/SubscriptionController.java 23 | +++ b/src/java/com/android/internal/telephony/SubscriptionController.java 24 | @@ -2855,9 +2855,22 @@ public class SubscriptionController extends ISub.Stub { 25 | subId); 26 | 27 | TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class); 28 | - 29 | - telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle); 30 | - logd("[setDefaultVoiceSubId] requesting change to phoneAccountHandle=" + newHandle); 31 | + PhoneAccountHandle currentHandle = telecomManager.getUserSelectedOutgoingPhoneAccount(); 32 | + logd("[setDefaultVoiceSubId] current phoneAccountHandle=" + currentHandle); 33 | + 34 | + String currentPackageName = 35 | + currentHandle == null ? null : currentHandle.getComponentName().getPackageName(); 36 | + boolean currentIsSim = "com.android.phone".equals(currentPackageName); 37 | + // Do not override user selected outgoing calling account 38 | + // if the user has selected a third-party app as default 39 | + boolean shouldKeepOutgoingAccount = currentHandle != null && !currentIsSim; 40 | + 41 | + if (!shouldKeepOutgoingAccount) { 42 | + telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle); 43 | + logd("[setDefaultVoiceSubId] change to phoneAccountHandle=" + newHandle); 44 | + } else { 45 | + logd("[setDefaultVoiceSubId] default phoneAccountHandle not changed."); 46 | + } 47 | 48 | if (previousDefaultSub != getDefaultSubId()) { 49 | sendDefaultChangedBroadcast(getDefaultSubId()); 50 | -- 51 | 2.25.1 52 | 53 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_opt_telephony/0002-Telephony-Don-not-call-onUssdRelease-for-Huawei-RIL.patch: -------------------------------------------------------------------------------- 1 | From 1d741d454a6e76ce5e1760906fbfebe5efb32410 Mon Sep 17 00:00:00 2001 2 | From: Artem Borisov 3 | Date: Sat, 10 Nov 2018 17:19:17 +0000 4 | Subject: [PATCH 02/10] Telephony: Don not call onUssdRelease for Huawei RIL 5 | 6 | Huawei RIL doesn't seem to work properly with USSD_MODE_NW_RELEASE, 7 | always releasing USSD when it should be finished instead. 8 | Let's explicitly call onUssdFinished in this case. 9 | 10 | Change-Id: I69faed1c51d4582834879975d6ab13daf7f48ad4 11 | --- 12 | src/java/com/android/internal/telephony/GsmCdmaPhone.java | 6 +++++- 13 | 1 file changed, 5 insertions(+), 1 deletion(-) 14 | 15 | diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java 16 | index 76a8d57246..6094483229 100644 17 | --- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java 18 | +++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java 19 | @@ -2834,7 +2834,11 @@ public class GsmCdmaPhone extends Phone { 20 | if (found != null) { 21 | // Complete pending USSD 22 | if (isUssdRelease) { 23 | - found.onUssdRelease(); 24 | + if (SystemProperties.getBoolean("persist.sys.radio.huawei", false)) { 25 | + found.onUssdFinished(ussdMessage, isUssdRequest); 26 | + } else { 27 | + found.onUssdRelease(); 28 | + } 29 | } else if (isUssdError) { 30 | found.onUssdFinishedError(); 31 | } else { 32 | -- 33 | 2.25.1 34 | 35 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_frameworks_opt_telephony/0003-Fix-baseband-being-too-long-to-fit-into-a-91-chars-p.patch: -------------------------------------------------------------------------------- 1 | From 64c49cebc344186fb2b009ccecf0ce3c6861c27f 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/10] 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 6094483229..2fefcafebd 100644 14 | --- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java 15 | +++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java 16 | @@ -3128,7 +3128,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.25.1 27 | 28 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_hardware_interfaces/0001-Add-a-vendor800-command-to-be-able-to-call-vendor-sp.patch: -------------------------------------------------------------------------------- 1 | From 05d8284db7e7bb2674c1a9a6334a6f427aa4420f 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] Add a vendor800 command, to be able to call vendor-specific 5 | 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 499d3b96e..489578468 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.25.1 31 | 32 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_apps_Settings/0001-Act-as-usb-device-when-there-is-no-hal-but-we-believ.patch: -------------------------------------------------------------------------------- 1 | From be51ea366f521e2dbda84bdcf47c9bf4d868ad7f 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/2] 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 1a1f8ba414..b3981e3865 100644 14 | --- a/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java 15 | +++ b/src/com/android/settings/connecteddevice/usb/UsbConnectionBroadcastReceiver.java 16 | @@ -90,6 +90,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.25.1 32 | 33 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_apps_Settings/0002-Ignore-cancelled-fingerprint-events-they-are-expecte.patch: -------------------------------------------------------------------------------- 1 | From c0f373166cd131234ff677b7ee44b85b2fe3b5ec Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Mon, 2 May 2022 17:44:28 -0400 4 | Subject: [PATCH 2/2] Ignore cancelled fingerprint events, they are expected, 5 | plus add more fingerprint enroll logs 6 | 7 | --- 8 | .../biometrics/fingerprint/FingerprintEnrollEnrolling.java | 5 ++++- 9 | .../biometrics/fingerprint/FingerprintEnrollFindSensor.java | 1 + 10 | 2 files changed, 5 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java 13 | index 368564a01f..8b22fa4269 100644 14 | --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java 15 | +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java 16 | @@ -772,6 +772,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { 17 | 18 | @Override 19 | public void onEnrollmentError(int errMsgId, CharSequence errString) { 20 | + android.util.Log.e("PHH-Enroll", "heyo " + errMsgId + ", " + errString , new Exception()); 21 | + if (errMsgId == 5) return; 22 | + 23 | onCancelEnrollment(errMsgId); 24 | } 25 | 26 | @@ -1122,4 +1125,4 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { 27 | return SettingsEnums.DIALOG_FINGERPRINT_ICON_TOUCH; 28 | } 29 | } 30 | -} 31 | \ No newline at end of file 32 | +} 33 | diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java 34 | index 89bda20cd7..93c3e6186c 100644 35 | --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java 36 | +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java 37 | @@ -326,6 +326,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements 38 | 39 | @Override 40 | public void onEnrollmentError(int errMsgId, CharSequence errString) { 41 | + android.util.Log.e("PHH-Enroll", "heyo " + errMsgId + ", " + errString + ", " + mNextClicked, new Exception()); 42 | if (mNextClicked && errMsgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED) { 43 | proceedToEnrolling(false /* cancelEnrollment */); 44 | } else { 45 | -- 46 | 2.25.1 47 | 48 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_Bluetooth/0004-Add-option-to-change-eSCO-Transport-Unit-Size.patch: -------------------------------------------------------------------------------- 1 | From 24e756f99221c5840616b79119c3d281f6247508 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Thu, 17 Jun 2021 15:48:53 +0100 4 | Subject: [PATCH 4/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 143e230a39..431aaacf17 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 | @@ -215,5 +216,10 @@ enh_esco_params_t esco_parameters_for_codec(esco_codec_t codec) { 32 | CHECK(codec >= 0) << "codec index " << (int)codec << "< 0"; 33 | CHECK(codec < ESCO_NUM_CODECS) << "codec index " << (int)codec << " > " 34 | << 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 | return default_esco_parameters[codec]; 41 | } 42 | -- 43 | 2.25.1 44 | 45 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_Bluetooth/0008-Add-a-property-to-cap-declared-le-vendor-version.-Fo.patch: -------------------------------------------------------------------------------- 1 | From d8293f414784cf6f69dbfdcdb5105b53d7cdee6b 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 8/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 f57ed588d4..e6eca91aa1 100644 13 | --- a/system/gd/hci/controller.cc 14 | +++ b/system/gd/hci/controller.cc 15 | @@ -503,6 +503,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 | @@ -518,6 +525,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 | @@ -532,6 +541,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 | @@ -543,6 +553,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.25.1 56 | 57 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_Connectivity/0001-Allow-failing-to-load-bpf-programs-for-BPF-less-devi.patch: -------------------------------------------------------------------------------- 1 | From f2989dda5e04d9c80afc21840499dde900ee9fb7 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 26 Oct 2022 18:10:04 -0400 4 | Subject: [PATCH 1/3] Allow failing to load bpf programs, for BPF-less devices 5 | 6 | Change-Id: I68ba3be2e15c188e56e32a6ecf844e1ca64d560f 7 | --- 8 | netd/BpfHandler.cpp | 11 +++++++++-- 9 | 1 file changed, 9 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/netd/BpfHandler.cpp b/netd/BpfHandler.cpp 12 | index 6ae26c38f1..8262f75305 100644 13 | --- a/netd/BpfHandler.cpp 14 | +++ b/netd/BpfHandler.cpp 15 | @@ -71,8 +71,15 @@ static Status initPrograms(const char* cg2_path) { 16 | ALOGE("Failed to open the cgroup directory: %s", strerror(ret)); 17 | return statusFromErrno(ret, "Open the cgroup directory failed"); 18 | } 19 | - RETURN_IF_NOT_OK(attachProgramToCgroup(BPF_EGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_EGRESS)); 20 | - RETURN_IF_NOT_OK(attachProgramToCgroup(BPF_INGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_INGRESS)); 21 | + auto ret = attachProgramToCgroup(BPF_EGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_EGRESS); 22 | + if (!isOk(ret)) { 23 | + ALOGE("Failed loading egress program"); 24 | + } 25 | + 26 | + auto ret2 = attachProgramToCgroup(BPF_INGRESS_PROG_PATH, cg_fd, BPF_CGROUP_INET_INGRESS); 27 | + if (!isOk(ret)) { 28 | + ALOGE("Failed loading ingress program"); 29 | + } 30 | 31 | // For the devices that support cgroup socket filter, the socket filter 32 | // should be loaded successfully by bpfloader. So we attach the filter to 33 | -- 34 | 2.25.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_Connectivity/0002-BpfMap-implemented-new-checks-for-kernel-4.14-but-as.patch: -------------------------------------------------------------------------------- 1 | From 8d11cff135065494156414ca6c5921339e2639cb Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 26 Oct 2022 18:10:46 -0400 4 | Subject: [PATCH 2/3] BpfMap() implemented new checks for kernel >=4.14 but as 5 | assert. Since we removed the asset but moved those checks into isOk, use isOk 6 | as well 7 | 8 | Change-Id: Ia7fa7494a2c320aa521e915d4926e8748d472689 9 | --- 10 | service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp | 4 ++-- 11 | 1 file changed, 2 insertions(+), 2 deletions(-) 12 | 13 | diff --git a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp 14 | index 9ebef4d6d2..ee30f3db30 100644 15 | --- a/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp 16 | +++ b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp 17 | @@ -102,13 +102,13 @@ int bpfGetIfaceStatsInternal(const char* iface, Stats* stats, 18 | int bpfGetIfaceStats(const char* iface, Stats* stats) { 19 | BpfMapRO ifaceStatsMap(IFACE_STATS_MAP_PATH); 20 | int ret; 21 | - if (!ifaceStatsMap.isValid()) { 22 | + if (!ifaceStatsMap.isValid() || !ifaceStatsMap.isOk()) { 23 | ret = -errno; 24 | ALOGE("get ifaceStats map fd failed: %s", strerror(errno)); 25 | return ret; 26 | } 27 | BpfMapRO ifaceIndexNameMap(IFACE_INDEX_NAME_MAP_PATH); 28 | - if (!ifaceIndexNameMap.isValid()) { 29 | + if (!ifaceIndexNameMap.isValid() || !ifaceStatsMap.isOk()) { 30 | ret = -errno; 31 | ALOGE("get ifaceIndexName map fd failed: %s", strerror(errno)); 32 | return ret; 33 | -- 34 | 2.25.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_packages_modules_Connectivity/0003-Dont-delete-UID-from-BpfMap-on-BPF-less-kernel.patch: -------------------------------------------------------------------------------- 1 | From a751a5a6235ed5de7b2a6fad4ea76c6b4f9aedb5 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 3/3] 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 4f0f3411a5..d45e8fa58e 100644 13 | --- a/service-t/src/com/android/server/net/NetworkStatsService.java 14 | +++ b/service-t/src/com/android/server/net/NetworkStatsService.java 15 | @@ -2421,6 +2421,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.25.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_bpf/0001-Support-no-bpf-usecase.patch: -------------------------------------------------------------------------------- 1 | From 4279cd4544c82505d6093e87d951681442610e99 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 13 Oct 2021 10:56:52 -0400 4 | Subject: [PATCH 1/2] Support no-bpf usecase 5 | 6 | Change-Id: I75a427a2a41aa4ab1104ad88a891bef0dc2d9c91 7 | --- 8 | bpfloader/BpfLoader.cpp | 4 ++-- 9 | 1 file changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp 12 | index 5cd80b7..bbfa7a8 100644 13 | --- a/bpfloader/BpfLoader.cpp 14 | +++ b/bpfloader/BpfLoader.cpp 15 | @@ -194,8 +194,8 @@ int main(int argc, char** argv) { 16 | ALOGE("If this triggers randomly, you might be hitting some memory allocation " 17 | "problems or startup script race."); 18 | ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---"); 19 | - sleep(20); 20 | - return 2; 21 | + android::base::SetProperty("bpf.progs_loaded", "1"); 22 | + return 0; 23 | } 24 | } 25 | 26 | -- 27 | 2.25.1 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0001-Let-system-override-ro.apex.updatable.patch: -------------------------------------------------------------------------------- 1 | From 108a6882f66d5754bdb1083cb06ed6d57da69a1b Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 23 Feb 2022 17:37:47 -0500 4 | Subject: [PATCH 01/19] Let system override ro.apex.updatable 5 | 6 | APEX are broken because of a kernel bug in Android 10 devices 7 | So we have system set ro.apex.updatable = false 8 | However, vendor can override system, which prevents us from setting this 9 | to false 10 | So, ignore the override policy for this prop 11 | --- 12 | init/property_service.cpp | 8 ++++++-- 13 | 1 file changed, 6 insertions(+), 2 deletions(-) 14 | 15 | diff --git a/init/property_service.cpp b/init/property_service.cpp 16 | index 26341b196..45b04151e 100644 17 | --- a/init/property_service.cpp 18 | +++ b/init/property_service.cpp 19 | @@ -726,8 +726,12 @@ static void LoadProperties(char* data, const char* filter, const char* filename, 20 | } else if (it->second != value) { 21 | LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second 22 | << "' with new value '" << value << "'"; 23 | - it->second = value; 24 | - } 25 | + if(strcmp("ro.apex.updatable", key) == 0) { 26 | + LOG(WARNING) << "... Ignored"; 27 | + } else { 28 | + it->second = value; 29 | + } 30 | + } 31 | } else { 32 | LOG(ERROR) << "Do not have permissions to set '" << key << "' to '" << value 33 | << "' in property file '" << filename << "': " << error; 34 | -- 35 | 2.25.1 36 | 37 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0002-If-Vboot2-fails-fall-back-to-Vboot1.patch: -------------------------------------------------------------------------------- 1 | From eb47cb08272eaa5c6b9e7adf33ba65bd03a41043 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Thu, 12 Sep 2019 13:05:37 +0200 4 | Subject: [PATCH 02/19] If Vboot2 fails, fall-back to Vboot1 5 | 6 | Some devices, for instance Honor View 10, running Pie vendor declares 7 | vbmeta in their device-tree, but doesn't have a vbmeta partition. 8 | 9 | Test: without this fix the device reboots into bootloader 10 | Test: with this fix, the device boots. 11 | 12 | Please note that other fixes are also required to get this device to 13 | actually boot. 14 | 15 | Change-Id: I97a7042fb03f817c41b801d558e438d2c1f6c375 16 | --- 17 | init/first_stage_mount.cpp | 11 +++++++++-- 18 | 1 file changed, 9 insertions(+), 2 deletions(-) 19 | 20 | diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp 21 | index 042988eff..6dfa275e4 100644 22 | --- a/init/first_stage_mount.cpp 23 | +++ b/init/first_stage_mount.cpp 24 | @@ -825,10 +825,17 @@ bool DoFirstStageMount(bool create_devices) { 25 | } 26 | 27 | if (create_devices) { 28 | - if (!(*fsm)->DoCreateDevices()) return false; 29 | + if (!(*fsm)->DoCreateDevices()) LOG(ERROR) << "Failed to create devices"; 30 | } 31 | 32 | - return (*fsm)->DoFirstStageMount(); 33 | + if(!(*fsm)->DoFirstStageMount()) { 34 | + *fsm = nullptr; 35 | + auto fstab = ReadFirstStageFstab(); 36 | + auto v = std::make_unique(std::move(*fstab)); 37 | + v->DoCreateDevices(); 38 | + return v->DoFirstStageMount(); 39 | + } 40 | + return true; 41 | } 42 | 43 | void SetInitAvbVersionInRecovery() { 44 | -- 45 | 2.25.1 46 | 47 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0004-Don-t-abandon-creating-property-tree-if-there-is-a-c.patch: -------------------------------------------------------------------------------- 1 | From bc62915d000851c17ba17fcd28e5250ecf800748 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/19] 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 803657ab8..ecdd0be20 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.25.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0005-init-Do-not-start-console-service-when-debuggable.patch: -------------------------------------------------------------------------------- 1 | From adc4136c29b8b76cbf97f47bfaf2cf311a65d8bc 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/19] 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 2b53d883e..45fde5225 100644 17 | --- a/rootdir/init.rc 18 | +++ b/rootdir/init.rc 19 | @@ -1280,9 +1280,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.25.1 31 | 32 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0006-Panic-into-recovery-rather-than-bootloader.patch: -------------------------------------------------------------------------------- 1 | From b326771700e6e9ca4d901b7d0804feb262eae98d Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 4 Sep 2019 21:11:48 +0200 4 | Subject: [PATCH 06/19] Panic into recovery rather than bootloader 5 | 6 | Getting last_kmsg/pstore from bootloader isn't possible for other people 7 | than the OEM, but we have TWRP to access last_kmsg/pstore 8 | 9 | Change-Id: If04bb6572dc66677d7b44f7d302b2d69ce526200 10 | --- 11 | init/reboot_utils.cpp | 4 ++-- 12 | 1 file changed, 2 insertions(+), 2 deletions(-) 13 | 14 | diff --git a/init/reboot_utils.cpp b/init/reboot_utils.cpp 15 | index 1f411636c..cd25f80f1 100644 16 | --- a/init/reboot_utils.cpp 17 | +++ b/init/reboot_utils.cpp 18 | @@ -36,7 +36,7 @@ 19 | namespace android { 20 | namespace init { 21 | 22 | -static std::string init_fatal_reboot_target = "bootloader"; 23 | +static std::string init_fatal_reboot_target = "recovery"; 24 | static bool init_fatal_panic = false; 25 | 26 | // this needs to read the /proc/* files directly because it is called before 27 | @@ -73,7 +73,7 @@ void SetFatalRebootTarget(const std::optional& reboot_target) { 28 | init_fatal_reboot_target = value; 29 | } 30 | }); 31 | - // We already default to bootloader if no setting is provided. 32 | + // We already default to recovery if no setting is provided. 33 | } else { 34 | const std::string kRebootTargetStringPattern = kRebootTargetString + "="; 35 | start_pos += sizeof(kRebootTargetStringPattern) - 1; 36 | -- 37 | 2.25.1 38 | 39 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0007-Detect-allowed-sdcard-options-based-on-vndk.patch: -------------------------------------------------------------------------------- 1 | From b7b2e19aa39aa9167bb808ff64920e524b644bd6 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/19] 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 622de5b7a..e580190e9 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.25.1 43 | 44 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0008-Revert-Set-system-xbin-permissions-to-750.patch: -------------------------------------------------------------------------------- 1 | From 832b7e3b29e70ace16fbe04fcf5ef2166382683e Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Tue, 1 Feb 2022 13:48:35 +0000 4 | Subject: [PATCH 08/19] 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 a6835fc70..f686b469c 100644 15 | --- a/libcutils/fs_config.cpp 16 | +++ b/libcutils/fs_config.cpp 17 | @@ -86,7 +86,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 | { 00751, AID_ROOT, AID_SHELL, 0, "system_ext/bin" }, 25 | { 00751, AID_ROOT, AID_SHELL, 0, "system_ext/apex/*/bin" }, 26 | -- 27 | 2.25.1 28 | 29 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0009-Ugly-but-secure-Set-dev-uinput-as-0666-to-fix-finger.patch: -------------------------------------------------------------------------------- 1 | From fbd2341fbbe4ebab172f81d0eba157ba109a61f0 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 09/19] 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 4ec59afe9..c9cd629b3 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.25.1 32 | 33 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0011-fs_mgr-Keep-allowing-encryptable-fstab-flag.patch: -------------------------------------------------------------------------------- 1 | From 3b7e1e788801aca33c30eec1701cbc473aa0dc02 Mon Sep 17 00:00:00 2001 2 | From: Alberto Ponces 3 | Date: Mon, 3 Oct 2022 13:50:36 +0100 4 | Subject: [PATCH 11/19] fs_mgr: Keep allowing encryptable fstab flag 5 | 6 | Some users still use "encryptable" flag while being unencrypted. Let them still boot their devices. 7 | 8 | Change-Id: Id2554d6563a869bb5bcf39c67b0322484bdab0c9 9 | --- 10 | fs_mgr/fs_mgr_fstab.cpp | 11 ----------- 11 | 1 file changed, 11 deletions(-) 12 | 13 | diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp 14 | index 9c77299a6..9d365ff0d 100644 15 | --- a/fs_mgr/fs_mgr_fstab.cpp 16 | +++ b/fs_mgr/fs_mgr_fstab.cpp 17 | @@ -311,17 +311,6 @@ bool ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { 18 | } 19 | } 20 | 21 | - // FDE is no longer supported, so reject "encryptable" when used without 22 | - // "vold_managed". For now skip this check when in recovery mode, since 23 | - // some recovery fstabs still contain the FDE options since they didn't do 24 | - // anything in recovery mode anyway (except possibly to cause the 25 | - // reservation of a crypto footer) and thus never got removed. 26 | - if (entry->fs_mgr_flags.crypt && !entry->fs_mgr_flags.vold_managed && 27 | - access("/system/bin/recovery", F_OK) != 0) { 28 | - LERROR << "FDE is no longer supported; 'encryptable' can only be used for adoptable " 29 | - "storage"; 30 | - return false; 31 | - } 32 | return true; 33 | } 34 | 35 | -- 36 | 2.25.1 37 | 38 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0012-Fix-support-for-devices-without-cgroupv2-support.patch: -------------------------------------------------------------------------------- 1 | From 7c29c57202eac7e83959e9387e860066df4c8946 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Wed, 26 Oct 2022 17:59:11 -0400 4 | Subject: [PATCH 12/19] Fix support for devices without cgroupv2 support 5 | 6 | This is technically a revert of 1bd1746447. 7 | The warning inside the commit doesn't really apply to us, because the 8 | devices without cgroupv2 simply won't freeze processes at all 9 | (which is in itself an issue, but a different one) 10 | --- 11 | init/service.cpp | 4 ++++ 12 | 1 file changed, 4 insertions(+) 13 | 14 | diff --git a/init/service.cpp b/init/service.cpp 15 | index bd704cf8e..188b042d9 100644 16 | --- a/init/service.cpp 17 | +++ b/init/service.cpp 18 | @@ -662,11 +662,15 @@ Result Service::Start() { 19 | limit_percent_ != -1 || !limit_property_.empty(); 20 | errno = -createProcessGroup(proc_attr_.uid, pid_, use_memcg); 21 | if (errno != 0) { 22 | + PLOG(ERROR) << "createProcessGroup(" << proc_attr_.uid << ", " << pid_ << ") failed for service '" << name_ << "'"; 23 | + 24 | +#if 0 25 | if (char byte = 0; write((*pipefd)[1], &byte, 1) < 0) { 26 | return ErrnoError() << "sending notification failed"; 27 | } 28 | return Error() << "createProcessGroup(" << proc_attr_.uid << ", " << pid_ 29 | << ") failed for service '" << name_ << "'"; 30 | +#endif 31 | } 32 | 33 | if (use_memcg) { 34 | -- 35 | 2.25.1 36 | 37 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0013-FDE-is-dead.-Fallback-FDE-to-no-encryption-and-FDE-F.patch: -------------------------------------------------------------------------------- 1 | From f8e384ac084380342a3cb1b061774e90d73121f5 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 13/19] 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 9d365ff0d..2ecd35faf 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.25.1 38 | 39 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0014-Let-system-override-adb-secure-props-so-we-dont-get-.patch: -------------------------------------------------------------------------------- 1 | From 0b3dc237557556fd13a78174ba1ae03b9cbed184 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 14/19] 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 45b04151e..080ee9c71 100644 13 | --- a/init/property_service.cpp 14 | +++ b/init/property_service.cpp 15 | @@ -726,7 +726,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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0015-Allow-apex-on-5.0-kernels.-This-is-needed-because-on.patch: -------------------------------------------------------------------------------- 1 | From 55719bb2b7028df918c284c6f9976bbf7b29cc3a 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 15/19] Allow apex on > 5.0 kernels. This is needed because on 5 | Pixels, camera HAL are exclusively in vendor apex 6 | 7 | --- 8 | init/property_service.cpp | 15 ++++++++++++++- 9 | 1 file changed, 14 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/init/property_service.cpp b/init/property_service.cpp 12 | index 080ee9c71..3dc81169e 100644 13 | --- a/init/property_service.cpp 14 | +++ b/init/property_service.cpp 15 | @@ -61,6 +61,7 @@ 16 | #include 17 | #include 18 | #include 19 | +#include 20 | 21 | #include "debug_ramdisk.h" 22 | #include "epoll.h" 23 | @@ -632,6 +633,16 @@ uint32_t InitPropertySet(const std::string& name, const std::string& value) { 24 | static bool load_properties_from_file(const char*, const char*, 25 | std::map*); 26 | 27 | +static bool kernel_supports_capex() { 28 | + //Put a threshold at >= 5.0 29 | + struct utsname buf; 30 | + uname(&buf); 31 | + const char *where = buf.release; 32 | + int a = atoi(where); 33 | + if(a <= 4) return false; 34 | + return true; 35 | +} 36 | + 37 | /* 38 | * Filter is used to decide which properties to load: NULL loads all keys, 39 | * "ro.foo.*" is a prefix match, and "ro.foo.bar" is an exact match. 40 | @@ -726,7 +737,9 @@ static void LoadProperties(char* data, const char* filter, const char* filename, 41 | } else if (it->second != value) { 42 | LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second 43 | << "' with new value '" << value << "'"; 44 | - if(strcmp("ro.apex.updatable", key) == 0 || strstr(key, "adb") || strstr(key, "secure")) { 45 | + if(strcmp("ro.apex.updatable", key) == 0 && !kernel_supports_capex()) { 46 | + LOG(WARNING) << "... Ignored apex by kernel version"; 47 | + } else if(strstr(key, "adb") || strstr(key, "secure")) { 48 | LOG(WARNING) << "... Ignored"; 49 | } else { 50 | it->second = value; 51 | -- 52 | 2.25.1 53 | 54 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0016-watchdogd-Support-pinging-two-watchdogs.patch: -------------------------------------------------------------------------------- 1 | From 7548ea22afb20933a3a6fc2c2ed8719269288177 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 27 May 2023 05:36:21 -0400 4 | Subject: [PATCH 16/19] watchdogd: Support pinging two watchdogs 5 | 6 | --- 7 | watchdogd/watchdogd.cpp | 33 +++++++++++++++++++++++++++++++++ 8 | 1 file changed, 33 insertions(+) 9 | 10 | diff --git a/watchdogd/watchdogd.cpp b/watchdogd/watchdogd.cpp 11 | index 5dc41e6b8..69abb4e2b 100644 12 | --- a/watchdogd/watchdogd.cpp 13 | +++ b/watchdogd/watchdogd.cpp 14 | @@ -20,12 +20,15 @@ 15 | #include 16 | #include 17 | #include 18 | +#include 19 | 20 | #include 21 | 22 | #define DEV_NAME "/dev/watchdog" 23 | +#define DEV_NAME2 "/dev/watchdog1" 24 | 25 | int main(int argc, char** argv) { 26 | + struct stat st_buf; 27 | android::base::InitLogging(argv, &android::base::KernelLogger); 28 | 29 | int interval = 10; 30 | @@ -42,6 +45,13 @@ int main(int argc, char** argv) { 31 | return 1; 32 | } 33 | 34 | + int fd2 = open(DEV_NAME2, O_RDWR | O_CLOEXEC); 35 | + fstat(fd2, &st_buf); 36 | + if ((st_buf.st_mode & S_IFMT) != S_IFCHR) { 37 | + close(fd2); 38 | + fd2 = -1; 39 | + } 40 | + 41 | int timeout = interval + margin; 42 | int ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout); 43 | if (ret) { 44 | @@ -61,8 +71,31 @@ int main(int argc, char** argv) { 45 | } 46 | } 47 | 48 | + if(fd2 >= 0) { 49 | + int interval2 = interval; 50 | + ret = ioctl(fd2, WDIOC_SETTIMEOUT, &timeout); 51 | + if (ret) { 52 | + PLOG(ERROR) << "Failed to set2 timeout to " << timeout; 53 | + ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout); 54 | + if (ret) { 55 | + PLOG(ERROR) << "Failed to get timeout"; 56 | + } else { 57 | + if (timeout > margin) { 58 | + interval2 = timeout - margin; 59 | + } else { 60 | + interval2 = 1; 61 | + } 62 | + LOG(WARNING) << "Adjusted interval to timeout returned by driver: " 63 | + << "timeout " << timeout << ", interval " << interval2 << ", margin " 64 | + << margin; 65 | + } 66 | + } 67 | + if(interval2 < interval) interval = interval2; 68 | + } 69 | + 70 | while (true) { 71 | write(fd, "", 1); 72 | + if (fd2 >= 0) write(fd2, "", 1); 73 | sleep(interval); 74 | } 75 | } 76 | -- 77 | 2.25.1 78 | 79 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0018-Disable-quotas-on-legacy-devices-with-encryption-dis.patch: -------------------------------------------------------------------------------- 1 | From 7b946f8507bd01cfd26c1b4ec4e05594498c1060 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 18/19] 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 1acaea3cf..c2ccd5cd5 100644 14 | --- a/fs_mgr/fs_mgr.cpp 15 | +++ b/fs_mgr/fs_mgr.cpp 16 | @@ -370,6 +370,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.25.1 32 | 33 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_core/0019-Add-vendor-firmware_mnt.-Moto-Razr-2019-look-for-fir.patch: -------------------------------------------------------------------------------- 1 | From 35f54b9921623ce08f7a7f5a209895e38b7ddb01 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 19/19] 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 c9cd629b3..31f7f38cc 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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_extras/0001-libfscrypt-Bail-out-if-we-can-t-open-directory.patch: -------------------------------------------------------------------------------- 1 | From 5c7329d431a7dfded8190f11c7834c04fb63a6d3 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 f6e97f11..bbf40c3c 100644 22 | --- a/libfscrypt/fscrypt.cpp 23 | +++ b/libfscrypt/fscrypt.cpp 24 | @@ -326,7 +326,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.25.1 35 | 36 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_linkerconfig/0001-Disable-vndklite-handling.patch: -------------------------------------------------------------------------------- 1 | From f625d4eceeaa67eafe24d87ad95edf30973f2438 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 82801f3..e05341b 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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_netd/0001-Huawei-Kirin-960-accept-broken-rpfilter-match.patch: -------------------------------------------------------------------------------- 1 | From 0d5e5a812dfeccb9bcd3ddf569a5824a1084dadc 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 79193574..d867cea4 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.25.1 29 | 30 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_netd/0002-Don-t-fail-on-FTP-conntracking-failing.patch: -------------------------------------------------------------------------------- 1 | From 093171d38bcbabc6d74fd5d77a5aaad3218989c2 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 d867cea4..00c979d8 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.25.1 45 | 46 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_netd/0003-Support-no-bpf-usecase.patch: -------------------------------------------------------------------------------- 1 | From 4836e4b1b99d2b154247734026b89fb46d399400 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 00ee186d..faa6f135 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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_netd/0004-Don-t-abort-in-case-of-cgroup-bpf-setup-fail-since-s.patch: -------------------------------------------------------------------------------- 1 | From 688b44dceef7bd48bba6ff8121afa5c0785b22ee 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 0e81d4e5..18287d37 100644 13 | --- a/server/main.cpp 14 | +++ b/server/main.cpp 15 | @@ -134,7 +134,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.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_nfc/0001-Let-vendor-have-priority-over-NFC-config-file-rather.patch: -------------------------------------------------------------------------------- 1 | From d2ad250c9f3d72a241a84cc92f128ecea1bb616b 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 264968e4..92606979 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.25.1 29 | 30 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_vold/0001-Allow-deletion-of-symlink.patch: -------------------------------------------------------------------------------- 1 | From 84610b416d4e07b77bf04795a9be1d174b5b035c 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 6c081778..df5774e7 100644 13 | --- a/FsCrypt.cpp 14 | +++ b/FsCrypt.cpp 15 | @@ -319,6 +319,7 @@ static bool prepare_dir(const std::string& dir, mode_t mode, uid_t uid, gid_t gi 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.25.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_vold/0002-Failing-to-create-facedata-shouldn-t-be-fatal.patch: -------------------------------------------------------------------------------- 1 | From 3604d3bff63ed734ee7e8e4fcafb86df9330fb59 Mon Sep 17 00:00:00 2001 2 | From: Pierre-Hugues Husson 3 | Date: Sat, 7 Mar 2020 14:49:09 +0100 4 | Subject: [PATCH 2/5] Failing to create facedata shouldn't be fatal 5 | 6 | Some Pie vendors create it on their own, so SELinux would deny that 7 | Also not all devices have face unlock anyway 8 | 9 | See https://github.com/phhusson/treble_experimentations/issues/1119 10 | --- 11 | vold_prepare_subdirs.cpp | 4 ++-- 12 | 1 file changed, 2 insertions(+), 2 deletions(-) 13 | 14 | diff --git a/vold_prepare_subdirs.cpp b/vold_prepare_subdirs.cpp 15 | index 94d7f151..671ae6fb 100644 16 | --- a/vold_prepare_subdirs.cpp 17 | +++ b/vold_prepare_subdirs.cpp 18 | @@ -198,7 +198,7 @@ static bool prepare_subdirs(const std::string& volume_uuid, int user_id, int fla 19 | } 20 | auto facedata_path = vendor_de_path + "/facedata"; 21 | if (!prepare_dir(sehandle, 0700, AID_SYSTEM, AID_SYSTEM, facedata_path)) { 22 | - return false; 23 | + LOG(ERROR) << "Failed preparing folder for de facedata"; 24 | } 25 | } 26 | } 27 | @@ -247,7 +247,7 @@ static bool prepare_subdirs(const std::string& volume_uuid, int user_id, int fla 28 | auto vendor_ce_path = android::vold::BuildDataVendorCePath(user_id); 29 | auto facedata_path = vendor_ce_path + "/facedata"; 30 | if (!prepare_dir(sehandle, 0700, AID_SYSTEM, AID_SYSTEM, facedata_path)) { 31 | - return false; 32 | + LOG(ERROR) << "Failed preparing folder for de facedata"; 33 | } 34 | } 35 | } 36 | -- 37 | 2.25.1 38 | 39 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_vold/0003-Don-t-unmount-rw-system.sh-binds.patch: -------------------------------------------------------------------------------- 1 | From b61e6352757012f31f0e08338357eb39161f362e 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 a7d39c11..0d7bbb6f 100644 13 | --- a/VolumeManager.cpp 14 | +++ b/VolumeManager.cpp 15 | @@ -969,6 +969,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.25.1 25 | 26 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_vold/0004-Exfat-can-be-mounted-with-exfat-kernel-fs-driver-or-.patch: -------------------------------------------------------------------------------- 1 | From a72057111813770eb1d43c5b5f2e1f620775ea5d 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.25.1 47 | 48 | -------------------------------------------------------------------------------- /patches/trebledroid/platform_system_vold/0005-Every-voldmanaged-storage-is-adoptable.patch: -------------------------------------------------------------------------------- 1 | From 41dcbda79d983feeee8182f96b650104b836aa19 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 b07ee68c..0c0ca085 100644 12 | --- a/main.cpp 13 | +++ b/main.cpp 14 | @@ -267,7 +267,7 @@ static int process_config(VolumeManager* vm, VoldConfigs* configs) { 15 | int partnum = entry.partnum; 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.25.1 25 | 26 | -------------------------------------------------------------------------------- /pe.mk: -------------------------------------------------------------------------------- 1 | $(call inherit-product, vendor/aosp/config/common_full_phone.mk) 2 | $(call inherit-product, vendor/aosp/config/BoardConfigSoong.mk) 3 | $(call inherit-product, device/custom/sepolicy/common/sepolicy.mk) 4 | -include vendor/aosp/build/core/config.mk 5 | 6 | BOARD_EXT4_SHARE_DUP_BLOCKS := true 7 | 8 | TARGET_BOOT_ANIMATION_RES := 1080 9 | 10 | TARGET_SUPPORTS_QUICK_TAP := true 11 | TARGET_SUPPORTS_CALL_RECORDING := true 12 | 13 | PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ 14 | ro.system.ota.json_url=https://raw.githubusercontent.com/ponces/treble_build_pe/thirteen/ota.json 15 | --------------------------------------------------------------------------------