H5W3
当前位置:H5W3 > 其他技术问题 > 正文

android 开发源码不知道原因为啥记录很多classindex

最近看别人写android 源码是用okhttp3 websocket 写的源码,但是每个类都有

    static {
        Covode.recordClassIndex(128699);
    }

类似这种加载类的static 方法,这里面的数字有什么用呢?我看了这个里面的源码(recordClassIndex)是往消息队列里面增加数据,但是不知和这里的class 有什么关系呢?为啥每个class 都有个static > recordClassIndex

package com.bytedance.covode.number;

import android.content.Context;
import java.io.File;

public abstract class Covode {

    public static class a {
        com.bytedance.covode.a.a a = new com.bytedance.covode.a.a();
        boolean b;

        public final a a(boolean z) {
            this.b = z;
            return this;
        }

        public final a a(String str) {
            this.a.a = str;
            return this;
        }

        public final a b(boolean z) {
            this.a.c = z;
            return this;
        }

        public a(Context context) {
            this.a.b = context;
        }
    }

    public interface b {
        boolean a(File file);
    }

    private static CovodeNumberImpl getImpl() {
        return CovodeNumberImpl.a;
    }

    public abstract boolean report(b bVar);

    public abstract boolean start(a aVar);

    public static boolean reportCollections(b bVar) {
        return getImpl().report(bVar);
    }

    public static boolean startCollecting(a aVar) {
        return getImpl().start(aVar);
    }

    public static void recordClassIndex(int i) {
        CovodeNumberImpl impl = getImpl();
        if (impl.b == null) {
            if (CovodeNumberImpl.c != null) {
                a aVar = CovodeNumberImpl.c;
                if (aVar.c) {
                    if (i < 32767) {
                        aVar.b.add(Short.valueOf((short) i));
                    } else {
                        aVar.a.add(Integer.valueOf(i));
                    }
                }
            }
        } else if (impl.b.b) {
            impl.recordClassIndexToFile(i);
        }
    }
}
package com.bytedance.ies.geckoclient.network;

import android.util.Pair;
import com.bytedance.covode.number.Covode;
import java.util.List;

public interface INetwork {
    static {
        Covode.recordClassIndex(36111);
    }

    String doGet(String str) throws Exception;

    String doPost(String str, String str2) throws Exception;

    String doPost(String str, List<Pair<String, String>> list) throws Exception;

    boolean downloadFile(String str, String str2) throws Exception;
}

    public static void recordClassIndex(int i) {
        CovodeNumberImpl impl = getImpl();
        if (impl.b == null) {
            if (CovodeNumberImpl.c != null) {
                a aVar = CovodeNumberImpl.c;
                if (aVar.c) {
                    if (i < 32767) {
                        aVar.b.add(Short.valueOf((short) i));
                    } else {
                        aVar.a.add(Integer.valueOf(i));
                    }
                }
            }
        } else if (impl.b.b) {
            impl.recordClassIndexToFile(i);
        }
    }

本文地址:H5W3 » android 开发源码不知道原因为啥记录很多classindex

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址