matrix icon indicating copy to clipboard operation
matrix copied to clipboard

MethodBeat类方法疑问

Open Miverk opened this issue 7 years ago • 2 comments

代码疑问: public class MethodBeat implements IMethodBeat, ApplicationLifeObserver.IObserver { /** * hook method when it's called in. * * @param methodId */ public static void i(int methodId) { if (isBackground) { return; } ... }

/** * hook method when it's called out. * * @param methodId / public static void o(int methodId) { if (isBackground || null == sBuffer) { return; } ... } /* * when the special method calls,it's will be called. * * @param activity now at which activity * @param isFocus this window if has focus */ public static void at(Activity activity, boolean isFocus) {}

}

这三个方法在哪里被调用了... 全局搜索了下 没有找到

Miverk avatar Jan 02 '19 09:01 Miverk

@Miverk 这里应该是利用了ASM,在被加载之前修改class,每个方法之前调用i()在每个方法结尾调用方法o(),相当于直接操控字节码然后再组装成class

halibobo avatar Jan 02 '19 09:01 halibobo

在调用onWindowFocusChanged方法的时候调用at

dengjiaming avatar Jan 05 '19 09:01 dengjiaming