General Steps
The steps listed here are a high level overview of the process to complete ROM enrollment with Hexnode UEM. Specific examples to achieve this is explained in the next section.
Hexnode UEM must be enabled with the system agent when –
Step – 1: Generate ROM Configuration File
- Generate the ROM Configuration file from your Hexnode UEM console and download the file. You will get a hex_rom_config.txt file.
Step – 2: Add Hexnode UEM App as a Pre-built Application
- The Hexnode UEM app must be added as a system app(priv-app). The app must not be signed by the vendor. If the app is signed, Hexnode UEM app will not be able to update itself unless each update is signed by the vendor. So, it is recommended to leave the Hexnode UEM app with the default signature. Download the latest version of the app here – Hexnode UEM.apk.
Step – 3: Add Hexnode System Agent App as a Pre-built Application
- The Hexnode System Agent app must be added as a system app(priv-app). The app must not be signed by the vendor. If the app is signed, Hexnode System Agent app will not be able to update itself unless each update is signed by the vendor. So, it is recommended to leave the Hexnode System Agent app with the default signature. Download the latest version of the app here – Hexnode System Agent.apk.
Step – 4: Declare Necessary Permissions for Hexnode UEM app and the System Agent App
- The Hexnode UEM and System Agent app must be granted all the necessary permissions to function on the device, without requiring the end user to manually grant them during runtime. Android provides a python script – privapp_permissions.py; to generate the privapp-permissions.xml file for priv-apps. Placing this generated file in /frameworks/base/data/etc/ will ensure that the permissions are auto-granted.
- As an example, the following lists the permissions required by the Hexnode UEM app.
123456789101112131415161718192021222324252627282930313233343536373839404142<privapp-permissions package="com.hexnode.hexnodemdm"><permission name="android.permission.BLUETOOTH" /><permission name="android.permission.BLUETOOTH_ADMIN" /><permission name="android.permission.INTERNET" /><permission name="android.permission.WAKE_LOCK" /><permission name="android.permission.ACCESS_WIFI_STATE" /><permission name="android.permission.UPDATE_DEVICE_STATS" /><permission name="android.permission.ACCESS_NETWORK_STATE" /><permission name="android.permission.CHANGE_WIFI_STATE" /><permission name="android.permission.WRITE_SETTINGS" /><permission name="android.permission.EXPAND_STATUS_BAR" /><permission name="android.permission.RECEIVE_BOOT_COMPLETED" /><permission name="android.permission.SET_WALLPAPER" /><permission name="android.permission.SET_WALLPAPER_HINTS" /><permission name="android.permission.FOREGROUND_SERVICE" /><permission name="android.permission.REBOOT" /><permission name="android.permission.SHUTDOWN" /><permission name="android.permission.DELETE_PACKAGES" /><permission name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" /><permission name="android.permission.GET_ACCOUNTS" /><permission name="android.permission.MANAGE_ACCOUNTS" /><permission name="com.google.android.providers.gsf.permission.READ_GSERVICES" /><permission name="android.permission.REQUEST_INSTALL_PACKAGES" /><permission name="android.permission.REQUEST_DELETE_PACKAGES" /><permission name="android.permission.MANAGE_DEVICE_ADMINS" /><permission name="android.permission.WRITE_EXTERNAL_STORAGE" /><permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /><permission name="android.permission.CHANGE_NETWORK_STATE" /><permission name="android.permission.ACCESS_FINE_LOCATION" /><permission name="android.permission.ACCESS_COARSE_LOCATION" /><permission name="android.permission.WRITE_CONTACTS" /><permission name="android.permission.READ_CONTACTS" /><permission name="android.permission.ACCESS_NOTIFICATION_POLICY" /><permission name="android.permission.PACKAGE_USAGE_STATS" /><permission name="android.permission.INTERACT_ACROSS_USERS_FULL" /><permission name="android.permission.CAMERA" /><permission name="android.permission.READ_PHONE_STATE" /><permission name="android.permission.REORDER_TASKS" /><permission name="android.permission.GET_TASKS" /><permission name="android.permission.SYSTEM_ALERT_WINDOW" /><permission name="android.permission.INSTALL_PACKAGES" /></privapp-permissions>
Step – 5: Allow Dangerous Permissions Silently
- The app must be able to get all possible permissions without user interaction. When the device boots up, Hexnode UEM should have all possible permissions allowed. To do this, the dangerous permission exceptions must be declared. If the permissions were granted using the
1234567891011121314151617<?xml version="1.0" encoding="utf-8"?><exceptions><exception package="com.hexnode.hexnodemdm"><!-- Hexnode --><permission name="android.permission.WRITE_EXTERNAL_STORAGE" fixed="false"/><permission name="android.permission.READ_EXTERNAL_STORAGE" fixed="false"/><permission name="android.permission.ACCESS_FINE_LOCATION" fixed="false" /><permission name="android.permission.ACCESS_COARSE_LOCATION" fixed="false" /><permission name="android.permission.CAMERA" fixed="false"/><permission name="android.permission.WRITE_CONTACTS" fixed="false" /><permission name="android.permission.READ_CONTACTS" fixed="false"/><permission name="android.permission.READ_PHONE_STATE" fixed="false"/><permission name="android.permission.BLUETOOTH" fixed="false"/><permission name="android.permission.BLUETOOTH_ADMIN" fixed="false"/><permission name="android.permission.BLUETOOTH_PRIVILEGED" fixed="false"/></exception></exceptions>
Notes
- For detailed steps, see the detailed explanation later in the doc.
- All permissions that must be auto-granted can be given here, based on the compliance requirements.
Step – 6: Device Owner Permissions
- The Hexnode UEM app must be provided device owner permissions. The following must be added to device_policies.xml file.
- The following must be added to device_owner_2.xml file.
- Both of these files must be present in the /system folder once the build is complete.
1 2 3 4 5 6 7 |
<policies> <admin name=“com.hexnode.hexnodemdm/com.hexnode.mdm.receivers.HexnodeDeviceAdminReceiver"> <policies flags="479" /> <strong-auth-unlock-timeout value="0" /> </admin> <lock-task-features value="16" /> </policies> |
1 2 3 4 5 6 |
<root> <device-owner package="com.hexnode.hexnodemdm" name="" component="com.hexnode.hexnodemdm/com.hexnode.mdm.receivers.HexnodeDeviceAdminReceiver" userRestrictionsMigrated="true" /> <device-owner-context userId="0" /> </root> |
Step – 7: Place Hexnode Configuration File
- Place the hex_rom_config.txt file in /system. The file must be accessible by the Hexnode UEM app.
Step – 8: Draw over Other Apps
- Allow Hexnode UEM app to draw over other apps if possible.
Step – 9: Launcher Permissions
- Optional step. Please ensure that Hexnode UEM app is allowed to act as a launcher, if the device is intended for use as a kiosk.
Step – 10: Provide Root Permissions
- Optional step. If root access is required, provide root privileges to Hexnode UEM app.
Step – 11: Build the ROM
- Build the ROM and flash the ROM on the devices. The devices must boot up and directly open the Hexnode UEM app.
Detailed Steps
The steps provided here have been specifically tested in device with Android version and build. The file systems and partitions mentioned might be specific to these devices or builds.
To be performed by a Hexnode admin.
Step – 1: Generate ROM Configuration File.
- From the Hexnode UEM console, generate the ROM configuration file and download it. You should obtain a file named hex_rom_config.txt. If the downloaded file has a different name, please rename the file to hex_rom_config.txt. Also, download the latest version of the Hexnode app – Hexnode UEM.apk. Pass the generated file, the Hexnode UEM application and this document to the device vendor.
To be performed by the device vendor before building the ROM.
Step – 2: Add Hexnode UEM app as a pre-built application.
- In your source move to the apps directory.
Path –1<source_directory>/package/apps/ - Create a folder with the name hexnodemdm
- Move to the folder hexnodemdm.
Path –1<source_directory>/package/apps/hexnodemdm - Place the Hexnode UEM app in the hexnodemdm folder. The latest app can be downloaded from this link – Hexnode UEM.apk.
- Create a file named Android.mk in the same directory.
- Add these lines to the file Android.mk and save it.
1234567891011LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE_TAGS := optionalLOCAL_MODULE := hexnodemdmLOCAL_CERTIFICATE := PRESIGNEDLOCAL_SRC_FILES := hexnodemdm.apkLOCAL_MODULE_CLASS := APPSLOCAL_PRIVILEGED_MODULE := trueLOCAL_DEX_PREOPT := falseLOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)include $(BUILD_PREBUILT)
- Move to the product directory.
Path –1<source_directory>/build/target/product/ - Find the file named handheld_system.mk.
- Edit the file handheld_system.mk and mention the module name hexnodemdm under PRODUCT_PACKAGES list.
- Save the file.
Step – 4: Allow Permissions Silently
The Hexnode UEM app must be provided specific permissions to access the Hexnode Configuration file downloaded in Step – 1, and several other permissions so that the application can function as intended.
- Generate permissions required by apk to be included in privapp-permissions.xml by executing:
- Running this command should list all the permissions required by the application. If nothing appears, begin the build process (steps provided in later sections of the document). Once the build completes, rerun the script, specifying the path of the APK in the output directory. This will list the required permissions. Copy these permissions listed.
- Navigate to –
- Add the permissions inside privapp-permissions package tag. As an example, if the permissions that were listed were – android.permission.DELETE_PACKAGES, android.permission.INSTALL_PACKAGES, and android.permission.MOUNT_UNMOUNT_FILESYSTEMS, the following lines should be added –
- Build the ROM again and all necessary permissions must be granted to the application.
1 |
python3 development/tools/privapp_permissions/privapp_permissions.py out/target/product/<product-name>/system/priv-app/hexnodemdm/hexnodemdm.apk |
1 |
frameworks/base/data/etc/ |
1 2 3 4 5 6 |
<!-- hexnode custom permissions --> <privapp-permissions package="com.hexnode.hexnodemdm"> <permission name="android.permission.DELETE_PACKAGES"/> <permission name="android.permission.INSTALL_PACKAGES"/> <permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> </privapp-permissions> |
Detailed Steps – Android 9+
To be performed by a Hexnode admin.
Step – 1: Generate ROM Configuration File.
- From the Hexnode UEM console, generate the ROM configuration file and download it. You should obtain a file named hex_rom_config.txt. If the downloaded file has a different name, please rename the file to hex_rom_config.txt. Also, download the latest version of the Hexnode app – Hexnode UEM.apk. Pass the generated file, the Hexnode UEM application and this document to the device vendor.
To be performed by the device vendor before building the ROM.
Step – 2: Add Hexnode UEM app as a pre-built application.
- In your source move to the apps directory.
Path –1<source_directory>/package/apps/ - Create a folder with the name hexnodemdm
- Move to the folder hexnodemdm.
Path –1<source_directory>/package/apps/hexnodemdm - Place the Hexnode UEM app in the hexnodemdm folder. The latest app can be downloaded from this link – Hexnode UEM.apk.
- Create a file named Android.mk in the same directory.
- Add these lines to the file Android.mk and save it.
1234567891011LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE_TAGS := optionalLOCAL_MODULE := hexnodemdmLOCAL_CERTIFICATE := PRESIGNEDLOCAL_SRC_FILES := hexnodemdm.apkLOCAL_MODULE_CLASS := APPSLOCAL_PRIVILEGED_MODULE := trueLOCAL_DEX_PREOPT := falseLOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)include $(BUILD_PREBUILT)
- Move to the product directory.
Path –1<source_directory>/build/target/product/ - Find the file named handheld_system.mk.
- Edit the file handheld_system.mk and mention the module name hexnodemdm under PRODUCT_PACKAGES list.
- Save the file.
Step – 3: Declare Necessary Permissions.
- Move to the folder etc.
Path –1<source_directory>/frameworks/base/data/etc/ - Find the file named privapp-permissions-platform.xml.
- Edit the file and add the following lines –
123456789101112131415161718192021222324252627282930313233343536373839404142<privapp-permissions package="com.hexnode.hexnodemdm"><permission name="android.permission.BLUETOOTH" /><permission name="android.permission.BLUETOOTH_ADMIN" /><permission name="android.permission.INTERNET" /><permission name="android.permission.WAKE_LOCK" /><permission name="android.permission.ACCESS_WIFI_STATE" /><permission name="android.permission.UPDATE_DEVICE_STATS" /><permission name="android.permission.ACCESS_NETWORK_STATE" /><permission name="android.permission.CHANGE_WIFI_STATE" /><permission name="android.permission.WRITE_SETTINGS" /><permission name="android.permission.EXPAND_STATUS_BAR" /><permission name="android.permission.RECEIVE_BOOT_COMPLETED" /><permission name="android.permission.SET_WALLPAPER" /><permission name="android.permission.SET_WALLPAPER_HINTS"/><permission name="android.permission.FOREGROUND_SERVICE" /><permission name="android.permission.REBOOT" /><permission name="android.permission.SHUTDOWN" /><permission name="android.permission.DELETE_PACKAGES" /><permission name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" /><permission name="android.permission.GET_ACCOUNTS" /><permission name="android.permission.MANAGE_ACCOUNTS" /><permission name="com.google.android.providers.gsf.permission.READ_GSERVICES" /><permission name="android.permission.REQUEST_INSTALL_PACKAGES" /><permission name="android.permission.REQUEST_DELETE_PACKAGES" /><permission name="android.permission.MANAGE_DEVICE_ADMINS" /><permission name="android.permission.WRITE_EXTERNAL_STORAGE" /><permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /><permission name="android.permission.CHANGE_NETWORK_STATE" /><permission name="android.permission.ACCESS_FINE_LOCATION" /><permission name="android.permission.ACCESS_COARSE_LOCATION" /><permission name="android.permission.WRITE_CONTACTS" /><permission name="android.permission.READ_CONTACTS" /><permission name="android.permission.ACCESS_NOTIFICATION_POLICY" /><permission name="android.permission.PACKAGE_USAGE_STATS" /><permission name="android.permission.INTERACT_ACROSS_USERS_FULL" /><permission name="android.permission.CAMERA" /><permission name="android.permission.READ_PHONE_STATE" /><permission name="android.permission.REORDER_TASKS" /><permission name="android.permission.GET_TASKS" /><permission name="android.permission.SYSTEM_ALERT_WINDOW" /><permission name="android.permission.INSTALL_PACKAGES" /></privapp-permissions>
- Save the file privapp-permissions-platform.xml.
Step – 4: Allow Permissions Silently
- Move to the folder <model_name>.This can be in a core folder on the device where the default permissions for apps such as Phone, Messages, etc. are stored.
- Create a file named default-permissions-sample.xml.
- Edit the file and add the following lines –
- Save the file default-permissions-sample.xml.
Path –
1 |
<source_directory>/device/<vendor_name>/<model_name>/ |
Example – For Pixel 4a 5G, the folder is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?xml version="1.0" encoding="utf-8"?> <exceptions> <exception package="com.hexnode.hexnodemdm"> <!-- Hexnode --> <permission name="android.permission.WRITE_EXTERNAL_STORAGE" fixed="false"/> <permission name="android.permission.READ_EXTERNAL_STORAGE" fixed="false"/> <permission name="android.permission.ACCESS_FINE_LOCATION" fixed="false" /> <permission name="android.permission.ACCESS_COARSE_LOCATION" fixed="false" /> <permission name="android.permission.CAMERA" fixed="false"/> <permission name="android.permission.WRITE_CONTACTS" fixed="false" /> <permission name="android.permission.READ_CONTACTS" fixed="false"/> <permission name="android.permission.READ_PHONE_STATE" fixed="false"/> <permission name="android.permission.BLUETOOTH" fixed="false"/> <permission name="android.permission.BLUETOOTH_ADMIN" fixed="false"/> <permission name="android.permission.BLUETOOTH_PRIVILEGED" fixed="false"/> </exception> </exceptions> |
Step – 5: Device Owner Permissions
-
Move to the folder <model_name>.This can be in a core folder on the device where the default permissions for apps such as Phone, Messages, etc. are stored.
- Create a file named device_policies.xml. Add the following lines and save the file.
- Create a file named device_owner_2.xml in the same directory and add these lines.
- Save the files.
Path –
1 |
<source_directory>/device/<vendor_name>/<model_name>/ |
Example – For Pixel 4a 5G, the folder is
1 2 3 4 5 6 7 |
<policies> <admin name=“com.hexnode.hexnodemdm/com.hexnode.mdm.receivers.HexnodeDeviceAdminReceiver"> <policies flags="479" /> <strong-auth-unlock-timeout value="0" /> </admin> <lock-task-features value="16" /> </policies> |
1 2 3 4 5 6 |
<root> <device-owner package="com.hexnode.hexnodemdm" name="" component="com.hexnode.hexnodemdm/com.hexnode.mdm.receivers.HexnodeDeviceAdminReceiver" userRestrictionsMigrated="true" /> <device-owner-context userId="0" /> </root> |
Step – 6: Place the ROM Config File
- Move to the folder <model_name>.This can be in a core folder on the device where the default permissions for apps such as Phone, Messages, etc. are stored.
- Place the hex_rom_config.txt file inside this folder that was obtained from Step – 1.
Path –
1 |
<source_directory>/device/<vendor_name>/<model_name>/ |
Example – For Pixel 4a 5G, the folder is
Step – 7: Inject Rom Config, Device Owner and the Permission Files
For Android 11 –
- Move to the folder <model_name>.This can be in a core folder on the device where the default permissions for apps such as Phone, Messages, etc. are stored.
- Find the configuration files – aosp_<device_model>.mk and device_<device_model>.mk. If these files are not present, follow the steps for Android 12 given below.
- Add the following lines to both of these files.
- Save the files.
- Edit your init.rc file.
- Add the following lines under post-fs-data.
Path –
1 |
<source_directory>/device/<vendor_name>/<model_name>/ |
Example – For Pixel 4a 5G, the folder is
For a Pixel 4a 5G, the files are named aosp_bramble.mk and device_bramble.mk.
1 2 3 4 |
PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/device_policies.xml:system/device_policies.xml PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/hex_rom_config.txt:system/hex_rom_config.txt PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/default-permission-sample.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/default-permissions/default-permission-sample.xml PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/device_owner_2.xml:system/device_owner_2.xml |
Path –
1 |
<source_directory>/system/core/rootdir/init.rc |
1 2 3 4 5 6 |
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 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 |
For Android 12 –
- Move to the folder product. Path –
- Find the files base_system.mk and base_product.mk. If these files are not present, follow the steps for Android 11 provided above.
- Add the following lines in base_system.mk.
- Add the following lines in base_product.mk.
- Save the files.
- Edit your init.rc file.
- Add the following lines under post-fs-data.
1 |
<source_directory>/build/make/target/product |
1 2 3 |
PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/device_policies.xml:system/device_policies.xml PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/hex_rom_config.txt:system/hex_rom_config.txt PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/device_owner_2.xml:system/device_owner_2.xml |
1 |
PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/default-permission-sample.xml:product/etc/default-permissions/default-permission-sample.xml |
Path –
1 |
<source_directory>/system/core/rootdir/init.rc |
1 2 3 4 5 6 |
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 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 |
Step – 8: Draw over Other Apps
- Allow the Hexnode UEM app to draw over other apps if possible. The method to do this is different for each vendor.
Step – 9: Launcher Permissions
- Optional step. Please ensure that Hexnode UEM app is allowed to act as a launcher, if the device is intended for use as a kiosk.
Step – 10: Provide Root Permissions
- Optional step. If root access is required, provide root privileges to the Hexnode UEM app.
Step – 11: Build your ROM
- Once these steps are completed, build your ROM and flash it on a test device.
Testing and Troubleshooting
The following cases must be tested to ensure that the ROM Enrollment is successful.
Illegal entries error while building ROM.
The PRODUCT_COPY_FILES action on default-permission-sample.xml may return an illegal entry error. In such cases, change the initial file location to base_product.mk or base_system.mk, make necessary changes to the file and retry the build.
Hexnode UEM is not automatically started at device boot.
The Hexnode UEM app must be automatically started and the app must run in full screen as soon as the device boots up. If the app does not open, sufficient permissions are not provided. Please check if all permissions are provided.
Detailed Steps: Android 7+
To be performed by a Hexnode admin.
Step – 1: Generate ROM Configuration File.
- From the Hexnode UEM console, generate the ROM configuration file and download it. You should obtain a file named hex_rom_config.txt. If the downloaded file has a different name, please rename the file to hex_rom_config.txt. Also, download the latest version of the Hexnode app – Hexnode UEM.apk. Pass the generated file, the Hexnode UEM application and this document to the device vendor.
To be performed by the device vendor before building the ROM.
Step – 2: Add Hexnode UEM app as a pre-built application.
- In your source move to the apps directory.
Path –1<source_directory>/package/apps/ - Create a folder with the name hexnodemdm
- Move to the folder hexnodemdm.
Path –1<source_directory>/package/apps/hexnodemdm - Place the Hexnode UEM app in the hexnodemdm folder. The latest app can be downloaded from this link – Hexnode UEM.apk.
- Create a file named Android.mk in the same directory.
- Add these lines to the file Android.mk and save it.
1234567891011LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE_TAGS := optionalLOCAL_MODULE := hexnodemdmLOCAL_CERTIFICATE := PRESIGNEDLOCAL_SRC_FILES := hexnodemdm.apkLOCAL_MODULE_CLASS := APPSLOCAL_PRIVILEGED_MODULE := trueLOCAL_DEX_PREOPT := falseLOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)include $(BUILD_PREBUILT)
- Move to the product directory.
Path –1<source_directory>/build/target/product/ - Find the file named core.mk.
- Edit the file core.mk and mention the module name hexnodemdm under PRODUCT_PACKAGES list.
- Save the file.
Step – 3: Declare Necessary Permissions.
- Move to the folder etc.
Path –1<source_directory>/frameworks/base/data/etc/ - Find the file named privapp-permissions-platform.xml.
- Edit the file and add the following lines –
123456789101112131415161718192021222324252627282930313233343536373839404142<privapp-permissions package="com.hexnode.hexnodemdm"><permission name="android.permission.BLUETOOTH" /><permission name="android.permission.BLUETOOTH_ADMIN" /><permission name="android.permission.INTERNET" /><permission name="android.permission.WAKE_LOCK" /><permission name="android.permission.ACCESS_WIFI_STATE" /><permission name="android.permission.UPDATE_DEVICE_STATS" /><permission name="android.permission.ACCESS_NETWORK_STATE" /><permission name="android.permission.CHANGE_WIFI_STATE" /><permission name="android.permission.WRITE_SETTINGS" /><permission name="android.permission.EXPAND_STATUS_BAR" /><permission name="android.permission.RECEIVE_BOOT_COMPLETED" /><permission name="android.permission.SET_WALLPAPER" /><permission name="android.permission.SET_WALLPAPER_HINTS"/><permission name="android.permission.FOREGROUND_SERVICE" /><permission name="android.permission.REBOOT" /><permission name="android.permission.SHUTDOWN" /><permission name="android.permission.DELETE_PACKAGES" /><permission name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" /><permission name="android.permission.GET_ACCOUNTS" /><permission name="android.permission.MANAGE_ACCOUNTS" /><permission name="com.google.android.providers.gsf.permission.READ_GSERVICES" /><permission name="android.permission.REQUEST_INSTALL_PACKAGES" /><permission name="android.permission.REQUEST_DELETE_PACKAGES" /><permission name="android.permission.MANAGE_DEVICE_ADMINS" /><permission name="android.permission.WRITE_EXTERNAL_STORAGE" /><permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /><permission name="android.permission.CHANGE_NETWORK_STATE" /><permission name="android.permission.ACCESS_FINE_LOCATION" /><permission name="android.permission.ACCESS_COARSE_LOCATION" /><permission name="android.permission.WRITE_CONTACTS" /><permission name="android.permission.READ_CONTACTS" /><permission name="android.permission.ACCESS_NOTIFICATION_POLICY" /><permission name="android.permission.PACKAGE_USAGE_STATS" /><permission name="android.permission.INTERACT_ACROSS_USERS_FULL" /><permission name="android.permission.CAMERA" /><permission name="android.permission.READ_PHONE_STATE" /><permission name="android.permission.REORDER_TASKS" /><permission name="android.permission.GET_TASKS" /><permission name="android.permission.SYSTEM_ALERT_WINDOW" /><permission name="android.permission.INSTALL_PACKAGES" /></privapp-permissions>
- Save the file privapp-permissions-platform.xml.
Step – 4: Allow Permissions Silently
- Move to the folder <model_name>.This can be in a core folder on the device where the default permissions for apps such as Phone, Messages, etc. are stored.
- Edit the file named default-permissions.xml.
- Add the following lines –
- Save the file default-permissions.xml.
Path –
1 |
<source_directory>/device/<vendor_name>/<model_name>/ |
Example – For Google Pixel(Pixel 1), the folder is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?xml version="1.0" encoding="utf-8"?> <exceptions> <exception package="com.hexnode.hexnodemdm"> <!-- Hexnode --> <permission name="android.permission.WRITE_EXTERNAL_STORAGE" fixed="false"/> <permission name="android.permission.READ_EXTERNAL_STORAGE" fixed="false"/> <permission name="android.permission.ACCESS_FINE_LOCATION" fixed="false" /> <permission name="android.permission.ACCESS_COARSE_LOCATION" fixed="false" /> <permission name="android.permission.CAMERA" fixed="false"/> <permission name="android.permission.WRITE_CONTACTS" fixed="false" /> <permission name="android.permission.READ_CONTACTS" fixed="false"/> <permission name="android.permission.READ_PHONE_STATE" fixed="false"/> <permission name="android.permission.BLUETOOTH" fixed="false"/> <permission name="android.permission.BLUETOOTH_ADMIN" fixed="false"/> <permission name="android.permission.BLUETOOTH_PRIVILEGED" fixed="false"/> </exception> </exceptions> |
Notes
- You can add additional permissions that must be automatically granted.
Step – 5: Device Owner Permissions
-
Move to the folder <model_name>.This can be in a core folder on the device where the default permissions for apps such as Phone, Messages, etc. are stored.
- Create a file named device_policies.xml. Add the following lines and save the file.
- Create a file named device_owner_2.xml in the same directory and add these lines.
- Save the files.
Path –
1 |
<source_directory>/device/<vendor_name>/<model_name>/ |
Example – For Google Pixel (Pixel 1), the folder is
1 2 3 4 5 6 7 |
<policies> <admin name=“com.hexnode.hexnodemdm/com.hexnode.mdm.receivers.HexnodeDeviceAdminReceiver"> <policies flags="479" /> <strong-auth-unlock-timeout value="0" /> </admin> <lock-task-features value="16" /> </policies> |
1 2 3 4 5 6 |
<root> <device-owner package="com.hexnode.hexnodemdm" name="" component="com.hexnode.hexnodemdm/com.hexnode.mdm.receivers.HexnodeDeviceAdminReceiver" userRestrictionsMigrated="true" /> <device-owner-context userId="0" /> </root> |
Step – 6: Place the ROM Config File
- Move to the folder <model_name>.This can be in a core folder on the device where the default permissions for apps such as Phone, Messages, etc. are stored.
- Place the hex_rom_config.txt file inside this folder that was obtained from Step – 1.
Path –
1 |
<source_directory>/device/<vendor_name>/<model_name>/ |
Example – For Google Pixel(Pixel 1), the folder is
Step – 7: Inject Rom Config, Device Owner and the Permission Files
- Move to the folder <model_name>.This can be in a core folder on the device where the default permissions for apps such as Phone, Messages, etc. are stored.
- Find the configuration files – device-<device_model>.mk and device-common.mk.
- Add the following lines to both of these files.
- Save the files.
- Edit your init.rc file.
- Add the following lines under post-fs-data.
Path –
1 |
<source_directory>/device/<vendor_name>/<model_name>/ |
Example – For Google Pixel(Pixel 1), the folder is
For a Google Pixel (Pixel 1), the files are named device-sailfish.mk and device-common.mk.
1 2 3 |
PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/device_policies.xml:system/device_policies.xml PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/hex_rom_config.txt:system/hex_rom_config.txt PRODUCT_COPY_FILES += device/<vendor_name>/<model_name>/device_owner_2.xml:system/device_owner_2.xml |
Path –
1 |
<source_directory>/system/core/rootdir/init.rc |
1 2 3 4 5 6 |
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 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 |
Step – 8: Draw over Other Apps
- Allow the Hexnode UEM app to draw over other apps if possible. The method to do this is different for each vendor.
Step – 9: Launcher Permissions
- Optional step. Please ensure that Hexnode UEM app is allowed to act as a launcher, if the device is intended for use as a kiosk.
Step – 10: Provide Root Permissions
- Optional step. If root access is required, provide root privileges to the Hexnode UEM app.
Step – 11: Build your ROM
- Once these steps are completed, build your ROM and flash it on a test device.