aop和atrhook的区别?

来源:8-2 网络优化工具选择

qq_慕丝6107501

2020-04-27

@Around("execution(* android.app.Activity.setContentView(..))")
    public void getSetContentViewTime(ProceedingJoinPoint joinPoint) {
        Signature signature = joinPoint.getSignature();
        String name = signature.toShortString();
        long time = System.currentTimeMillis();
        try {
            joinPoint.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        LogUtils.i(name + " cost " + (System.currentTimeMillis() - time));
    }

这个不是也获取了系统里自带的方法(setcontentview) 所以说 能aop调用包名也可以在系统自带的api里添加逻辑吗?
而arthook 好像都可以改吧?

写回答

1回答

随风绽放

2020-04-27

同学你好,arthook在这里也是可以改的。二者原理不同,可以在问答区搜下之前回答过,或者你先自己思考下。

0
0

Top团队大牛带你玩转Android性能分析与优化

由表及里学到国内Top团队对性能问题的体系化解决方案

1696 学习 · 532 问题

查看课程