Detailed explanation of customization of android system

  • 2021-09-12 02:19:45
  • OfStack

Simple and basic customized android system, so that the first boot on the installation of system applications and pre-installed applications, loading service tools and other files, boot startup screen, set the default input method, screen brightness and so on.

How to simply customize android system? There are two ways:

The first is to edit the system ROM using mushroom ROM assistant. Please use Baidu.

The second is to add compilation rules to the source code. Copy the files in the device project to the compiled system.

Here introduces the second method, using the android4.4 system source code of Quan Zhi T3.

1. Add our own compilation items

Modify the compilation file /android/device/softwinner/t3-p1/t3_p1.mk to add the following sentence

$(call inherit-product-if-exists, device/softwinner/t3-p1/test/test.mk)

2. Edit document device/softwinner/t3-p1/test/test. mk.


PRODUCT_COPY_FILES += \
	$(call find-copy-subdir-files,*,$(LOCAL_PATH)/apk,system/preinstall)	\
	$(call find-copy-subdir-files,*,$(LOCAL_PATH)/systemapk,system/app)	\
	$(call find-copy-subdir-files,*,$(LOCAL_PATH)/music,data/test/music)	\
	$(call find-copy-subdir-files,*,$(LOCAL_PATH)/video,data/test/video)	\
	$(call find-copy-subdir-files,*,$(LOCAL_PATH)/pic,data/test/pic)
	
PRODUCT_COPY_FILES += \
 device/softwinner/t3-p1/test/test_init:system/bin/test_init	\
 device/softwinner/t3-p1/test/gocsdk:system/bin/gocsdk
 
# Note: 1 , No. 1 Secondary startup, copying files and installing applications are slow, and you need to wait after entering the system; 
#	2 , system Folder user cannot write, so it cannot be deleted; 
#	3 Pre-installed applications can be uninstalled and no longer appear after uninstallation; 
#	4 If you need to install again, delete the  /data/system.notfristrun File, and then restart 

1 Installation system application and 1 general application

PRODUCT_COPY_FILES is to copy the file to the system, the front is the storage path, followed by the target path, $(call find-copy-subdir-files, ***) writing can realize the copy of the folder.

Create apk, systemapk, music, video, pic and other folders under test folder.

system/preinstall is pre-installed software, placed APK files, can be uninstalled.

system/app is a system application. APK files are placed and cannot be uninstalled.

Because in device/softwinner/t3-p1/fstab. sun8iw11p1 the/dev/block/name/ext/ext/ext4 ro wait indicates that the/system is mounted in ro read-only mode. ROOT is to remount and modify the read and write permissions of this folder. Non-ROOT files can be copied to the inside to achieve non-deletion of files.

Note that copying the file will check whether it is an APK file, which needs to be commented out in android/build/core/makefile.


#define check-product-copy-files
#$(if $(filter %.apk, $(1)),$(error \
# Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))
#endef

2 Load service tools and other files

Then analyze the test. mk file. The following three sentences are copying music, video and pic to the target android system. It can also be other files. Realize the customization of files.

The next two sentences are the added tools, one of which sets the default shell instruction, and the other is the tool given by Bluetooth vendor.

3 Set the default input method

One way to set the default input method is to create a service console and input settings command to set the default input method when starting up. The service is then run once when/android\/device/softwinner/t3-p1/init. rc files are loaded.

Among them, test_init adds the instruction of setting the default input method.


#!/system/bin/sh
settings put secure default_input_method com.google.android.inputmethod.pinyin/.PinyinIME

init. rc join service


service test_init /system/bin/sh /system/bin/test_init
	class core
	user root
	group root system
	oneshot

google Pinyin input method app should be placed in the pre-installed software or system application folder.

app is also mounted, which is not enough, because the permissions are not enough, so you need to modify the permissions of test_init and add them in the init. rc file


chmod 777 /system/bin/test_init

Note: Another way to set the default input method is to modify the default parameters. Modify the defaults. xml file/device/softwinner/t3-p1/overlay/frameworks/base/packages/SettingsProvider/res/values, please refer to Baidu for details.

The settings directive currently supports a limited number of options, although there are many options for viewing the setting database, but it is not easy to use.

The key point is, to modify test_init, you can enter the shell instruction you need before the android system is put into operation. Adding a startup service to the android system specifies how to add a startup tool or service.

4 Startup screen and music

Quan Zhi T3 android4.4 system source boot screen, boot music in android/device/softwinner/t3-p1/media


Related articles: