360手机助手 v5.2.50版本的 MD5 值为:087c008db9e518cd556c792742e6830c

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


package com.qihoo.express.mini.c;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import com.android.volley.toolbox.StringRequest;
import com.android.volleypro.HttpResponseData;
import com.android.volleypro.toolbox.VolleyHttpClient;
import com.qihoo.express.mini.display.PCLinkSettingActivity;
import com.tencent.open.SocialConstants;
import java.io.UnsupportedEncodingException;
import org.json.JSONException;
import org.json.JSONObject;

public class ac {
    private static volatile ac a;
    private static final byte[] b = new byte[0];
    private com.qihoo.express.mini.display.h c;
    private final at d = new at(this);
    private Context e;
    private com.qihoo.express.mini.service.a.m f;
    private com.qihoo.express.mini.service.a.j g;
    private ab h;

    public static ac a() {
        if (a == null) {
            synchronized (b) {
                if (a == null) {
                    a = new ac();
                }
            }
        }
        return a;
    }

    private ac() {
    }

    public void a(Context context, Intent intent, ab abVar) {
        this.e = context;
        this.h = abVar;
        d();
        if (intent.getBooleanExtra("key_request_from_read_phonenum", false)) {
            a(intent);
        } else {
            b(intent);
        }
    }

    public ab b() {
        return this.h;
    }

    private void d() {
        if (this.g == null) {
            this.g = new ad(this);
            this.h.a(this.g.hashCode(), this.g);
        }
    }

    private void a(Intent intent) {
        this.d.b = intent.getStringExtra("key_request_pcname");
        this.d.a = intent.getStringExtra("key_request_token");
        try {
            this.d.d = Integer.parseInt(intent.getStringExtra("key_request_pcver"));
        } catch (NumberFormatException e) {
        }
        if (this.d.d <= 0) {
            this.d.d = 2;
        }
        try {
            this.d.f = Integer.parseInt(intent.getStringExtra("key_request_type"));
        } catch (NumberFormatException e2) {
        }
        this.d.e = "sms";
        e();
    }

    private void b(Intent intent) {
        Uri data = intent.getData();
        if (data != null) {
            this.d.b = data.getQueryParameter("pc");
            this.d.a = data.getQueryParameter("token");
            this.d.e = data.getQueryParameter("by");
            this.d.c = data.getQueryParameter("mid");
            try {
                this.d.d = Integer.parseInt(data.getQueryParameter("pcver"));
            } catch (NumberFormatException e) {
            }
            if (this.d.d <= 0) {
                this.d.d = 2;
            }
            try {
                this.d.f = Integer.parseInt(data.getQueryParameter(SocialConstants.PARAM_TYPE));
            } catch (NumberFormatException e2) {
            }
        }
        if (intent.getBooleanExtra("key_request_first_link", false)) {
            e();
        } else {
            j();
        }
    }

    private void e() {
        if (TextUtils.isEmpty(this.d.a)) {
            a(true);
        } else {
            a(false, true);
        }
    }

    public void a(boolean z) {
        if (this.c == null || this.c.b().isFinishing()) {
            if (!((Activity) this.e).isFinishing()) {
                this.c = new com.qihoo.express.mini.display.h(this.e, b(z), 3, new String[0]);
                a((Dialog) this.c);
                h();
                return;
            }
            return;
        }
        this.c.a(3, new String[0]);
        this.c.a(b(z));
        h();
    }

    private com.qihoo.express.mini.display.a b(boolean z) {
        return new ai(this, z);
    }

    public void f() {
        com.qihoo.utils.thread.f.a("PCLinkHelper-reqCidbyToken", new aj(this)).start();
    }

    public void a(int i) {
        if (this.c == null || this.c.b().isFinishing()) {
            if (!((Activity) this.e).isFinishing()) {
                this.c = new com.qihoo.express.mini.display.h(this.e, b(i), i, new String[0]);
                a((Dialog) this.c);
                return;
            }
            return;
        }
        if (this.c.a() != i) {
            a((DialogInterface) this.c);
            if (!((Activity) this.e).isFinishing()) {
                this.c = new com.qihoo.express.mini.display.h(this.e, b(i), i, new String[0]);
                a((Dialog) this.c);
                return;
            }
            return;
        }
        if (!((Activity) this.e).isFinishing()) {
            a((Dialog) this.c);
        }
    }

