zoukankan      html  css  js  c++  java
  • 记录第一个Activity的onCreate时间

    @Override
    public void onActivityCreated(Activity activity) {
    super.onActivityCreated(activity);
    if (isFirstActivityCreate && mFirstActivityMap.isEmpty()) {
    String activityName = activity.getComponentName().getClassName();
    mFirstActivityIndex = getMethodBeat().getCurIndex();
    mFirstActivityName = activityName;
    mFirstActivityMap.put(activityName, System.currentTimeMillis());
    MatrixLog.i(TAG, "[onActivityCreated] first activity:%s index:%s", mFirstActivityName, mFirstActivityIndex);
    getMethodBeat().lockBuffer(true);
    }
    }
    复制代码
    记录Activity获取焦点的时间(在编译期,在Activity子类的onWindowFocusChange方法中插入MethodBeat.at方法)

    public static void at(Activity activity, boolean isFocus) {
    MatrixLog.i(TAG, "[AT] activity: %s, isCreated: %b sListener size: %d,isFocus: %b",
    activity.getClass(http://www.amjmh.com/v/BIBRGZ_558768/).getSimpleName(), isCreated, sListeners.size(), isFocus);
    if (isCreated && Thread.currentThread() == sMainThread) {
    for (IMethodBeatListener listener : sListeners) {
    listener.onActivityEntered(activity, isFocus, sIndex - 1, sBuffer);
    }
    }
    }
    复制代码
    当Activity获取到焦点时,认为启动阶段结束(若有SplashActivity,则记录下一个Activity获取焦点的时间)

    @Override
    public void onActivityEntered(Activity activity, boolean isFocus, int nowIndex, long[] buffer) {
    ...启动数据分析
    }

  • 相关阅读:
    pip 安装依赖 requirements.txt
    TCP三次握手四次挥手详细理解附面试题
    装饰器修复技术
    BBS(第一篇)
    Auth模块
    Django--中间件
    cookie和session
    创建多对多表关系的三种方式
    批量插入数据,自定义分页器
    Django--几个重要方法优化(面试重点)
  • 原文地址:https://www.cnblogs.com/hyhy904/p/11295906.html
Copyright © 2011-2022 走看看