https://wiki.cyanogenmod.org/w/Doc:_Development_Resourcesphp
http://pan.baidu.com/s/1sjoMt5rhtml
http://www.android-studio.org/index.php前端
make -j4 showcommands
Here is a list of different make targets you can use to build different parts of the system: make sdk - build the tools that are part of an SDK (adb, fastboot, etc.) make snod - build the system image from the current software binaries make services make runtime make droid - make droid is the normal build. make all - make everything, whether it is included in the product definition or not make clean - remove all built files (prepare for a new build). Same as rm -rf out/<configuration>/ make modules - shows a list of submodules that can be built (List of all LOCAL_MODULE definitions) make <local_module> - make a specific module (note that this is not the same as directory name. It is the LOCAL_MODULE definition in the Android.mk file) make clean-<local_module> - clean a specific module make bootimage TARGET_PREBUILT_KERNEL=/path/to/bzImage - create a new boot image with custom bzImage
There are some helper macros and functions that are installed when you source envsetup.sh. They are documented at the top of envesetup.sh, but here is information about a few of them: croot - change directory to the top of the tree m - execute 'make' from the top of the tree (even if your current directory is somewhere else) mm - builds all of the modules in the current directory mmm <dir1> ... - build all of the modules in the supplied directories cgrep <pattern> - grep on all local C/C++ files jgrep <pattern> - grep on all local Java files resgrep <pattern> - grep on all local res/*.xml files godir <filename> - go to the directory containing a file
https://wiki.cyanogenmod.org/w/Doc:_the_cm_sourcepython
To rebuild only the module which you are changing (ie, the stuff in your current directory), you can usually do this: mm -B
https://wiki.cyanogenmod.org/w/Doc:_import_to_intellijlinux
1. systrace android
(用systrace调试display system:http://files.cnblogs.com/files/pengdonglin137/Systrace_for_Display_System-140420101020-phpapp02%281%29.pdf)
web
用法:systrace这个工具在Android源码目录下的external/chromium-trace/下,用法(使用-h参数能够得到更详细的帮助信息):shell
gfx - Graphics
input - Input
view - View System
webview - WebView
wm - Window Manager
am - Activity Manager
sm - Sync Manager
audio - Audio
video - Video
camera - Camera
hal - Hardware Modules
app - Application
res - Resource Loading
dalvik - Dalvik VM
rs - RenderScript
bionic - Bionic C Library
power - Power Management
sched - CPU Scheduling
irq - IRQ Events
freq - CPU Frequency
idle - CPU Idle
disk - Disk I/O
mmc - eMMC commands
workq - Kernel Workqueues
memreclaim - Kernel Memory Reclaim
编程
以media/libmedia/AudioTrack.cpp为例:windows
#define ATRACE_TAG ATRACE_TAG_ALWAYS
// 表示一直会打开,若是是ATRACE_TAG_AUDIO,则须要在systrace中加入audio参数才能看到
#include <utils/Trace.h>
而后在须要调试的函数的入口(以AudioTrack::start)为例:
status_t AudioTrack::start()
{
+ ATRACE_NAME("AudioTrack::start");
status_t status = NO_ERROR;
AutoMutex lock(mLock);
if (mState == STATE_ACTIVE) {
或者
status_t AudioTrack::start()
{
+ ATRACE_CALL();
status_t status = NO_ERROR;
AutoMutex lock(mLock);
if (mState == STATE_ACTIVE) {
2. dumpsys
3. pytimechart
4. ftrace 和 trace_cmd
下面的命令能够让sdcard上的媒体文件从新识别,当使用adb push命令向手机里放入媒体文件后,手机并不能当即识别这个媒体文件,须要重启手机,下面的命令能够不用重启手机。
#! /bin/bash adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/sdcard/
在android源代码的cts目录下有不少示例代码,其中的程序都不是很复杂,值得学习一下。
media相关的: cts/tests/tests/media/src/android/media/cts
graphic相关的: cts/tests/tests/graphics/src/android/graphics/cts
下载地址:https://developer.android.com/studio/releases/platform-tools.html