Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

build AOSP with device owner configuration

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.

like image 911
hnqoliveira Avatar asked Nov 30 '15 17:11

hnqoliveira


People also ask

What is Android AOSP in Intune?

Intune offers an Android (AOSP) device management solution for corporate-owned Android devices that are: Not integrated with Google Mobile Services. Intended to be shared by more than one user. Used to accomplish a specific set of tasks at work.

What is Android device owner mode?

Device Owner mode gives options to configure policies and customize hardware and software functions for Android devices. You will also need a Mobile Device Management solution like Hexnode to set up, secure and manage Android Enterprise devices for your organization.


2 Answers

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)."

TL;DR:

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
like image 81
dak Avatar answered Oct 08 '22 04:10

dak


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
like image 41
Ahmed Mkaouar Avatar answered Oct 08 '22 02:10

Ahmed Mkaouar