zenfone6: Start using vendor_overlay
* This lets us override files in /vendor without
relying on bind mounts ^.^
* Remove too NEED_KERNEL_MODULE_SYSTEM
Change-Id: I94c244b0329d6f6cfe7efdc77e0a3ccc22ab8843
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 05d19a4..c7fe693 100755
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -88,6 +88,9 @@
# DRM
TARGET_ENABLE_MEDIADRM_64 := true
+# Filesystem
+TARGET_FS_CONFIG_GEN := $(DEVICE_PATH)/config.fs
+
# FM
BOARD_HAS_QCA_FM_SOC := "cherokee"
BOARD_HAVE_QCOM_FM := true
@@ -117,9 +120,6 @@
BOARD_KERNEL_SEPARATED_DTBO := true
TARGET_KERNEL_CLANG_COMPILE := true
-# Modules
-NEED_KERNEL_MODULE_SYSTEM := true
-
# NFC
TARGET_USES_NQ_NFC := true
diff --git a/config.fs b/config.fs
new file mode 100644
index 0000000..457a8e8
--- /dev/null
+++ b/config.fs
@@ -0,0 +1,5 @@
+[system/product/vendor_overlay/*/bin/*]
+mode: 0755
+user: AID_ROOT
+group: AID_SHELL
+caps: 0
\ No newline at end of file
diff --git a/device.mk b/device.mk
index 317f9a1..ccc0238 100755
--- a/device.mk
+++ b/device.mk
@@ -53,8 +53,9 @@
# audio
PRODUCT_COPY_FILES += \
- $(LOCAL_PATH)/audio/audio_policy_configuration.xml:system/etc/audio_policy_configuration.xml \
- $(LOCAL_PATH)/audio/audio_policy_volumes_ZS630KL.xml:system/etc/audio_policy_volumes_ZS630KL.xml
+ $(LOCAL_PATH)/audio/audio_policy_configuration.xml:$(TARGET_COPY_OUT_PRODUCT)/vendor_overlay/$(PRODUCT_TARGET_VNDK_VERSION)/etc/audio/audio_policy_configuration.xml \
+ $(LOCAL_PATH)/audio/audio_policy_configuration.xml:$(TARGET_COPY_OUT_PRODUCT)/vendor_overlay/$(PRODUCT_TARGET_VNDK_VERSION)/etc/audio_policy_configuration.xml \
+ $(LOCAL_PATH)/audio/audio_policy_volumes_ZS630KL.xml:$(TARGET_COPY_OUT_PRODUCT)/vendor_overlay/$(PRODUCT_TARGET_VNDK_VERSION)/etc/audio_policy_volumes_ZS630KL.xml
# Boot control
PRODUCT_PACKAGES += \
@@ -180,6 +181,9 @@
PRODUCT_PACKAGES_DEBUG += \
update_engine_client
+# VNDK
+PRODUCT_TARGET_VNDK_VERSION := 29
+
# WiFi Display
PRODUCT_PACKAGES += \
libnl
diff --git a/lights/Android.bp b/lights/Android.bp
deleted file mode 100644
index 30e9a1e..0000000
--- a/lights/Android.bp
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2018 The LineageOS Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-cc_binary {
- relative_install_path: "hw",
- defaults: ["hidl_defaults"],
- name: "android.hardware.light@2.0-service.asus_msmnile",
- init_rc: ["android.hardware.light@2.0-service.asus_msmnile.rc"],
- srcs: ["service.cpp", "Light.cpp"],
- shared_libs: [
- "android.hardware.light@2.0",
- "libbase",
- "libhardware",
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "liblog",
- "libutils",
- ],
-}
diff --git a/lights/Android.mk b/lights/Android.mk
new file mode 100644
index 0000000..98616ca
--- /dev/null
+++ b/lights/Android.mk
@@ -0,0 +1,42 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := android.hardware.light@2.0-service.asus_msmnile
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/vendor_overlay/$(PRODUCT_TARGET_VNDK_VERSION)/bin
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE_STEM := android.hardware.light@2.0-service
+
+LOCAL_SRC_FILES := \
+ service.cpp \
+ Light.cpp
+
+LOCAL_REQUIRED_MODULES := \
+ android.hardware.light@2.0-service.asus_msmnile.rc
+
+LOCAL_SHARED_LIBRARIES := \
+ libbase \
+ libhardware \
+ libhidlbase \
+ libhidltransport \
+ liblog \
+ libhwbinder \
+ libutils \
+ android.hardware.light@2.0
+
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := android.hardware.light@2.0-service.asus_msmnile.rc
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/vendor_overlay/$(PRODUCT_TARGET_VNDK_VERSION)/etc/init
+LOCAL_MODULE_STEM := android.hardware.light@2.0-service.rc
+
+LOCAL_SRC_FILES := android.hardware.light@2.0-service.asus_msmnile.rc
+
+include $(BUILD_PREBUILT)
\ No newline at end of file
diff --git a/lights/android.hardware.light@2.0-service.asus_msmnile.rc b/lights/android.hardware.light@2.0-service.asus_msmnile.rc
index 22e6708..b54ca95 100644
--- a/lights/android.hardware.light@2.0-service.asus_msmnile.rc
+++ b/lights/android.hardware.light@2.0-service.asus_msmnile.rc
@@ -1,4 +1,4 @@
-service vendor.light-hal-2-0 /system/bin/hw/android.hardware.light@2.0-service.asus_msmnile
+service vendor.light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service
interface android.hardware.light@2.0::ILight default
class hal
user system
diff --git a/prebuilt/system/etc/init/init.qcom.rc b/prebuilt/system/etc/init/init.qcom.rc
index 7651d67..d2843ce 100644
--- a/prebuilt/system/etc/init/init.qcom.rc
+++ b/prebuilt/system/etc/init/init.qcom.rc
@@ -1,8 +1,5 @@
on post-fs
mount none /dev/null /vendor/overlay/FrameworksResCommon.apk bind
- mount none /system/etc/audio_policy_configuration.xml /vendor/etc/audio/audio_policy_configuration.xml bind
- mount none /system/etc/audio_policy_configuration.xml /vendor/etc/audio_policy_configuration.xml bind
- mount none /system/etc/audio_policy_volumes_ZS630KL.xml /vendor/etc/audio_policy_volumes_ZS630KL.xml bind
on boot
# Smart Key
diff --git a/sepolicy/private/file.te b/sepolicy/private/file.te
index df8c2d3..ce2daf2 100644
--- a/sepolicy/private/file.te
+++ b/sepolicy/private/file.te
@@ -10,6 +10,4 @@
# Offscreen Gestures
type sysfs_gesture, sysfs_type, fs_type;
-type sysfs_touchscreen, sysfs_type, fs_type;
-
-type system_configs_file, system_file_type, file_type;
\ No newline at end of file
+type sysfs_touchscreen, sysfs_type, fs_type;
\ No newline at end of file
diff --git a/sepolicy/private/file_contexts b/sepolicy/private/file_contexts
index b52c919..54f9451 100644
--- a/sepolicy/private/file_contexts
+++ b/sepolicy/private/file_contexts
@@ -6,9 +6,6 @@
/voucher(/.*)? u:object_r:voucher_file:s0
/xrom(/.*)? u:object_r:xrom_file:s0
-# Audio
-/system/etc/audio_policy_configuration.xml u:object_r:system_configs_file:s0
-
# Gestures
/proc/driver/glove u:object_r:sysfs_gesture:s0
/proc/driver/gesture_type u:object_r:sysfs_gesture:s0
@@ -16,7 +13,8 @@
/sys/devices/platform/soc/soc:asustek_googlekey/googlekey_enable u:object_r:sysfs_gesture:s0
# HALs
-/system/bin/hw/android\.hardware\.light@2\.0-service\.asus_msmnile u:object_r:hal_light_msmnile_exec:s0
+/(product|system/product)/vendor_overlay/[0-9]+/bin/hw/android\.hardware\.light@2\.0-service u:object_r:hal_light_default_exec:s0
-# Modules
-/system/lib/modules/wlan\.ko u:object_r:system_file:s0
+# Vendor overlay
+/(product|system/product)/vendor_overlay/[0-9]+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/(product|system/product)/vendor_overlay/[0-9]+/lib(64)?/hw u:object_r:vendor_hal_file:s0
diff --git a/sepolicy/private/hal_light.te b/sepolicy/private/hal_light.te
new file mode 100644
index 0000000..67b5b9e
--- /dev/null
+++ b/sepolicy/private/hal_light.te
@@ -0,0 +1 @@
+allow hal_light sysfs_rg_led:file getattr;
\ No newline at end of file
diff --git a/sepolicy/private/hal_light_msmnile.te b/sepolicy/private/hal_light_msmnile.te
deleted file mode 100644
index 140f1e2..0000000
--- a/sepolicy/private/hal_light_msmnile.te
+++ /dev/null
@@ -1,20 +0,0 @@
-type hal_light_msmnile, coredomain, domain;
-
-# Allow a base set of permissions required for a domain to offer a
-# HAL implementation of the specified type over HwBinder.
-typeattribute hal_light_msmnile halclientdomain;
-typeattribute hal_light_msmnile hal_light_client;
-
-# HwBinder IPC from client to server, and callbacks
-binder_call(hal_light_client, hal_light_server)
-binder_call(hal_light_server, hal_light_client)
-
-add_hwservice(hal_light_server, hal_light_hwservice)
-allow hal_light_client hal_light_hwservice:hwservice_manager find;
-
-type hal_light_msmnile_exec, exec_type, file_type;
-init_daemon_domain(hal_light_msmnile)
-
-allow hal_light_msmnile { sysfs_graphics sysfs_rg_led }:lnk_file read;
-allow hal_light_msmnile { sysfs_graphics sysfs_rg_led }:file rw_file_perms;
-allow hal_light_msmnile { sysfs_graphics sysfs_leds sysfs_rg_led }:dir r_dir_perms;
diff --git a/sepolicy/private/init.te b/sepolicy/private/init.te
index 6bcafe7..8caaa57 100644
--- a/sepolicy/private/init.te
+++ b/sepolicy/private/init.te
@@ -6,4 +6,4 @@
allow init { system_file vendor_file }:file mounton;
# Allow init to mount vendor configs
-allow init { system_configs_file vendor_configs_file }:file mounton;
\ No newline at end of file
+allow init vendor_configs_file:dir mounton;
\ No newline at end of file
diff --git a/sepolicy/private/vendor_init.te b/sepolicy/private/vendor_init.te
deleted file mode 100644
index 56fa776..0000000
--- a/sepolicy/private/vendor_init.te
+++ /dev/null
@@ -1,2 +0,0 @@
-# Allow vendor_init to load wlan kernel module
-allow vendor_init system_file:system module_load;
\ No newline at end of file