Difference between revisions of "Template:RK3399-Android8"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(updated by API)
 
(15 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
FriendlyElec provides a full Android8.1 BSP for '''{{{1}}}'''. The source code is hosted at gitlab.com and is open source. The BSP supports GPU and VPU hardware acceleration.
 
FriendlyElec provides a full Android8.1 BSP for '''{{{1}}}'''. The source code is hosted at gitlab.com and is open source. The BSP supports GPU and VPU hardware acceleration.
  
===Connect MIPI Camera to T4===
+
===Connect MIPI Camera to {{{1}}}===
 
+
 
FriendlyElec developed a MIPI camera CAM1320 for board and it works under Android. You can use this camera to take pictures and record video. The operation is straightforward. You just need to connect the camera at your board's MIPI interface, boot your board to Android and start Android's camera app.<br />
 
FriendlyElec developed a MIPI camera CAM1320 for board and it works under Android. You can use this camera to take pictures and record video. The operation is straightforward. You just need to connect the camera at your board's MIPI interface, boot your board to Android and start Android's camera app.<br />
 
{{#switch: {{{1}}}
 
{{#switch: {{{1}}}
Line 13: Line 12:
 
[[File:T4-mipi-dual-camera.jpg|frameless|600px]]<br>
 
[[File:T4-mipi-dual-camera.jpg|frameless|600px]]<br>
 
  | NanoPi-M4 =
 
  | NanoPi-M4 =
 +
The board has two MIPI interfaces: one front camera and the other rear camera:<br />
 +
'''MIPI-CSI1'''  <-->  '''Android rear camera'''<br />
 +
'''MIPI-CSI2'''  <-->  '''Android front camera'''<br /><br />
 +
How to connect:<br />
 +
[[File:M4-mipi-dual-camera.jpg|frameless|600px]]<br>
 +
| NanoPi-M4V2 =
 +
The board has two MIPI interfaces: one front camera and the other rear camera:<br />
 +
'''MIPI-CSI1'''  <-->  '''Android rear camera'''<br />
 +
'''MIPI-CSI2'''  <-->  '''Android front camera'''<br /><br />
 +
How to connect:<br />
 +
[[File:M4-mipi-dual-camera.jpg|frameless|600px]]<br>
 +
| NanoPi-M4B =
 
The board has two MIPI interfaces: one front camera and the other rear camera:<br />
 
The board has two MIPI interfaces: one front camera and the other rear camera:<br />
 
'''MIPI-CSI1'''  <-->  '''Android rear camera'''<br />
 
'''MIPI-CSI1'''  <-->  '''Android rear camera'''<br />
Line 25: Line 36:
 
  | #default =
 
  | #default =
 
}}
 
}}
 +
 +
===Use dual MIPI camera preview and video===
 +
Download the sample source code below from github and compile and run it:
 +
<syntaxhighlight lang="bash">
 +
git clone https://github.com/friendlyarm/Dual-Camera.git -b working-branch
 +
</syntaxhighlight>
 +
After the application is installed, you need to '''Set Android permissions''' to make the demo run normally. The method is enter system ui: Settings -> Apps & notifications -> Dual Camera -> Permissions, Select the following permissions:
 +
<syntaxhighlight lang="bash">
 +
Camera
 +
Microphone
 +
Storage
 +
</syntaxhighlight>
 +
The gui looks like this:<br />
 +
[[File:Android_dual_camera_demo.jpg|frameless|600px]]<br />
 +
Click the "CAPTURE VIDEO" button on the gui to record the video (two cameras at the same time), and the video file will be saved to the following location.:/storage/emulated/0/Download/dualcamera_h264.mp4.
 +
'''Known issue''':<br />
 +
Recorded video file will play faster than normal, may need to adjust some parameters of mediacodec.
 +
 +
===Change system language===
 +
The default system language of Android system is English. For example, if we want to set it to Chinese, the steps are as follows:
 +
1) Go to Android settings:Settings -> System -> Languages & Input -> Languages; <br />
 +
2)Click "Add a language", Select "简体中文", and then select "中国"; <br />
 +
3) At this time, there will be two languages, Chinese and English. Drag the Chinese item to the top of the list. Note that if you are using a mouse, drag it by placing the mouse pointer on the right side of the list item. On the icon and then press the middle mouse button to drag; <br />
  
 
===Android8.1 hardware access===
 
