Android系统启动篇
4,《Android SystemServer进程启动流程》
Android系统开发准备篇
3,《Android Framework代码IDE加载和调试》
Android系统开发实践篇
4,《android单独编译framework模块并push》
Android系统开发核心知识储备篇
1,《Android编译系统-envsetup和lunch代码篇》
6,《Android中Activity、View和Window关系详解》
11,《android中AMS进程通知Zygote进程fork新进程的通信方式》
Android核心功能详解篇
2,《Android 手势导航(从下往上滑动进入多任务页面)》
3,《android手势分析(应用界面左往右边滑动退出应用)》
———————————————————————————————————————————
目录
一、准备工作
1.1 下载最新的 Android Studio 版本
https://developer.android.com/studio/index.html
1.2 下载 Android 系统源码
这里比较灵活,可以下载公司内部机型的代码,也可以下载原生AOSP的代码
环境配置参考
https://source.android.com/source/initializing.html
源码下载参考
https://source.android.com/source/downloading.html
编译运行参考
https://source.android.com/source/building.html
全部编译整个代码工程,中间如果有什么问题可以参考
https://source.android.com/source
二,编译生成android.ipr文件
android提供一套androidstudio加载导入代码的能力,通过idegen编译生成android.iml和android.ipr文件后,androidstuio导入便可。
2.1 配置编译加载目录
这里采用官方推荐方法修改文件/development/tools/idegen/excluded-paths,参考值:
# Default Idegen excluded paths file. Contains regular expressions, one per
# line, which match paths of directories and .jar files that should be excluded
# from the IDE configuration.
#
# We want to exclude as litte as possible by default, so it's important to
# document the reason for each exclusion.
#
# Developers can also create an 'excluded-paths' file in the project's root
# directory and add their own excludes to slim down their build.
#
# Currently, we lump all the .java files together into one big module, so you
# can't have two classes with the same name at once. In the future, we'll
# generate individual modules, each with their own dependencies, much like the
# build, so we won't have to worry about duplicate names any more than the
# build does.
#
# Note: Google-specific excludes go in vendor/google/excluded-paths.
# Generated API stubs. We only want the originals in our IDE.
android_stubs
# remove projects except framework
#^out
^disregard
^kernel
^bootstrap.bash -> build/soong/bootstrap.bash
^Android.bp -> build/soong/root.bp
^build
^vendor
^tools
^toolchain
^test
^system
^shortcut-fe
^sdk
^prebuilts
^platform_testing
^pdk
^packages
^oem-release
^libnativehelper
#^libcore
^libcore/.*/test$
^libcore/.*/test-rules$
^libcore/test-rules$
^libcore/metrictests$
^hardware
#^frameworks
^frameworks/support/samples$
^frameworks/.*/.*tests$
^frameworks/.*/test$
^frameworks/.*/test-base$
^frameworks/.*/core-testing$
^frameworks/.*/testing$
^frameworks/.*/testutils$
^frameworks/.*/loadtest$
^frameworks/.*/testtensorflow$
^frameworks/.*/testrunner-src$
^frameworks/.*/androidTest$
^flashing-files
^external
^device
^build.sh
^development
^developers
^dalvik
^cts
^compatibility
^Makefile
^bootable
^bionic
^art
2.2 单独编译 idegen 模块
$ make idegen -j16
2.3 执行idegen.sh脚本
$ ./development/tools/idegen/idegen.sh
2.4 生成物
2.2 2.3执行完成后,工程根目录下生成android.iml和android.ipr文件,见下图:
三,androidstudio加载
File -> Open 打开android.ipr文件,由于文件比较大,第一次加载同步时间会很长,耐心等待。
四,断点调试
勾选show all processes,选择需要debug的进程,比如systemui进程
设置断点,进行操作,如下图: