android系统开发修改桌面Launcher3代码编译安装验证

1.使用aidegen打开Launcher3项目

  • 1.1 首先整个aosp源代码编译成功过,自然也就是编译成功了aidegen工具。Android10之后才有aidegen工具,之前还只是idegen工具相对难用点。
  • 1.2 先cd来到源代码根目录下:cd ~/aosp_10.0.0_r17
  • 1.3 导入编译环境:source build/envsetup.sh
  • 1.4 选择编译目标:lunch aosp_sailfish-userdebug
  • 1.5 首次打开Launcher3项目:aidegen packages/apps/Launcher3 -i s -p ~/Downloads/android-studio-2022.2.1.20-linux/android-studio/bin/

    -i s 表示使用Android Studio打开,-i c 表示使用Clion打开,这个是用于c/cpp开发工具,-p 路径 表示指定Android Studio的安装路径
    会提示:INFO: If you are sure the related modules and dependencies have been already built, please try to use command aidegen packages/apps/Launcher3 -s to skip the building process.
    下次打开可以添加 -s 参数,表示skip忽略编译过程,因为首次打开已经编译过依赖了,下次打开就不用再费时间重新编译依赖了。
    忽略编译打开项目命令:aidegen packages/apps/Launcher3 -s -i s -p ~/Downloads/android-studio-2022.2.1.20-linux/android-studio/bin/

2. 修改Launcher3项目源代码,这里以隐藏Google搜索栏为例

  • 2.1 Android Studio打开项目之后,开发就和平时开发区别不大了,能搜索和跳转类、变量使用等等
  • 2.2 修改代码如下截图,注掉掉qsb添加进来的代码即可

3. 独单编译Launcher3项目

  • 3.1 编译Launcher3项目:mmm packages/apps/Launcher3/:Launcher3QuickStep

使用:Launcher3QuickStep指定编译的是Launcher3QuickStep模块,Launcher3项目包含了Home Launcher2 Launcher3 Launcher3QuickStep执行模块,我们使用的Launcher3QuickStep模块

  • 3.2 编译成功输出结果:[100% 401/401] Install: out/target/product/sailfish/system/product/priv-app/Launcher3QuickStep

4. 独单安装Launcher3验证

  • 验证修改结果:adb install -r out/target/product/sailfish/system/product/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk

adb install -r表示替换安装该安装包

  • 或者使用第二种验证方法,比较麻烦一点:adb push out/target/product/sailfish/system/product/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk system/system_ext/priv-app/Launcher3QuickStep/ 然后adb reboot重启设备

如果执行adb push失败,需要remount一下system区:adb root、adb remount、adb disable-verity、adb reboot、adb root、adb remount

5. 整机编译验证

  • 5.1 导入编译环境:source build/envsetup.sh
  • 5.2 选择编译目标:lunch aosp_sailfish-userdebug
  • 5.3 执行make编译:make -j4
  • 5.4 最好就是刷机:fastboot flashall -w
posted @ 2024-06-13 19:25  yongfengnice  阅读(127)  评论(0编辑  收藏  举报