===Android8.1 hardware access===
 
You can use the FriendlyThings SDK to access and control hardware resources on the motherboard in the Android App, such as Uart, SPI, I2C, GPIO and other interfaces. For details, please refer to the following two documents.:
 
You can use the FriendlyThings SDK to access and control hardware resources on the motherboard in the Android App, such as Uart, SPI, I2C, GPIO and other interfaces. For details, please refer to the following two documents.:
*[[FriendlyThings for RK3399|Android: FriendlyThings for RK3399]]
+
*[[FriendlyThings for Rockchip|Android: FriendlyThings for Rockchip]]
 
*[[FriendlyThings APIs|Android: FriendlyThings APIs]]
 
*[[FriendlyThings APIs|Android: FriendlyThings APIs]]
  
 
===Android Neural Networks SDK Sample===
 
===Android Neural Networks SDK Sample===
Android8.1 BSP预装了Rockchip为Android8.1提供的Android NN SDK,支持GPU加速。<br />
+
Android8.1 BSP comes pre-installed with Rockchip's Android NN SDK for Android 8.1, supporting GPU acceleration.。<br />
我们提供的Android8固件中预装了Android NN的示例程序:TfLiteCameraDemo,这是一个使用Rockchip AndroidNN GPU加速的MobileNet分类器Demo,运行时需要主板连接有摄像头模块,USB摄像头和CSI摄像头都是支持的,示例程序通过点击首页的 “TfLiteCameraDemo”图标进入,运行效果如下所示:<br /><br />
+
Sample program for Android NN pre-installed in the Android8 firmware we provide:TfLiteCameraDemo,This is a MobileNet classifier demo using Rockchip AndroidNN GPU acceleration,The camera module is required to be connected to the motherboard during operation. The USB camera and CSI camera are supported,The sample program is launched by clicking the "TfLiteCameraDemo" icon on the home page. The running effect is as follows:<br /><br />
 
[[File:TfLiteCameraDemo.png|frameless|600px]]<br />
 
