Android Application Accessing Hardware Resources: Difference between revisions

From Variscite Wiki
(Created page with "<!-- Set release according to "release" parameter in URL and use RELEASE_O8.1.0_1.3.0_8M_DART-MX8M as default --> {{INIT_RELEASE_PARAM|RELEASE_O8.1.0_1.3.0_8M_DART-MX8M}}<!--...")
 
No edit summary
Line 3: Line 3:
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_O8.1.0_1.3.0_8M_DART-MX8M}}}} <!--
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_O8.1.0_1.3.0_8M_DART-MX8M}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - {{#switch: {{#var:ANDROID_NAME}} | Android 10 = {{#var:ANDROID_NAME}} | Android 11 = {{#var:ANDROID_NAME}} | | Android 12 = {{#var:ANDROID_NAME}} | Android 13 = {{#var:ANDROID_NAME}} | Android {{#var:ANDROID_NAME}} }} - Accessing Hardware via Android Application}} {{DocImage|category1=Android|category2={{#var:HARDWARE_NAME}}}} __toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} {{#switch: {{#var:ANDROID_NAME}} | Android 10 = {{#var:ANDROID_NAME}} | Android 11 = {{#var:ANDROID_NAME}} | | Android 12 = {{#var:ANDROID_NAME}} | Android 13 = {{#var:ANDROID_NAME}} | Android {{#var:ANDROID_NAME}} }} Accessing Hardware via Android Application}} {{DocImage|category1=Android|category2={{#var:HARDWARE_NAME}}}} __toc__
==Android Application Access==
==Android Application Access==



Revision as of 19:30, 12 September 2023

Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release RELEASE_O8.1.0_1.3.0_8M_DART-MX8M.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release
DART-MX8M Android Oreo Accessing Hardware via Android Application

Android Application Access

By default Android Application can't access the hardware directly as per design. All the hardware access either have to be via Android services or via the HAL layers.

However there are ways to access the hardware like GPIOs / UART/ SPI / I2C/CAN However if customer still want to access you can do so by making Selinux in permissive mode or modify the selinux policies a) and make your application system app. https://devarea.com/aosp-creating-a-systemapplication/#.XxaL2ShKiUk


UART

Project you can take as reference: https://github.com/chzhong/serial-android

SPI

Project you can take as reference: https://github.com/rrandyzh/android-jni-spi

GPIO

Project you can take as reference: https://github.com/synportack24/GPIO

I2C

https://github.com/synportack24/GPIO/blob/master/app/src/main/jni/i2c_fragment.c

CAN

https://github.com/entropia/libsocket-can-java Please refer to README.md for making an application, Let me know if you need further support on this regard, You can either use the setenforce 0 or have your own sepolicies written