I'm making Marshmallow AOSP rom and trying to add device_owner.xml to /data/system to provisioning application directly to device owner.
I have added one of .mk files following product copy files
PRODUCT_COPY_FILES += abc/cba:data/system/device_owner.xml
file can be found under out/data/system/ but it doesn't seem to be included to the rom.
I have also tried to replace PRODUCT_COPY_FILES with
PRODUCT_PACKAGES += device_owner.xml
and made own Android.mk file for the file
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE = device_owner.xml
LOCAL_SRC_FILES = $(LOCAL_MODULE)
LOCAL_MODULE_CLASS = ETC
LOCAL_MODULE_PATH = $(TARGET_OUT_DATA)/system
include $(BUILD_PREBUILT)
still it's not include on rom.
i have read that data partition would be part of the userdata.img but file is not there either.
I have tried also to include device_owner.xml to different location like under /system/ and then copy it in init.rc file under post-fs-data phase
copy /system/abc/device_owner.xml /data/system/device_owner.xml
chown system system /data/system/device_owner.xml
chmod 0600 /data/system/device_owner.xml
File will be then correct location but for some reason chown command doesn't change owner and group to system. by default file has root owner and group.
Any idea how this could be done?
EDIT 1.
I have now made one solution for this.
I have made set_device_owner.sh file where i have
#!/system/bin/sh
chown system:system /data/system/device_owner.xml
chmod 0600 /data/system/device_owner.xml
then i added one of .mk files following product copy files
PRODUCT_COPY_FILES += abc/cba/device_owner.xml:/system/xbin/device_owner.xml
PRODUCT_COPY_FILES += abc/cba/set_device_owner.sh:/system/xbin/set_device_owner.sh
and in init.rc i have under post-fs-data
copy /system/xbin/device_owner.xml /data/system/device_owner.xml
exec - root root -- /system/bin/sh ./system/xbin/set_device_owner.sh
Now this works but i would still like to know what would be correct or preferable way of doing it.
And i don't know why that copy and chown and chmod didn't work directly on init.rc