[[File:TfLiteCameraDemo.png|frameless|600px]]<br />
关于Android NN SDK的详细描述,可以参考原厂的这份文档:[https://gitlab.com/friendlyelec/rk3399-android-8.1/blob/master/RKDocs/rk3399/RK3399_Android8.1_AndroidNN_SDK_V1.0_20180605%E5%8F%91%E5%B8%83%E8%AF%B4%E6%98%8E.pdf [RK3399_Android8.1_AndroidNN_SDK_V1.0_20180605发布说明.pdf]]<br />
+
For a detailed description of the Android NN SDK, you can refer to this document:[https://gitlab.com/friendlyelec/rk3399-android-8.1/blob/master/RKDocs/rk3399/RK3399_Android8.1_AndroidNN_SDK_V1.0_20180605%E5%8F%91%E5%B8%83%E8%AF%B4%E6%98%8E.pdf [RK3399_Android8.1_AndroidNN_SDK_V1.0_20180605发布说明.pdf]]<br />
TfLiteCameraDemo示例源代码下载地址:[https://github.com/rockchip-linux/tensorflow/tree/master/tensorflow/contrib/lite/java/demo [TfLiteCameraDemo源代码]]<br />
+
TfLiteCameraDemo sample source code download link:[https://github.com/rockchip-linux/tensorflow/tree/master/tensorflow/contrib/lite/java/demo [TfLiteCameraDemo source code]]<br />
 +
 
 +
===Using the adb===
 +
1. The first time you start the system, if you need to change the system files, you need to turn off security verification (note: apk installation does not need to be closed), and restart after turning off security verification
 +
<syntaxhighlight lang="bash">
 +
adb root
 +
adb disable-verity
 +
adb reboot
 +
</syntaxhighlight>
 +
2. After restarting, get root and remount /system to enable write permissions
 +
<syntaxhighlight lang="bash">
 +
adb root
 +
adb remount
 +
</syntaxhighlight>
 +
3. Upload a file
 +
<syntaxhighlight lang="bash">
 +
adb push example.txt /system/
 +
</syntaxhighlight>
 +
 
 +
===HDMI resolution and overscan setting ===
 +
If an HDMI display device is connected, go to Android Settings -> Display -> Advanced -> HDMI & Rotation to set it up.
 +
::{| class="wikitable"
 +
|-
 +
|HDMI Resolution || The default is Auto, you can manually set the display resolution, up to 4K resolution
 +
|-
 +
|Screen Zoom || click the four arrow buttons in the middle to adjust the zoom
 +
|-
 +
|Display Rotation || for horizontal and vertical screen switching
 +
|}
 +
 
 +
===Screen rotation===
 +
go to Android Settings -> Display -> Advanced -> HDMI & Rotation to set it up.<br /><br />
 +
Use the following command in shell to test screen rotation (Settings not saved):<br />
 +
<syntaxhighlight lang="bash">
 +
wm rotation 90
 +
</syntaxhighlight>
 +
 
 +
===Hide Navigation bar===
 +
Enter Settings -> Accessibility, Turn on immersive mode, and then open an Android application, For example: Lightning, it will be in full screen mode.
 +
 
 +
===Switch audio output channel ===
 +
You can configure the audio output to the HDMI or headphone jack, Setting interface entry method: Android Settings -> Accessibility -> Force audio output.
 +
If the Force audio output menu item is gray, that is, it is in an unselectable state, the hardware you are using will automatically detect the headphone plug-in status and automatically switch the audio channel without setting.
 +
 
 +
===Adjust the volume of the recording ===
 +
1) First use the amix command to adjust the volume of the recording through the serial port or the adb shell with root privileges, for example:
 +
<syntaxhighlight lang="bash">
 +
Amix "IN2 Boost"
 +
Amix "ADC Capture Volume"
 +
</syntaxhighlight>
 +
The above command is used to view the current settings. <br />
 +
2) After debugging, modify the value of the corresponding configuration item in the rt5651_main_mic_capture_controls array in the hardware/rockchip/audio/tinyalsa_hal/codec_config/rt5651_config.h file, compile the Android source code and test it.
 +
 
 +
===Custom logo and boot animation===
 +
====On/Off====
 +
Change:<br />
 +
BOOT_SHUTDOWN_ANIMATION_RINGING := false<br />
 +
to:<br />
 +
BOOT_SHUTDOWN_ANIMATION_RINGING := true<br />
 +
in device/rockchip/common/BoardConfig.mk file.<br />
 +
====Boot animation====
 +
Create or replace the following files in the Android source code directory:<br />
 +
kernel/logo.bmp<br />
 +
kernel/logo_kernel.bmp<br />
 +
device/rockchip/common/bootshutdown/bootanimation.zip<br />
 +
====Shutdown animation====
 +
Create or replace the following files in the Android source code directory:<br />
 +
device/rockchip/common/bootshutdown/shutdownanimation.zip<br />
 +
====How to make animation====
 +
Please refre to:http://blog.sina.com.cn/s/blog_4960586c0100vu5v.html<br />
 +
 
 +
===Remove Google Framework===
 +
If you don't need to use the google service, you can delete the Google framework to save system resources by deleting the following directory in the Android source code and recompiling Android:<br />
 +
vendor/google<br />

Latest revision as of 02:46, 4 August 2023

1 Work with Android 8.1

FriendlyElec provides a full Android8.1 BSP for {{{1}}}. The source code is hosted at gitlab.com and is open source. The BSP supports GPU and VPU hardware acceleration.

1.1 Connect MIPI Camera to {{{1}}}

FriendlyElec developed a MIPI camera CAM1320 for board and it works under Android. You can use this camera to take pictures and record video. The operation is straightforward. You just need to connect the camera at your board's MIPI interface, boot your board to Android and start Android's camera app.


1.2 Use dual MIPI camera preview and video

Download the sample source code below from github and compile and run it:

git clone https://github.com/friendlyarm/Dual-Camera.git -b working-branch

After the application is installed, you need to Set Android permissions to make the demo run normally. The method is enter system ui: Settings -> Apps & notifications -> Dual Camera -> Permissions, Select the following permissions:

Camera
Microphone
Storage

The gui looks like this:
Android dual camera demo.jpg
Click the "CAPTURE VIDEO" button on the gui to record the video (two cameras at the same time), and the video file will be saved to the following location.:/storage/emulated/0/Download/dualcamera_h264.mp4. Known issue
Recorded video file will play faster than normal, may need to adjust some parameters of mediacodec.

1.3 Change system language

The default system language of Android system is English. For example, if we want to set it to Chinese, the steps are as follows: 1) Go to Android settings:Settings -> System -> Languages & Input -> Languages;
2)Click "Add a language", Select "简体中文", and then select "中国";
3) At this time, there will be two languages, Chinese and English. Drag the Chinese item to the top of the list. Note that if you are using a mouse, drag it by placing the mouse pointer on the right side of the list item. On the icon and then press the middle mouse button to drag;

