lineage_patches_unified/patches_treble/device_phh_treble/0007-treble-Securize-on-demand.patch
2023-06-22 07:49:58 +08:00

50 lines
1.4 KiB
Diff

From e3df20ed1f82e8cefe0914bdf7a6cb0b34736c25 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Thu, 29 Dec 2022 15:12:03 +0000
Subject: [PATCH 7/9] treble: Securize on-demand
Status is stored in /metadata and controlled by persist prop
Change-Id: I8069b6f471ad87ab34c18b743689ab3584cee35b
---
phh-prop-handler.sh | 14 ++++++++++++++
vndk.rc | 3 +++
2 files changed, 17 insertions(+)
diff --git a/phh-prop-handler.sh b/phh-prop-handler.sh
index 32a1f19..a6ddab8 100644
--- a/phh-prop-handler.sh
+++ b/phh-prop-handler.sh
@@ -218,3 +218,17 @@ if [ "$1" == "persist.bluetooth.system_audio_hal.enabled" ]; then
restartAudio
exit
fi
+
+if [ "$1" == "persist.sys.phh.securize" ];then
+ if [[ "$prop_value" != "true" && "$prop_value" != "false" ]]; then
+ exit 1
+ fi
+
+ if [[ "$prop_value" == "true" ]]; then
+ mkdir /metadata/phh
+ touch /metadata/phh/secure
+ else
+ rm /metadata/phh/secure
+ fi
+ exit
+fi
diff --git a/vndk.rc b/vndk.rc
index 478bc37..674977d 100644
--- a/vndk.rc
+++ b/vndk.rc
@@ -81,3 +81,6 @@ service watchdogd-gsi /system/bin/watchdogd 10 20
class core
oneshot
seclabel u:r:watchdogd:s0
+
+on property:persist.sys.phh.securize=*
+ exec u:r:phhsu_daemon:s0 root -- /system/bin/phh-prop-handler.sh "persist.sys.phh.securize"
--
2.34.1