系统桌面¶
本章节介绍如何定制 Android 系统桌面,适用于 A133、H618、A733、T527 以及 Rockchip 全系列平台。
源码路径¶
# a133
android/packages/apps/Launcher3/
# h618 tv
vendor/aw/homlet/package/TVLauncher
# t527 a733 rk && h618 tablet
packages/apps/Launcher3/
单编 APK¶
# rk 系列
./build.sh lunch
source build/envsetup.sh
lunch $TARGET_PRODUCT-$BUILD_VARIANT
make Launcher3QuickStepGo -j32
# t527
source build/envsetup.sh
lunch t527_demo_arm64-userdebug
m Launcher3QuickStepGo -j32
# a733
source build/envsetup.sh
lunch a733_demo_aiot_arm64-userdebug
m Launcher3QuickStepGo -j32
# a133
cd android/
source build/envsetup.sh
lunch ceres_c3-userdebug
m Launcher3QuickStepGo -j32
H618 桌面切换¶
H618 Android 12.0 通过 homlet.mk 中的 KICKPI_PALTFORM 变量切换 TV 和 Tablet 桌面,默认 TV 模式。在 BoardConfig.mk 或对应产品 mk 文件中添加:
--- a/device/softwinner/apollo/apollo_p2.mk
+++ b/device/softwinner/apollo/apollo_p2.mk
+
+KICKPI_PALTFORM := tablet
| 值 | 桌面 | 应用 |
|---|---|---|
tv(默认) |
TV 桌面 | TvLauncher、TvSettings |
tablet |
Tablet 桌面 | Launcher3QuickStep、Settings、SystemUI |
APK 路径:
- TV 桌面:
vendor/aw/homlet/package/TVLauncher - Tablet 桌面:
packages/apps/Launcher3/
关闭搜索框¶
--- a/android/packages/apps/Launcher3/src/com/android/launcher3/config/BaseFlags.java
+++ b/android/packages/apps/Launcher3/src/com/android/launcher3/config/BaseFlags.java
@@ -68,7 +68,7 @@ abstract class BaseFlags {
public static final boolean LAUNCHER3_PROMISE_APPS_IN_ALL_APPS = false;
// Enable moving the QSB on the 0th screen of the workspace
- public static final boolean QSB_ON_FIRST_SCREEN = true;
+ public static final boolean QSB_ON_FIRST_SCREEN = false;
public static final TogglableFlag EXAMPLE_FLAG = new TogglableFlag("EXAMPLE_FLAG", true,
"An example flag that doesn't do anything. Useful for testing");
桌面替换¶
1. 在你的应用的 AndroidManifest.xml 中添加 HOME 属性,使应用具备桌面应用的资格:
<activity android:name=".MainActivity" android:directBootAware="true">
<intent-filter>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
2. 在你的应用的 Android.mk 或 Android.bp 中添加桌面优先级覆盖,以及系统签名。
Android.mk 方式 — 在模块声明中添加:
--- a/vendor/rockchip/common/apps/TestLauncher/Android.mk
+++ b/vendor/rockchip/common/apps/TestLauncher/Android.mk
@@ - ... @@
+LOCAL_OVERRIDES_PACKAGES := \
+ Launcher2 \
+ Launcher3 \
+ Launcher3QuickStep \
+ Launcher3QuickStepGo
Android.bp 方式 — 在 android_app_import 中添加 overrides:
--- a/vendor/rockchip/common/apps/TestLauncher/Android.bp
+++ b/vendor/rockchip/common/apps/TestLauncher/Android.bp
@@ - ... @@
+ certificate: "platform"
+ privileged: true
+ overrides: [
+ "Launcher2",
+ "Launcher3",
+ "Launcher3QuickStep",
+ "Launcher3QuickStepGo",
+ ],
Warning
H618 (K2B / K2C) 还需额外覆盖 TvLauncher。