I want to build AOSP with a Device Manager app.
How can I build the AOSP with device_owner.xml and device_policies.xml already configured ?
PS: My target will be nexus5.
I want to build AOSP with a Device Manager app.
How can I build the AOSP with device_owner.xml and device_policies.xml already configured ?
PS: My target will be nexus5.
I guess it is a bit late for you, but for the others looking for the exact same thing (like I was), there is a great article about kiosk mode with lots of tech details:
http://trac.gateworks.com/wiki/Android/Kiosk
Details regarding the device ownership:
"However, if building from source you can bypass the request to the user and give your app device ownership/admin on first boot by injecting the following two files under out/target/product/ventana/data/system/. The injection is done by adding the files to the PRODUCT_COPY_FILES
variable in your device configuration file (ie device/gateworks/ventana/ventana.mk)."
just add this to the end of your device config file (.mk) using your configured ownership/policy xmls:
# Set device ownership for the kiosk mode app
PRODUCT_COPY_FILES += \
device/gateworks/ventana/device_owner.xml:data/system/device_owner.xml \
device/gateworks/ventana/device_policies.xml:data/system/device_policies.xml
That's not enough, adding the files directly to /data/system will not survive a factory reset (wiping the data partition).
Instead you will need to add your device_owner.xml
and device_policies.xml
to your system partition (any folder, could be simply under /system/
), then edit your init.rc file to copy device_owner.xml
and device_policies.xml
, this should be done in a on post-fs-data
section (executed after the data partition has been mounted).
Dont' forget to set the correct permissions to said files chmod 0600
and chown system sytem
your makefile should look like:
PRODUCT_COPY_FILES += \
device/gateworks/ventana/device_owner.xml:system/device_owner.xml \
device/gateworks/ventana/device_policies.xml:system/device_policies.xml
your init.rc file should look like:
on post-fs-data
# set device manager as device owner
copy /system/device_owner_2.xml /data/system/device_owner_2.xml
chmod 0600 /data/system/device_owner_2.xml
chown system system /data/system/device_owner_2.xml
copy /system/device_policies.xml /data/system/device_policies.xml
chmod 0600 /data/system/device_policies.xml
chown system system /data/system/device_policies.xml
mkdir /data/system
. –
Delacourt © 2022 - 2024 — McMap. All rights reserved.