fastboot: allow device to start required healthd and boot-hal services
Change-Id: Iac1d20ce26d49e7a99071c968d8c8e654e5ff1c6
diff --git a/Android.mk b/Android.mk
index c7998ac..80af9ba 100755
--- a/Android.mk
+++ b/Android.mk
@@ -156,6 +156,7 @@
ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
LOCAL_CFLAGS += -DPRODUCT_USE_DYNAMIC_PARTITIONS=1
TWRP_REQUIRED_MODULES += android.hardware.health@2.1-service android.hardware.health@2.1-impl.recovery android.hardware.health@2.1-service.rc android.hardware.health@2.1.xml
+ TWRP_REQUIRED_MODULES += android.hardware.health@2.0-service android.hardware.health@2.0-impl.recovery android.hardware.health@2.0-service.rc
endif
ifeq ($(TW_USES_VENDOR_LIBS),true)
diff --git a/etc/Android.mk b/etc/Android.mk
index 6cda67b..8cef51b 100755
--- a/etc/Android.mk
+++ b/etc/Android.mk
@@ -109,6 +109,14 @@
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/vendor/etc/vintf/manifest
LOCAL_SRC_FILES := init/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)
+
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := android.hardware.health@2.0-service.rc
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_MODULE_CLASS := EXECUTABLES
+ LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/etc/init
+ LOCAL_SRC_FILES := init/$(LOCAL_MODULE)
+ include $(BUILD_PREBUILT)
endif
ifneq ($(TW_INCLUDE_CRYPTO),)
diff --git a/etc/init/android.hardware.boot@1.0-service.rc b/etc/init/android.hardware.boot@1.0-service.rc
index bc23757..395a14d 100644
--- a/etc/init/android.hardware.boot@1.0-service.rc
+++ b/etc/init/android.hardware.boot@1.0-service.rc
@@ -1,6 +1,3 @@
-on post-fs
- #start boot-hal-1-0
-
service boot-hal-1-0 /system/bin/android.hardware.boot@1.0-service
user root
group root
diff --git a/etc/init/android.hardware.boot@1.1-service.rc b/etc/init/android.hardware.boot@1.1-service.rc
index af3b505..c929d14 100644
--- a/etc/init/android.hardware.boot@1.1-service.rc
+++ b/etc/init/android.hardware.boot@1.1-service.rc
@@ -1,6 +1,3 @@
-on post-fs
- start boot-hal-1-1
-
service boot-hal-1-1 /system/bin/android.hardware.boot@1.1-service
user root
group root
diff --git a/etc/init/android.hardware.health@2.0-service.rc b/etc/init/android.hardware.health@2.0-service.rc
new file mode 100644
index 0000000..ef17467
--- /dev/null
+++ b/etc/init/android.hardware.health@2.0-service.rc
@@ -0,0 +1,10 @@
+on boot
+ start health-hal-2-0
+
+service health-hal-2-0 /system/bin/android.hardware.health@2.0-service
+ disabled
+ user root
+ group root
+ capabilities WAKE_ALARM
+ file /dev/kmsg w
+ seclabel u:r:recovery:s0
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 9326e0a..114e9d7 100755
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -80,6 +80,7 @@
RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_VENDOR_EXECUTABLES)/hw/android.hardware.boot@1.1-service
RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_VENDOR_EXECUTABLES)/vndservicemanager
RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/toybox
+RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_VENDOR_EXECUTABLES)/hw/android.hardware.health@2.0-service
RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_VENDOR_EXECUTABLES)/hw/android.hardware.health@2.1-service
RECOVERY_BINARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/charger
RECOVERY_BINARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/ueventd
diff --git a/sepolicy/twrp.te b/sepolicy/twrp.te
index d868cd4..3892ed6 100755
--- a/sepolicy/twrp.te
+++ b/sepolicy/twrp.te
@@ -3,6 +3,7 @@
permissive init;
permissive logd;
permissive adbd;
+ permissive fastbootd;
allow kernel tmpfs:file { read };
allow kernel recovery:fd { use };
')