grep + 堆栈打印,相互交替使用可以提高梳理代码结构的效率
1.grep -nr 关键字
/home/ssd/workspace/rs10_dev/system/alps-release-u0.mp1.rc-tb/vendor/mediatek/proprietary/packages/apps/Dialer$ grep -nr incoming_swipe_to_reject_text
java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml:108: android:id="@+id/incoming_swipe_to_reject_text"
java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java:201: swipeToRejectText = (TextView) view.findViewById(R.id.incoming_swipe_to_reject_text);
2.堆栈打印
private void performEnableScreen() {
Slog.d(TAG_WM, "qiushao performEnableScreen", new Throwable());
02-24 20:33:49.960 1657 1698 D WindowManager: qiushao performEnableScreen
02-24 20:33:49.960 1657 1698 D WindowManager: java.lang.Throwable
02-24 20:33:49.960 1657 1698 D WindowManager: at com.android.server.wm.WindowManagerService.performEnableScreen(WindowManagerService.java:3282)
02-24 20:33:49.960 1657 1698 D WindowManager: at com.android.server.wm.WindowManagerService.enableScreenAfterBoot(WindowManagerService.java:3235)
02-24 20:33:49.960 1657 1698 D WindowManager: at com.android.server.wm.ActivityTaskManagerService$LocalService.enableScreenAfterBoot(ActivityTaskManagerService.java:6482)
02-24 20:33:49.960 1657 1698 D WindowManager: at com.android.server.wm.ActivityTaskManagerService.lambda$postFinishBooting$6$ActivityTaskManagerService(ActivityTaskManagerService.java:5678)
02-24 20:33:49.960 1657 1698 D WindowManager: at com.android.server.wm.-$$Lambda$ActivityTaskManagerService$oP6xxIfnD4kb4JN7aSJU073ULR4.run(Unknown Source:6)
02-24 20:33:49.960 1657 1698 D WindowManager: at android.os.Handler.handleCallback(Handler.java:883)
02-24 20:33:49.960 1657 1698 D WindowManager: at android.os.Handler.dispatchMessage(Handler.java:100)
02-24 20:33:49.960 1657 1698 D WindowManager: at android.os.Looper.loop(Looper.java:214)
02-24 20:33:49.960 1657 1698 D WindowManager: at android.os.HandlerThread.run(HandlerThread.java:67)
02-24 20:33:49.960 1657 1698 D WindowManager: at com.android.server.ServiceThread.run(ServiceThread.java:44)