1.4 Android8.1 hardware access

You can use the FriendlyThings SDK to access and control hardware resources on the motherboard in the Android App, such as Uart, SPI, I2C, GPIO and other interfaces. For details, please refer to the following two documents.:

1.5 Android Neural Networks SDK Sample

Android8.1 BSP comes pre-installed with Rockchip's Android NN SDK for Android 8.1, supporting GPU acceleration.。
Sample program for Android NN pre-installed in the Android8 firmware we provide:TfLiteCameraDemo,This is a MobileNet classifier demo using Rockchip AndroidNN GPU acceleration,The camera module is required to be connected to the motherboard during operation. The USB camera and CSI camera are supported,The sample program is launched by clicking the "TfLiteCameraDemo" icon on the home page. The running effect is as follows:

TfLiteCameraDemo.png
For a detailed description of the Android NN SDK, you can refer to this document:[RK3399_Android8.1_AndroidNN_SDK_V1.0_20180605发布说明.pdf]
TfLiteCameraDemo sample source code download link:[TfLiteCameraDemo source code]

1.6 Using the adb

1. The first time you start the system, if you need to change the system files, you need to turn off security verification (note: apk installation does not need to be closed), and restart after turning off security verification

adb root
adb disable-verity
adb reboot

2. After restarting, get root and remount /system to enable write permissions

adb root
adb remount

3. Upload a file

adb push example.txt /system/

1.7 HDMI resolution and overscan setting

If an HDMI display device is connected, go to Android Settings -> Display -> Advanced -> HDMI & Rotation to set it up.

HDMI Resolution The default is Auto, you can manually set the display resolution, up to 4K resolution
Screen Zoom click the four arrow buttons in the middle to adjust the zoom
Display Rotation for horizontal and vertical screen switching

1.8 Screen rotation

go to Android Settings -> Display -> Advanced -> HDMI & Rotation to set it up.

Use the following command in shell to test screen rotation (Settings not saved):

wm rotation 90

1.9 Hide Navigation bar

Enter Settings -> Accessibility, Turn on immersive mode, and then open an Android application, For example: Lightning, it will be in full screen mode.

1.10 Switch audio output channel

You can configure the audio output to the HDMI or headphone jack, Setting interface entry method: Android Settings -> Accessibility -> Force audio output. If the Force audio output menu item is gray, that is, it is in an unselectable state, the hardware you are using will automatically detect the headphone plug-in status and automatically switch the audio channel without setting.

1.11 Adjust the volume of the recording

1) First use the amix command to adjust the volume of the recording through the serial port or the adb shell with root privileges, for example:

Amix "IN2 Boost"
Amix "ADC Capture Volume"

The above command is used to view the current settings.
2) After debugging, modify the value of the corresponding configuration item in the rt5651_main_mic_capture_controls array in the hardware/rockchip/audio/tinyalsa_hal/codec_config/rt5651_config.h file, compile the Android source code and test it.

1.12 Custom logo and boot animation

1.12.1 On/Off

Change:
BOOT_SHUTDOWN_ANIMATION_RINGING := false
to:
BOOT_SHUTDOWN_ANIMATION_RINGING := true
in device/rockchip/common/BoardConfig.mk file.

1.12.2 Boot animation

Create or replace the following files in the Android source code directory:
kernel/logo.bmp
kernel/logo_kernel.bmp
device/rockchip/common/bootshutdown/bootanimation.zip

1.12.3 Shutdown animation

Create or replace the following files in the Android source code directory:
device/rockchip/common/bootshutdown/shutdownanimation.zip

1.12.4 How to make animation

Please refre to:http://blog.sina.com.cn/s/blog_4960586c0100vu5v.html

1.13 Remove Google Framework

If you don't need to use the google service, you can delete the Google framework to save system resources by deleting the following directory in the Android source code and recompiling Android:
vendor/google