English | 中文文档
- Instead of changing the project's directory structure, we add additional configurations and dependencies to build Gradle environment support
- Scripts are used to remove some attributes and fields that AS does not support, and then use git local ignore
- The running effect will still be slightly different from the native one, which is due to the style differences caused by the failure to reference private attributes after being separated from the source code (as shown below)
- Gradle 6.5
- JDK version >= 8
# Setup build environment
gradle wrapper
# Execute pre-filter task
./gradlew :Filter:run
# Build and package
./gradlew assemble
- Android Studio 4.2.2 & JDK version >= 8
Step 2: Execute Build APK in Android Studio, then push the apk to the SystemUI directory on the device
adb push SystemUI.apk /system/system_ext/priv-app/SystemUI/
adb shell killall com.android.systemui
adb reboot
// AOSP/android-11/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-header.jar
compileOnly files('libs/framework.jar')
// AOSP/android-11/out/soong/.intermediates/libcore/core-all/android_common/javac/core-all.jar
compileOnly files('libs/core-all.jar')
// AOSP/android-11/prebuilts/sdk/current/androidx/m2repository/androidx/preference/preference/1.2.0-alpha01/preference-1.2.0-alpha01.aar
implementation(name: 'preference-1.2.0-alpha01', ext: 'aar')
ps: androidx.preference is not easy to reference in the following way, so it is replaced with static
## implementation 'androidx.preference:preference:1.2.0-alpha01'
// 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')
// AOSP/android-11/out/soong/.intermediates/frameworks/base/packages/SystemUI/plugin/SystemUIPluginLib/android_common/javac/SystemUIPluginLib.jar
implementation files('libs/SystemUIPluginLib.jar')
// AOSP/android-11/out/soong/.intermediates/frameworks/base/packages/SystemUI/shared/SystemUISharedLib/android_common/javac/SystemUISharedLib.jar
implementation files('libs/SystemUISharedLib.jar')
// AOSP/android-11/out/soong/.intermediates/frameworks/base/libs/WindowManager/Shell/WindowManager-Shell/android_common/javac/WindowManager-Shell.jar
implementation files('libs/WindowManager-Shell.jar')
// AOSP/android-11/out/soong/.intermediates/frameworks/base/packages/SystemUI/SystemUI-tags/android_common/javac/SystemUI-tags.jar
implementation files('libs/SystemUI-tags.jar')
// AOSP/android-11/out/soong/.intermediates/frameworks/base/packages/SystemUI/SystemUI-proto/android_common/javac/SystemUI-proto.jar
implementation files('libs/SystemUI-proto.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')
Import the code from the specific path directly into the project as a Module dependency. During build, you can directly reference it through implementation project, or you can use gradle build to generate aar and place it in the libs folder.
// AOSP/android-11/frameworks/libs/systemui/iconloaderlib
implementation project(':iconloaderlib')
// AOSP/android-11/frameworks/opt/net/wifi/libs/WifiTrackerLib
implementation project(':WifiTrackerLib')
// AOSP/android-11/frameworks/base/packages/SettingsLib
implementation project(':SettingsLib:RestrictedLockUtils')
implementation project(':SettingsLib:AdaptiveIcon')
implementation project(':SettingsLib:HelpUtils')
implementation project(':SettingsLib:ActionBarShadow')
implementation project(':SettingsLib:AppPreference')
implementation project(':SettingsLib:SearchWidget')
implementation project(':SettingsLib:SettingsSpinner')
implementation project(':SettingsLib:LayoutPreference')
implementation project(':SettingsLib:ActionButtonsPreference')
implementation project(':SettingsLib:EntityHeaderWidgets')
implementation project(':SettingsLib:BarChartPreference')
implementation project(':SettingsLib:ProgressBar')
implementation project(':SettingsLib:RadioButtonPreference')
implementation project(':SettingsLib:DisplayDensityUtils')
implementation project(':SettingsLib:Utils')
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 platform.keystore -p 123456 -pk8 platform.pk8 -cert platform.x509.pem -alias platform
And add the following code to the gradle configuration:
signingConfigs {
platform {
storeFile file("platform.keystore")
storePassword '123456'
keyAlias 'platform'
keyPassword '123456'
}
}
buildTypes {
release {
debuggable false
minifyEnabled false
signingConfig signingConfigs.platform
}
debug {
debuggable true
minifyEnabled false
signingConfig signingConfigs.platform
}
}
git ls-files -v | grep '^h\ '
git update-index --assume-unchanged $path
git update-index --no-assume-unchanged $path
git ls-files -v | grep '^h' | awk '{print $2}' |xargs git update-index --no-assume-unchanged











