• 记录第一个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) {
    ...启动数据分析
    }

  • 相关阅读:
    腾讯云 Centos 配置 JDK & Tomcat & Mysql
    JNI编程新手入门:Java和C++的超简单交互
    关于正则表达式的一些实际应用
    CAJ 转化为PDF
    Latex 大括号后多行输出
    Latex 安装
    Neo4j使用操作
    pip 升级操作
    venue recommendation —— 应用场景/用户分类
    Recbole安装及使用
  • 原文地址:https://www.cnblogs.com/hyhy904/p/11295906.html
Copyright © 2020-2023  润新知