Add custom.xml file to AOSP etc folder

2020-07-18 10:44发布

问题:

I wanted to add a resource file/ xml file to etc folder in AOSP. I would like to have my resource file available just like platform.xml file.

So I basically added my xml file in AOSP/frameworks/base/data/etc folder and correspondingly added the following lines in the make file Android.mk



########################
include $(CLEAR_VARS)

LOCAL_MODULE := custom.xml

LOCAL_MODULE_TAGS := optional

LOCAL_MODULE_CLASS := ETC

# This will install the file in /system/etc/permissions
#
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions

LOCAL_SRC_FILES := $(LOCAL_MODULE)

include $(BUILD_PREBUILT)

EDIT
With the above added I was not able to see my file in /system/etc/permissions folder. Am I missing something?

回答1:

It looks that your change is device specific and not framework related. In that case you probably want to include your file in aosp / device / ... / model /

You can check how is done looking in the device makefile from samsung tuna: https://android.googlesource.com/device/samsung/tuna/+/master/device.mk

The PRODUCT_COPY_FILES variable includes the "origin_file:destination_file"

PRODUCT_COPY_FILES += \
$(LOCAL_KERNEL):kernel \
device/samsung/tuna/init.tuna.rc:root/init.tuna.rc \
device/samsung/tuna/init.tuna.usb.rc:root/init.tuna.usb.rc \
device/samsung/tuna/fstab.tuna:root/fstab.tuna \
device/samsung/tuna/ueventd.tuna.rc:root/ueventd.tuna.rc \
device/samsung/tuna/media_profiles.xml:system/etc/media_profiles.xml \
device/samsung/tuna/media_codecs.xml:system/etc/media_codecs.xml \
device/samsung/tuna/gps.conf:system/etc/gps.conf