android系统开发修改桌面Launcher3代码编译安装验证
<h2 id="1使用aidegen打开launcher3项目">1.使用aidegen打开Launcher3项目</h2><ul>
<li>1.1 首先整个aosp源代码编译成功过,自然也就是编译成功了<code>aidegen</code>工具。Android10之后才有aidegen工具,之前还只是idegen工具相对难用点。</li>
<li>1.2 先cd来到源代码根目录下:<code>cd ~/aosp_10.0.0_r17</code></li>
<li>1.3 导入编译环境:<code>source build/envsetup.sh</code></li>
<li>1.4 选择编译目标:<code>lunch aosp_sailfish-userdebug</code></li>
<li>1.5 首次打开Launcher3项目:<code>aidegen packages/apps/Launcher3 -i s -p ~/Downloads/android-studio-2022.2.1.20-linux/android-studio/bin/</code>
<blockquote>
<p><code>-i s</code> 表示使用<code>Android Studio</code>打开,<code>-i c</code> 表示使用<code>Clion</code>打开,这个是用于c/cpp开发工具,<code>-p 路径</code> 表示指定<code>Android Studio的安装路径</code><br>
会提示:INFO: If you are sure the related modules and dependencies have been already built, please try to use command <code>aidegen packages/apps/Launcher3 -s</code> to skip the building process.<br>
下次打开可以添加 -s 参数,表示skip忽略编译过程,因为首次打开已经编译过依赖了,下次打开就不用再费时间重新编译依赖了。<br>
忽略编译打开项目命令:<code>aidegen packages/apps/Launcher3 -s -i s -p ~/Downloads/android-studio-2022.2.1.20-linux/android-studio/bin/</code></p>
</blockquote>
</li>
</ul>
<h2 id="2-修改launcher3项目源代码这里以隐藏google搜索栏为例">2. 修改Launcher3项目源代码,这里以隐藏Google搜索栏为例</h2>
<ul>
<li>2.1 Android Studio打开项目之后,开发就和平时开发区别不大了,能搜索和跳转类、变量使用等等</li>
<li>2.2 修改代码如下截图,注掉掉qsb添加进来的代码即可<br>
<img src="https://img2024.cnblogs.com/blog/1020339/202406/1020339-20240613190928179-1089202989.jpg"></li>
</ul>
<h2 id="3-独单编译launcher3项目">3. 独单编译Launcher3项目</h2>
<ul>
<li>3.1 编译Launcher3项目:<code>mmm packages/apps/Launcher3/:Launcher3QuickStep</code></li>
</ul>
<blockquote>
<p>使用<code>:Launcher3QuickStep</code>指定编译的是Launcher3QuickStep模块,Launcher3项目包含了<code>Home Launcher2 Launcher3 Launcher3QuickStep</code>执行模块,我们使用的<code>Launcher3QuickStep</code>模块</p>
</blockquote>
<ul>
<li>3.2 编译成功输出结果:<code> Install: out/target/product/sailfish/system/product/priv-app/Launcher3QuickStep</code></li>
</ul>
<h2 id="4-独单安装launcher3验证">4. 独单安装Launcher3验证</h2>
<ul>
<li>验证修改结果:<code>adb install -r out/target/product/sailfish/system/product/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk</code></li>
</ul>
<blockquote>
<p><code>adb install -r</code>表示替换安装该安装包</p>
</blockquote>
<ul>
<li>或者使用第二种验证方法,比较麻烦一点:<code>adb push out/target/product/sailfish/system/product/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk system/system_ext/priv-app/Launcher3QuickStep/</code> 然后<code>adb reboot</code>重启设备</li>
</ul>
<blockquote>
<p>如果执行adb push失败,需要remount一下system区:<code>adb root、adb remount、adb disable-verity、adb reboot、adb root、adb remount</code></p>
</blockquote>
<h2 id="5-整机编译验证">5. 整机编译验证</h2>
<ul>
<li>5.1 导入编译环境:<code>source build/envsetup.sh</code></li>
<li>5.2 选择编译目标:<code>lunch aosp_sailfish-userdebug</code></li>
<li>5.3 执行make编译:<code>make -j4</code></li>
<li>5.4 最后就是刷机:<code>fastboot flashall -w</code><br>
<code>1.设置ANDROID_PRODUCT_OUT环境:export ANDROID_PRODUCT_OUT=/home/ubuntu20/aosp10.0.17/out/target/product/sailfish</code><br>
<code>2.进入bootloader模式adb reboot bootloader</code><br>
<code>3.一句话刷机:fastboot flashall -w</code></li>
</ul><br><br>
来源:https://www.cnblogs.com/yongfengnice/p/18246626
頁:
[1]