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