package com.tencent.mm.opensdk.diffdev.a; import android.os.AsyncTask; import com.tencent.mm.opensdk.diffdev.OAuthErrCode; import com.tencent.mm.opensdk.diffdev.OAuthListener; import com.tencent.mm.opensdk.utils.Log; import org.json.JSONObject; import p4.f; public class c extends AsyncTask<Void, Void, a> { /* renamed from: a reason: collision with root package name */ private String f29313a; private String b; /* renamed from: c reason: collision with root package name */ private OAuthListener f29314c; private int d; public static class a { /* renamed from: a reason: collision with root package name */ public OAuthErrCode f29315a; public String b; /* renamed from: c reason: collision with root package name */ public int f29316c; } public c(String str, OAuthListener oAuthListener) { this.f29313a = str; this.f29314c = oAuthListener; this.b = String.format("https://long.open.weixin.qq.com/connect/l/qrconnect?f=json&uuid=%s", str); } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */ /* JADX WARNING: Removed duplicated region for block: B:39:0x012d */ /* JADX WARNING: Removed duplicated region for block: B:59:0x0166 A[SYNTHETIC] */ @Override // android.os.AsyncTask public a doInBackground(Void[] voidArr) { a aVar; OAuthErrCode oAuthErrCode; String str; OAuthErrCode oAuthErrCode2; OAuthErrCode oAuthErrCode3; String str2; OAuthErrCode oAuthErrCode4; Thread.currentThread().setName(f.a("OpenSdkNoopingTask", "com.tencent.mm.opensdk.diffdev.a.c")); String str3 = this.f29313a; if (str3 == null || str3.length() == 0) { Log.e("MicroMsg.SDK.NoopingTask", "run fail, uuid is null"); aVar = new a(); } else { StringBuilder h12 = a.f.h("doInBackground start "); h12.append(isCancelled()); Log.i("MicroMsg.SDK.NoopingTask", h12.toString()); while (!isCancelled()) { StringBuilder sb2 = new StringBuilder(); sb2.append(this.b); if (this.d == 0) { str = ""; } else { StringBuilder h13 = a.f.h("&last="); h13.append(this.d); str = h13.toString(); } sb2.append(str); String sb3 = sb2.toString(); long currentTimeMillis = System.currentTimeMillis(); byte[] a5 = com.tencent.mm.opensdk.channel.a.a.a(sb3, 60000); long currentTimeMillis2 = System.currentTimeMillis(); aVar = new a(); Log.d("MicroMsg.SDK.NoopingResult", "star parse NoopingResult"); if (a5 == null || a5.length == 0) { Log.e("MicroMsg.SDK.NoopingResult", "parse fail, buf is null"); oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NetworkErr; } else { try { try { JSONObject jSONObject = new JSONObject(new String(a5, "utf-8")); int i = jSONObject.getInt("wx_errcode"); aVar.f29316c = i; Log.d("MicroMsg.SDK.NoopingResult", String.format("nooping uuidStatusCode = %d", Integer.valueOf(i))); int i3 = aVar.f29316c; if (i3 != 408) { if (i3 != 500) { switch (i3) { case 402: oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_Timeout; aVar.f29315a = oAuthErrCode4; break; case 403: oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_Cancel; aVar.f29315a = oAuthErrCode4; break; case 405: aVar.f29315a = OAuthErrCode.WechatAuth_Err_OK; aVar.b = jSONObject.getString("wx_code"); break; } Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f29315a.toString(), Integer.valueOf(aVar.f29316c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f29315a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { int i12 = aVar.f29316c; this.d = i12; if (i12 == d.UUID_SCANED.a()) { this.f29314c.onQrcodeScanned(); } else if (aVar.f29316c != d.UUID_KEEP_CONNECT.a() && aVar.f29316c == d.UUID_CONFIRM.a()) { String str4 = aVar.b; if (str4 == null || str4.length() == 0) { Log.e("MicroMsg.SDK.NoopingTask", "nooping fail, confirm with an empty code!!!"); } } } else { Log.e("MicroMsg.SDK.NoopingTask", String.format("nooping fail, errCode = %s, uuidStatusCode = %d", oAuthErrCode2.toString(), Integer.valueOf(aVar.f29316c))); } return aVar; } oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f29315a = oAuthErrCode4; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f29315a.toString(), Integer.valueOf(aVar.f29316c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f29315a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_OK; aVar.f29315a = oAuthErrCode4; } catch (Exception e) { str2 = String.format("parse json fail, ex = %s", e.getMessage()); Log.e("MicroMsg.SDK.NoopingResult", str2); oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f29315a = oAuthErrCode3; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f29315a.toString(), Integer.valueOf(aVar.f29316c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f29315a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } } catch (Exception e6) { str2 = String.format("parse fail, build String fail, ex = %s", e6.getMessage()); Log.e("MicroMsg.SDK.NoopingResult", str2); oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f29315a = oAuthErrCode3; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f29315a.toString(), Integer.valueOf(aVar.f29316c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f29315a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f29315a.toString(), Integer.valueOf(aVar.f29316c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f29315a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } aVar.f29315a = oAuthErrCode3; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f29315a.toString(), Integer.valueOf(aVar.f29316c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f29315a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } Log.i("MicroMsg.SDK.NoopingTask", "IDiffDevOAuth.stopAuth / detach invoked"); a aVar2 = new a(); oAuthErrCode = OAuthErrCode.WechatAuth_Err_Auth_Stopped; aVar = aVar2; aVar.f29315a = oAuthErrCode; return aVar; } oAuthErrCode = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f29315a = oAuthErrCode; return aVar; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // android.os.AsyncTask public void onPostExecute(a aVar) { a aVar2 = aVar; this.f29314c.onAuthFinish(aVar2.f29315a, aVar2.b); } }