Template:RK3399-Android8

From FriendlyELEC WiKi
Revision as of 10:39, 12 March 2019 by Tzs (Talk | contribs) (updated by API)

Jump to: navigation, search

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 使用双MIPI摄像头预览与录像

从github下载以下示例源代码,并用 Android studio 编译并运行:

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

应用安装后,需要设置Android权限才能让程序正常运行,方法是在开发板的Android系统里进入 Settings -> Apps & notifications -> Dual Camera -> Permissions 钩选以下权限:

Camera
Microphone
Storage

最终运行效果如下:
[TODO]
点击界面上的 "CAPTURE VIDEO" 按钮即可录制视频(同时录两个摄像头),录制的视频保存到以下位置:/storage/emulated/0/Download/dualcamera_h264.mp4,电脑上可以用以下adb命令下载到本地:

adb pull /storage/emulated/0/Download/dualcamera_h264.mp4

已知问题
录制的视频文件,播放时会比正常的快,可能需要调整mediacodec的某些参数


1.3 切换系统语言

Android系统默认的系统语言是英文,比如我们要设置为中文,步骤如下: 1) 进入 Android 设置:Settings -> System -> Languages & Input -> Languages;
2)点击"Add a language", 在列表中选择 "简体中文",再选择 "中国";
3) 这时列表中会有中文和英文两种语言,拖动中文那一项到列表的最上面即可,注意,如果你使用的是鼠标,拖动的方法是:将鼠标指针放在列表项右边的图标上,然后按下鼠标中键来拖动;

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 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.10 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.11 Custom logo and boot animation

1.11.1 On/Off

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

1.11.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.11.3 Shutdown animation

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

1.11.4 How to make animation

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

1.12 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