号簿助手 v4.6.31版本的 MD5 值为:9d7ff98a6bb5cc178eac2df4d1b2f0e0

以下内容为反编译后的 av.java 源代码,内容仅作参考


package com.baidu.bottom;

import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import com.baidu.bottom.service.GetClassInterface;
import dalvik.system.DexClassLoader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;

public class av extends Thread {
    private Context a;
    private IBPStretegyController b;

    public av(Context context, IBPStretegyController iBPStretegyController) {
        this.a = context;
        this.b = iBPStretegyController;
    }

    @Override
    public void run() {
        try {
            ba.a("start version check in " + (ay.a ? 3 : 10) + "s");
            sleep(r0 * 1000);
            a();
            a(this.a);
        } catch (Exception e) {
            ba.a(e);
        }
        boolean unused = au.b = false;
    }

    private void a(Context context) {
        this.b.setLastUpdateTime(context, System.currentTimeMillis());
    }

    private synchronized void a() {
        FileOutputStream fileOutputStream = null;
        synchronized (this) {
            ba.a("start get config and download jar");
            Context context = this.a;
            IBPStretegyController iBPStretegyController = this.b;
            String b = b(context);
            ba.c("update req url is:" + b);
            HttpURLConnection d = ck.d(context, b);
            try {
                d.connect();
                String headerField = d.getHeaderField("X-CONFIG");
                ba.a("config is: " + headerField);
                String headerField2 = d.getHeaderField("X-SIGN");
                ba.a("sign is: " + headerField2);
                int responseCode = d.getResponseCode();
                ba.a("update response code is: " + responseCode);
                int contentLength = d.getContentLength();
                ba.a("update response content length is: " + contentLength);
                if (responseCode == 200 && contentLength > 0) {
                    try {
                        try {
                            fileOutputStream = context.openFileOutput(".remote.jar", 0);
                            if (cp.a(d.getInputStream(), fileOutputStream)) {
                                ba.a("save remote jar success");
                            }
                        } catch (IOException e) {
                            ba.b(e);
                            cp.a(fileOutputStream);
                        }
                    } finally {
                        cp.a(fileOutputStream);
                    }
                }
                DexClassLoader unused = au.a = null;
                GetClassInterface.resetController();
                if (!TextUtils.isEmpty(headerField)) {
                    iBPStretegyController.saveRemoteConfig2(context, headerField);
                }
                if (!TextUtils.isEmpty(headerField2)) {
                    iBPStretegyController.saveRemoteSign(context, headerField2);
                }
                d.disconnect();
                ba.a("finish get config and download jar");
            } catch (Throwable th) {
                d.disconnect();
                throw th;
            }
        }
    }

    private String b(Context context) {
        String str;
        File fileStreamPath;
        File fileStreamPath2 = context.getFileStreamPath(".remote.jar");
        if (fileStreamPath2 != null && fileStreamPath2.exists() && (fileStreamPath = context.getFileStreamPath(".remote.jar")) != null) {
            str = au.b(fileStreamPath.getAbsolutePath());
            ba.a("startDownload remote jar file version = " + str);
        }
        str = "8";
        ArrayList arrayList = new ArrayList();
        arrayList.add(new BasicNameValuePair("dynamicVersion", "" + str));
        arrayList.add(new BasicNameValuePair("packageName", ct.o(context)));
        arrayList.add(new BasicNameValuePair("appVersion", ct.f(context)));
        arrayList.add(new BasicNameValuePair("cuid", ct.a(context)));
        arrayList.add(new BasicNameValuePair("platform", "Android"));
        arrayList.add(new BasicNameValuePair("m", Build.MODEL));
        arrayList.add(new BasicNameValuePair("s", Build.VERSION.SDK_INT + ""));
        arrayList.add(new BasicNameValuePair("o", Build.VERSION.RELEASE));
        arrayList.add(new BasicNameValuePair("i", "8"));
        return "https://dxp.baidu.com/upgrade?" + URLEncodedUtils.format(arrayList, "utf-8");
    }
}