1. Overview¶
1.1. Scope of application¶
RK3399 Android7.1 Industry
RK3399 Android10
RK356X Android11
RK3588 Android12
For other Android versions, it is available for reference.
1.2. Modification method¶
For Android system customization, there are generally Temporary modification methods and Code modification methods.
Temporary modification method:Generally, the device can be operated through the debug serial port or ADB.
Code modification method:After modifying the code, you need to perform SDK compilation and firmware flashing.
Among them, SDK compilation or firmware flashing refer to WiKi tutorial。
1.3. Glossary¶
CPU_TYPE
:Indicates the main control chip, such as rk3288, rk3399, rk3399pro, rk356x, rk3588PRODUCT_TYPE
:Indicates the product type, such as rk3399_firefly, rk3399_firefly_aio, rk3399_firefly_aioc_ai
1.4. Custom description¶
For the customized content of the system, there will be some differences in Android12, Android11, Android10.0 and Android7.1 Industry. This part of the content will be distinguished, and the undifferentiated content indicates compatibility.
2. Boot logo animation modification¶
2.1. The first stage¶
2.1.1. Code modification method¶
Prepare the logo
Make a new logo.bmp
The image attributes are the same as the default logo.bmp, otherwise an upside-down exception will occur
Both width and height are even numbers
Replace logo
Replace
kernel/logo.bmp
2.2. Second stage¶
2.2.1. Temporary modification method¶
Prepare bootanimation.zip
Prepare png file
Both width and height are even numbers
Prepare desc.txt file, such as
800 1280 30 p 0 0 part0
800 1280 30
Meaning: the first two numbers represent the pixel width and height of the picture, 30 represents the number of frames, which is the number of pictures played in 1 secondp 0 0 part0
Meaning: p stands for flag bit, 0 stands for infinite loop, 0 stands for the interval time between stages is 0, part0 stands for the corresponding folderdesc.txt text format: Unix+UTF-8
Make bootanimation.zip
Compressed into a zip file in storage method
Push bootanimation.zip
adb shell setprop persist.sys.root_access 3 adb root adb remount adb push bootanimation.zip system/media/bootanimation.zip adb shell reboot
2.2.2. Code modification method¶
Prepare bootanimation.zip
Put the prepared
bootanimation.zip
into thedevice/rockchip/CPU_TYPE/
directory
In the
device/rockchip/CPU_TYPE/device.mk
file, add the following content:PRODUCT_COPY_FILES += \ device/rockchip/CPU_TYPE/bootanimation.zip:/system/media/bootanimation.zip
3. Default screen orientation modification¶
3.1. Temporary modification method¶
System readable and writable
adb shell setprop persist.sys.root_access 3 adb root adb remount
Modify or add attribute values
Android7.1
In the
/system/build.prop
file, modify or add the value ofro.sf.hwrotation
0:Horizontal screen
90:Portrait
180:Reverse landscape
270:Reverse portrait
Android10 and above
In the
vendor/build.prop
file, modify or add the value ofro.surface_flinger.primary_display_orientation
ORIENTATION_0:Horizontal screen
ORIENTATION_90:Portrait
ORIENTATION_180:Reverse landscape
ORIENTATION_270:Reverse portrait
System restart
adb shell reboot
3.2. Code modification method¶
Android 7.1:
In the file
device/rockchip/CPU_TYPE/PRODUCT_TYPE/system.prop
, modify the value ofro.sf.hwrotation
Android10 and above:
In the file
device/rockchip/CPU_TYPE/BoardConfig.mk
, modify the value ofSF_PRIMARY_DISPLAY_ORIENTATION
0:Horizontal screen
90:Portrait
180:Reverse landscape
270:Reverse portrait
Delete build.prop in the out directory
rm out/target/product/PRODUCT_TYPE/obj/ETC/system_build_prop_intermediates/build.prop
4. Hide the status bar by default¶
4.1. Temporary modification method¶
In the Settings, just enable the option.
Settings
–>Display
–>Always hide the status bar
4.1.1. Code modification method¶
The revised content is as follows
diff --git a/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml b/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml index ba87da7ec4..e32c9699f9 100644 --- a/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml +++ b/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml @@ -12,7 +12,7 @@ <!-- should show the hidebar button default --> <bool name="def_hidebar_button_show">true</bool> <!-- always hide statusbar --> - <bool name="def_always_hide_bar">false</bool> + <bool name="def_always_hide_bar">true</bool> <!-- will set DEFAULT_LAUNCHER in frist boot --> <string name="def_default_launcher" translatable="false"></string>
5. Several ways of setting built-in APP¶
5.1. Code modification method¶
App folders can be added under the vendor
directory
5.1.1. Not uninstallable¶
Refer to vendor/firefly/fireflyapi
Contents in
Android.mk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := firefly_sdkapi_demo LOCAL_MODULE_CLASS := APPS LOCAL_MODULE_TAGS := optional LOCAL_BUILT_MODULE_STEM := package.apk LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) #LOCAL_PRIVILEGED_MODULE := LOCAL_CERTIFICATE := platform #LOCAL_OVERRIDES_PACKAGES := LOCAL_SRC_FILES := $(LOCAL_MODULE).apk #LOCAL_REQUIRED_MODULES := #LOCAL_PREBUILT_JNI_LIBS := include $(BUILD_PREBUILT)
LOCAL_CERTIFICATE := platform
Meaning: APK signature uses system signatureLOCAL_PRIVILEGED_MODULE
If not set or set to false, the installation location is/system/app
Contents in
fireflyapi.mk
PRODUCT_PACKAGES += \ firefly_sdkapi_demo PRODUCT_COPY_FILES += \ vendor/firefly/fireflyapi/fireflyapi:system/bin/fireflyapi \ vendor/firefly/fireflyapi/fireflyapi.jar:system/framework/fireflyapi.jar
5.1.2. Uninstallable¶
mkdir
device/rockchip/CPU_TYPE/PRODUCT_TYPE/preinstall_del
copy apk to
device/rockchip/CPU_TYPE/PRODUCT_TYPE/preinstall_del
build android
6. Setting of built-in default input method¶
6.1. Code modification method¶
Get the input method package name
adb shell settings get secure enabled_input_methods com.android.inputmethod.latin/.LatinIME:com.iflytek.inputmethod.google/com.iflytek.inputmethod.FlyIME:com.google.android.inputmethod.pinyin/.PinyinIME adb shell settings get secure default_input_method com.iflytek.inputmethod.google/com.iflytek.inputmethod.FlyIME
Modify the code as follows
diff --git a/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml b/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml index ba87da7ec4..7ed79b4c15 100644 --- a/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml +++ b/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml @@ -19,4 +19,7 @@ <!-- if 1 ,reboot will reset DEFAULT_LAUNCHER --> <bool name="def_lock_default_launcher">false</bool> + + <string name="enabled_input_methods" translatable="false">com.android.inputmethod.latin/.LatinIME:com.iflytek.inputmethod.google/com.iflytek.inputmethod.FlyIME:com.google.android.inputmethod.pinyin/.PinyinIME</string> + <string name="def_input_method" translatable="false">com.iflytek.inputmethod.google/com.iflytek.inputmethod.FlyIME</string> </resources> diff --git a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index cac5f800bd..f705a895b4 100644 --- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -2474,6 +2474,11 @@ class DatabaseHelper extends SQLiteOpenHelper { stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" + " VALUES(?,?);"); + loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS, + R.string.enabled_input_methods); + loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD, + R.string.def_input_method); + loadStringSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, R.string.def_location_providers_allowed);
7. Delete built-in apps¶
7.1. Temporary modification method¶
adb shell setprop persist.sys.root_access 3
adb root
adb remount
adb shell rm -r system/app/APK_NAME/
adb shell reboot
or
adb shell setprop persist.sys.root_access 3
adb root
adb remount
adb shell rm -r system/priv-app/APK_NAME/
adb shell reboot
7.2. Code modification method¶
If the application has source code, comment out the
include $(BUILD_PACKAGE)
in theAndroid.mk
file of the application source codeIf the application is an APK file and has
Android.mk
, comment outinclude $(BUILD_PREBUILT)
in theAndroid.mk
file
8. Startup application¶
8.1. Code modification method¶
8.1.1. Non-launcher¶
Add the following content to the
AndroidManifest.xml
in the application source codepackage="com.example.testfile" android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver android:name="com.example.testfile.BootBroadcastReceiver" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </receiver>
Add the code for broadcast reception
BootBroadcastReceiver.java
, such aspackage com.example.testfile; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import android.widget.Toast; public class BootBroadcastReceiver extends BroadcastReceiver{ private static final String TAG = "sjft"; public static final String EXTRA_VOLUME_STATE = "android.os.storage.extra.VOLUME_STATE"; public static final int STATE_UNMOUNTED = 0; public static final int STATE_CHECKING = 1; public static final int STATE_MOUNTED = 2; public static final int STATE_MOUNTED_READ_ONLY = 3; public static final int STATE_FORMATTING = 4; public static final int STATE_EJECTING = 5; public static final int STATE_UNMOUNTABLE = 6; public static final int STATE_REMOVED = 7; public static final int STATE_BAD_REMOVAL = 8; @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String action = intent.getAction(); if (action.equals("android.intent.action.PACKAGE_REPLACED")){ String packageName = intent.getData().getSchemeSpecificPart(); Log.v(TAG,"BootBroadcastReceiver packageName:"+packageName); if(context.getPackageName().equals(packageName)){ Intent launchIntent = new Intent(context, MainActivity.class);//Restart the app //If you don’t want to write the startup Activity, you can also get the default startup Activity by the following method //Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName); launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(launchIntent); } } else if (action.equals("android.intent.action.BOOT_COMPLETED")){ String packageName = intent.getData().getSchemeSpecificPart(); Log.v(TAG,"BootBroadcastReceiver packageName:"+packageName); if(context.getPackageName().equals(packageName)){ Intent launchIntent = new Intent(context, MainActivity.class);//Restart the app //If you don’t want to write the startup Activity, you can also get the default startup Activity by the following method //Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName); launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(launchIntent); } } } }
app system signature (signature file)
start app once
8.1.2. Launcher¶
Delete or not compile the Launcher application in the SDK
Add the following content to the first activity started in
AndroidManifest.xml
in the application source code<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
9. Modification of the default language¶
The language support list can be viewed in build/target/product/languages_full.mk
.
9.1. Temporary modification method¶
System readable and writable
adb shell setprop persist.sys.root_access 3 adb root adb remount
Modify the value of
ro.product.locale
in the/system/build.prop
file (Android10 and above:/vendor/build.prop
)en-US: English
zh-CN: Chinese
System restart
adb shell reboot
9.2. Code modification method¶
Modify the value of
PRODUCT_LOCALES
inbuild/target/product/full_base.mk
Chinese
PRODUCT_LOCALES := zh_CN
Delete build.prop in the out directory
rm out/target/product/PRODUCT_TYPE/obj/ETC/system_build_prop_intermediates/build.prop
10. Modification of the default time zone¶
The time zone support list can be viewed in frameworks/base/packages/SettingsLib/res/xml/timezones.xml
.
10.1. Temporary modification method¶
System readable and writable
adb shell setprop persist.sys.root_access 3 adb root adb remount
Modify the value of
persist.sys.timezone
in the/system/build.prop
file (Android10 and above:/vendor/build.prop
)Asia/Shanghai
:UTC+8
System restart
adb shell reboot
10.2. Code modification method¶
Android7.1/Android10
In the file
device/rockchip/CPU_TYPE/PRODUCT_TYPE/system.prop
, modify the value ofpersist.sys.timezone
Asia/Shanghai
:UTC+8
Android11 and above
Add the following content in the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/PRODUCT_TYPE.mk
file:
PRODUCT_PROPERTY_OVERRIDES += persist.sys.timezone=Asia/Shanghai
Delete build.prop in the out directory
rm out/target/product/PRODUCT_TYPE/obj/ETC/system_build_prop_intermediates/build.prop
11. Default ROOT¶
11.1. Temporary modification method¶
adb shell setprop persist.sys.root_access 3
11.2. Code modification method¶
Android7.1/Android10.0
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/system.prop
file, add the following content:
persist.sys.root_access=3
Android11 and above
Add the following content in the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/PRODUCT_TYPE.mk
file:
PRODUCT_PROPERTY_OVERRIDES += persist.sys.root_access=3
Delete build.prop in the out directory
rm out/target/product/PRODUCT_TYPE/obj/ETC/system_build_prop_intermediates/build.prop
12. The default system time is 24 hours¶
12.1. Code modification method¶
diff --git a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
index f95ecc6535..06055dba7b 100644
--- a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
+++ b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -244,4 +244,6 @@
<!-- should show the screenshot button default -->
<integer name="def_screenshot_button_show">0</integer>
+<!-- value 12/24/null corresponds to setting 12/24/auto -->
+ <string name="def_time_12_24" translatable="false">24</string>
</resources>
diff --git a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index b3ff9d08a8..ebdd5d3637 100644
--- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -2261,6 +2261,9 @@ class DatabaseHelper extends SQLiteOpenHelper {
private void loadSystemSettings(SQLiteDatabase db) {
......
+
+ loadStringSetting(stmt, Settings.System.TIME_12_24,
+ R.string.def_time_12_24);
13. Open network ADB by default¶
13.1. Temporary modification method¶
13.1.1. Way one¶
Android7.1
adb shell setprop persist.internet.adb.enable 1
Android10/Android11/Android12
adb shell setprop persist.internet_adb_enable 1
13.1.2. Way two¶
Open
ADB over network
Settings
–>Developer options
–>ADB over network
13.2. Code modification method¶
Android7.1/Android10
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/system.prop
file, add the following content:
persist.internet.adb.enable=1
Android10
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/system.prop
file, add the following content:
persist.internet_adb_enable=1
Android11/Android12
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/PRODUCT_TYPE.mk
file, add the following content:
PRODUCT_PROPERTY_OVERRIDES += persist.internet_adb_enable=1
Delete build.prop in the out directory
rm out/target/product/PRODUCT_TYPE/obj/ETC/system_build_prop_intermediates/build.prop
14. The default setting of OTG USB3.0 is devices mode¶
14.1. Temporary modification method¶
adb shell setprop persist.usb.mode 2
14.2. Code modification method¶
Android7.1/Android10
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/system.prop
file, add the following content:
persist.usb.mode=2
Android11/Android12
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/PRODUCT_TYPE.mk
file, add the following content:
PRODUCT_PROPERTY_OVERRIDES += persist.usb.mode=otg
Delete build.prop in the out directory
rm out/target/product/PRODUCT_TYPE/obj/ETC/system_build_prop_intermediates/build.prop
15. Turn on or turn off the installation of unknown apps¶
15.1. Code modification method¶
15.1.1. Android 7.1¶
In the frameworks/base/packages/SettingsProvider/res/values/defaults.xml
file, modify the value of def_install_non_market_apps
.
false : Close
true : Open
15.1.2. Android10 and above¶
In Android10, the permanent authorization option of “Allow Unknown Sources” to install applications has been deleted. The switch is no longer found in the system settings. Google will modify the permanent authorization to a separate authorization each time. When the user installs a third party each time The source of the Android software requires manual confirmation of the software permissions.
16. Turn touch sound on or off¶
16.1. Code modification method¶
In the frameworks/base/packages/SettingsProvider/res/values/defaults.xml
file, modify the value of def_sound_effects_enabled
.
false : Close
true : Open
17. Modify the desktop layout¶
17.1. Code modification method¶
After the device is turned on, the program shortcuts, small plug-ins, shortcut navigation bar (HotSeat) and folder modification methods that are loaded on the desktop by default.
For details, please refer to the post of the open source community。
18. Configure USB camera front or rear¶
The default is front.
18.1. Temporary modification method¶
Front
adb shell setprop persist.sys.uvc.facing front
Back
adb shell setprop persist.sys.uvc.facing back
18.2. Code modification method¶
Android7.1/Android10
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/system.prop
file, add the following content:Front
persist.sys.uvc.facing=front
Back
persist.sys.uvc.facing=back
Android11/Android12
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/PRODUCT_TYPE.mk
file, add the following content:Front
PRODUCT_PROPERTY_OVERRIDES += persist.sys.uvc.facing=front
Back
PRODUCT_PROPERTY_OVERRIDES += persist.sys.uvc.facing=back
Delete build.prop in the out directory
rm out/target/product/PRODUCT_TYPE/obj/ETC/system_build_prop_intermediates/build.prop
19. Configure 4K UI¶
19.1. Code modification method:¶
19.1.1. Platform(RK3399/RK3568)¶
Android7.1
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/system.prop
file, add the following content:
persist.sys.framebuffer.main=3840x2160@25
Android10.0 and above
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/PRODUCT_TYPE.mk
file, add the following content:
PRODUCT_PROPERTY_OVERRIDES += persist.vendor.framebuffer.main=3840x2160@25
NOTE: The 4K UI occupies a large amount of system resources and supports a maximum of about 4K25Hz. You are not recommended to use the 4K UI. If you just want to play it 4K video or view 4K pictures, it can not need to configure 4K UI, the system’s default video player and picture browser can support.
19.1.2. Platform(RK3588)¶
Android12.0 and above
In the
device/rockchip/CPU_TYPE/PRODUCT_TYPE/PRODUCT_TYPE.mk
file, add the following content:
PRODUCT_PROPERTY_OVERRIDES += persist.vendor.framebuffer.main=3840x2160@60
NOTE:RK3588 has strong performance and supports 4K UI at 60Hz.