English | 中文文档

Launcher3 from android-11.0.0_r38

Building Launcher3 outside AOSP source in Android Studio

Since Android 11, SystemUI removed the recents task functionality, and the related work has been implemented by Launcher3's quickstep. This document records the configuration work for the entire Launcher3 project in Android Studio.

Support Notes

@PATH: src/com/android/launcher3/model/data/ItemInfo.java
*********************************************************

// import com.android.launcher3.logger.LauncherAtom.TaskForegroundContainer;

*********************************************************
// case CONTAINER_TASKFOREGROUND:
//     return ContainerInfo.newBuilder()
//             .setTaskForegroundContainer(TaskForegroundContainer.getDefaultInstance())
//             .build();

Building with Command Line

Environment Requirements

# Setup build environment
gradle wrapper

# Build and package
./gradlew assemble

Building in Android Studio

Execute Build APK in Android Studio, then push the apk to the Launcher3 directory on the device

adb push Launcher3QuickStep.apk /system/system_ext/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk

adb shell killall com.android.launcher3

PS: The first push may not start properly, you need to reboot the device.

adb reboot

PS: You can also install directly

adb install Launcher3QuickStep.apk

PS: Other Flavors versions are also supported

Build Steps

Step 1: Add Static Dependencies

@framework.jar:
// AOSP/android-11/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-header.jar
compileOnly files('libs/framework.jar')

avatar

@launcher_log_protos_lite.jar:
// AOSP/android-11/out/soong/.intermediates/packages/apps/Launcher3/launcher_log_protos_lite/android_common/combined/launcher_log_protos_lite.jar
implementation files("libs/launcher_log_protos_lite.jar")

avatar

@libprotobuf-java-nano.jar:
// AOSP/android-11/out/soong/.intermediates/external/protobuf/libprotobuf-java-nano/android_common/javac/libprotobuf-java-nano.jar
implementation files("libs/libprotobuf-java-nano.jar")

avatar

@PluginCoreLib.jar:
// AOSP/android-11/out/soong/.intermediates/frameworks/base/packages/SystemUI/plugin_core/PluginCoreLib/android_common/javac/PluginCoreLib.jar
implementation files("libs/PluginCoreLib.jar")

avatar

@SystemUI-statsd.jar:
// AOSP/android-11/out/soong/.intermediates/frameworks/base/packages/SystemUI/shared/SystemUI-statsd/android_common/javac/SystemUI-statsd.jar
implementation files("libs/SystemUI-statsd.jar")

avatar

@SystemUISharedLib.jar:
// AOSP/android-11/out/soong/.intermediates/frameworks/base/packages/SystemUI/shared/SystemUISharedLib/android_common/javac/SystemUISharedLib.jar
implementation files("libs/SystemUISharedLib.jar")

avatar

Step 2: Add Module

Import the code from the specific path directly into the project as a Module dependency. You can reference it directly through implementation project during build, or you can use gradle build to generate an aar and place it in the libs folder as a static package.
@iconloaderlib:
// AOSP/android-11/frameworks/libs/systemui/iconloaderlib
implementation project(':IconLoader')

avatar

Generate testkey.keystore Default Signature

Find the signing certificates in the AOSP/android-11/build/target/product/security path and use keytool-importkeypair to generate the keystore. Execute the following command:

./keytool-importkeypair -k testkey.keystore -p 123456 -pk8 testkey.pk8 -cert testkey.x509.pem -alias testkey  

And add the following code to the gradle configuration:

    signingConfigs {
        testkey {
            storeFile file("testkey.keystore")
            storePassword '123456'
            keyAlias 'testkey'
            keyPassword '123456'
        }
    }

    buildTypes {
        debug {
            minifyEnabled false
            signingConfig signingConfigs.testkey
        }
    }

Related Projects