Skip to content

Auto-Start Applications

This chapter describes two methods for automatically launching a specified application after Android system boot: the property configuration method and the Launcher desktop method. The former specifies the application to start via a system property, while the latter achieves auto-start by setting the application as the home application.

Property Configuration

Tip

Property configuration is a custom feature of the KICKPI Android system (not supported in all system images; if it does not work, please contact KICKPI official technical support).

Users specify the application to auto-start by setting system properties, without replacing the system desktop.

ADB Configuration

Users can set system properties via ADB commands, and the specified application will start automatically at boot. This configuration only takes effect on the current device and will be lost after flashing or factory reset.

1. Install the application via USB drive, ADB, or other methods.

2. Open the application and run the ADB command to obtain the package name and activity class name of the current foreground application.

adb shell dumpsys window | grep mCurrentFocus

The output format is package_name/activity_class_name. For example, opening the Settings app will show com.android.settings/com.android.settings.Settings. (See the Appendix for more methods.)

3. Set the properties and reboot the device for the changes to take effect.

Note

packname: package name
classname: activity class name

adb shell
setprop persist.sys.bootAppPack $packname
setprop persist.sys.bootAppClass $classname
reboot

Example: Configure the package name and activity class name of the Settings app, and the Settings page will open automatically at boot.

adb shell
setprop persist.sys.bootAppPack com.android.settings
setprop persist.sys.bootAppClass com.android.settings.Settings
reboot

SDK Configuration

Users can configure the auto-start properties in the SDK source code and pre-install the application as a system app. After compilation and flashing, the application will start automatically at boot.

1. Pre-install the application in the SDK.

2. Obtain the package name and activity class name of the application. (See the Appendix for methods.)

3. Locate the pre-installation path in the corresponding SDK source code.

// rk-android13.0
device/rockchip/common/device.mk

// rk-android14.0
device/rockchip/common/device.mk

// h618-android12.0
vendor/aw/homlet/homlet.mk

// t527-android13.0
device/softwinner/saturn/t527-demo/device-common.mk

// a133-android10.0-v2.0
android/device/softwinner/ceres-c3/ceres_c3.mk

// a733-android13.0
device/softwinner/jupiter/a733-demo-aiot/device-common.mk

4. Taking the RK3568 K1 as an example, add the auto-start properties at the end of the compilation configuration .mk file (replace with your application's package name and class name):

--- a/device/rockchip/common/device.mk
+++ b/device/rockchip/common/device.mk
@@ -1030,6 +1030,10 @@ PRODUCT_PACKAGES += \
 PRODUCT_PROPERTY_OVERRIDES += \
     service.adb.tcp.port=5555

+PRODUCT_PROPERTY_OVERRIDES += \
+    persist.sys.bootAppPack=com.android.TestLauncher \
+    persist.sys.bootAppClass=com.android.TestLauncher.Activity
+

5. Compile the SDK and flash the image.

Launcher Desktop

After boot, the Android system automatically starts the application that has the HOME category attribute.

Application Configuration

1. Add the HOME category attribute to the AndroidManifest.xml of your application to qualify it as a home application:

<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. Recompile the application with the HOME attribute. Some applications may require system permissions; add system signatures if necessary.

3. Install the application, then go to Settings > Apps > Default apps > Home app and select your application.

4. Reboot the device and confirm that the custom desktop launches automatically at boot.

SDK Pre-installation as Home Application

Pre-install your custom application as the system home application in the SDK, overriding the default system launcher. After compilation and flashing, the device will boot directly into your custom desktop.

1. Pre-install the application in the SDK.

2. Add desktop priority override and system signing to your application's build script (Android.mk or Android.bp).

Android.mk — Add the following to the module declaration:

--- a/vendor/rockchip/common/apps/TestLauncher/Android.mk
+++ b/vendor/rockchip/common/apps/TestLauncher/Android.mk

+ LOCAL_CERTIFICATE := platform

+ LOCAL_OVERRIDES_PACKAGES := \
+    Launcher2 \
+    Launcher3 \
+    Launcher3QuickStep \
+    Launcher3QuickStepGo

Android.bp — Add overrides to the android_app_import block:

--- a/vendor/rockchip/common/apps/TestLauncher/Android.bp
+++ b/vendor/rockchip/common/apps/TestLauncher/Android.bp

+    certificate: "platform"

+    overrides: [
+        "Launcher2",
+        "Launcher3",
+        "Launcher3QuickStep",
+        "Launcher3QuickStepGo",
+    ],

Warning

For H618 (K2B / K2C), you also need to override TvLauncher.

3. Compile the SDK and flash the image.

Appendix

Obtaining Package Name and Activity Class Name

Using dumpsys window to get the package name and class name of the current foreground activity

Manually open the target application page and run:

adb shell dumpsys window | grep mCurrentFocus

Example: Get the package name and class name of the Settings app.

The output will contain something like com.android.settings/com.android.settings.Settings, where the part before / is the package name and the part after is the activity class name.

Using dumpsys package to get package name and activity class names

List installed applications:

adb shell pm list packages

View activity information for a specific application:

adb shell
dumpsys package $packname | grep -i activity

Example:

adb shell
dumpsys package com.android.settings | grep -i activity

Frequently Asked Questions

  • How to handle special permissions for the application?

Home applications are special applications. Adding special permissions may prevent the system from starting. You need to capture relevant application logs:

# logcat | grep LauncherTest
09-14 10:36:06.662  3826  3826 W PackageManager: Privileged permission android.permission.INSTALL_PACKAGES for package com.example.myapplication (/system/priv-app/LauncherTest) not in privapp-permissions allowlist
09-14 10:36:08.437  3826  3826 W PackageManager: Privileged permission android.permission.INSTALL_PACKAGES for package com.example.myapplication (/system/priv-app/LauncherTest) not in privapp-permissions allowlist
  • How to add special permissions in the SDK source code?

Based on the log, modify the android.permission.INSTALL_PACKAGES entry as shown below. Follow the same approach for other permission errors:

--- a/frameworks/base/data/etc/privapp-permissions-platform.xml
+++ b/frameworks/base/data/etc/privapp-permissions-platform.xml
@@ -550,4 +550,8 @@ applications that come with the platform
     <privapp-permissions package="com.android.calllogbackup">
         <permission name="com.android.voicemail.permission.READ_VOICEMAIL"/>
     </privapp-permissions>
+
+    <privapp-permissions package="com.example.myapplication">
+        <permission name="android.permission.INSTALL_PACKAGES"/>
+    </privapp-permissions>

Path on the board:

/etc/permissions/privapp-permissions-platform.xml
  • Compilation fails?

Compilation failures can manifest in various ways depending on the application, such as missing libraries or incorrect application paths.

General solution: Copy the compilation error logs to an AI assistant for analysis—this usually yields the correct solution. The issue is typically resolved by adding the appropriate configuration to Android.mk or Android.bp.