    private com.qihoo.express.mini.display.a b(int i) {
        return new al(this, i);
    }

    public void g() {
        if (this.h != null) {
            this.e.startActivity(new Intent(this.e, (Class<?>) PCLinkSettingActivity.class));
        }
        c();
    }

    private void h() {
        com.qihoo360.mobilesafe.pcdaemon.c.c.i().j().postDelayed(new am(this), 1000L);
    }

    private void a(boolean z, boolean z2) {
        com.qihoo.utils.thread.f.a("PCLinkHelper-reqCidbyTokenFirstly", new an(this, z2, z)).start();
    }

    public void i() {
        com.qihoo360.mobilesafe.pcdaemon.c.c.i().j().post(new ap(this));
    }

    private void j() {
        if (!TextUtils.isEmpty(this.d.c)) {
            k();
            a(this.d.c, this.d.d, this.d.e, this.d.f);
        } else if ("qrcode".equals(this.d.e)) {
            a(false, false);
        } else if (!TextUtils.isEmpty(this.d.a) && this.d.d > 0) {
            a(true, false);
        }
    }

    private void a(Dialog dialog) {
        if (dialog != null && !dialog.isShowing()) {
            dialog.show();
        }
    }

    public void a(DialogInterface dialogInterface) {
        if (dialogInterface != null) {
            if (dialogInterface instanceof com.qihoo.express.mini.display.h) {
                Activity b2 = ((com.qihoo.express.mini.display.h) dialogInterface).b();
                if (b2 != null && !b2.isFinishing()) {
                    dialogInterface.dismiss();
                    return;
                }
                return;
            }
            dialogInterface.dismiss();
        }
    }

    public boolean a(at atVar) {
        String str;
        StringRequest stringRequest = new StringRequest("http://intf1.zsall.mobilem.360.cn/intf/checkWirelessLinkToken?token=" + atVar.a, null, null);
        stringRequest.setTag(this);
        HttpResponseData syncNetworkResponse = VolleyHttpClient.getInstance().getSyncNetworkResponse(stringRequest);
        if (syncNetworkResponse == null || syncNetworkResponse.data == null) {
            com.qihoo360.mobilesafe.pcdaemon.c.c.i().j().post(new ar(this));
            return false;
        }
        try {
            str = new String(syncNetworkResponse.data, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            str = null;
        }
        return a(str, atVar);
    }

    private boolean a(String str, at atVar) {
        JSONObject jSONObject;
        try {
            jSONObject = new JSONObject(str);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        if (jSONObject.optInt("status") == 1) {
            atVar.c = jSONObject.optString("cid");
            return true;
        }
        com.qihoo360.mobilesafe.pcdaemon.c.c.i().j().post(new as(this));
        return false;
    }

    public void k() {
        String str = this.d.b;
        String str2 = Build.MODEL;
        if (this.c == null || this.c.b().isFinishing()) {
            this.c = new com.qihoo.express.mini.display.h(this.e, l(), 6, str, str2);
        } else {
            this.c.a(l());
            this.c.a(6, str, str2);
        }
        if (!((Activity) this.e).isFinishing()) {
            a((Dialog) this.c);
        }
    }

    private com.qihoo.express.mini.display.a l() {
        return new af(this);
    }

    public void a(String str, int i, String str2, int i2) {
        if (this.f == null) {
            this.f = new ag(this);
        }
        this.h.a(this.f.hashCode(), this.f);
        this.h.a(str, i, 30000, str2, i2);
    }

    public void c() {
        a((DialogInterface) this.c);
        this.c = null;
        if (this.h != null) {
            if (this.g != null) {
                this.h.b(this.g.hashCode());
                this.g = null;
            }
            if (this.f != null) {
                this.h.a(this.f.hashCode());
                this.f = null;
            }
        }
    }
}