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; /* access modifiers changed from: package-private */ public class c extends AsyncTask<Void, Void, a> { /* renamed from: a reason: collision with root package name */ private String f33615a; /* renamed from: b reason: collision with root package name */ private String f33616b; /* renamed from: c reason: collision with root package name */ private OAuthListener f33617c; /* renamed from: d reason: collision with root package name */ private int f33618d; public static class a { /* renamed from: a reason: collision with root package name */ public OAuthErrCode f33619a; /* renamed from: b reason: collision with root package name */ public String f33620b; /* renamed from: c reason: collision with root package name */ public int f33621c; } public c(String str, OAuthListener oAuthListener) { this.f33615a = str; this.f33617c = oAuthListener; this.f33616b = 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:0x0131 */ /* JADX WARNING: Removed duplicated region for block: B:59:0x016a 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("OpenSdkNoopingTask"); String str3 = this.f33615a; if (str3 == null || str3.length() == 0) { Log.e("MicroMsg.SDK.NoopingTask", "run fail, uuid is null"); aVar = new a(); } else { Log.i("MicroMsg.SDK.NoopingTask", "doInBackground start " + isCancelled()); while (!isCancelled()) { StringBuilder sb3 = new StringBuilder(); sb3.append(this.f33616b); if (this.f33618d == 0) { str = ""; } else { str = "&last=" + this.f33618d; } sb3.append(str); String sb4 = sb3.toString(); long currentTimeMillis = System.currentTimeMillis(); byte[] a14 = com.tencent.mm.opensdk.channel.a.a.a(sb4, 60000); long currentTimeMillis2 = System.currentTimeMillis(); aVar = new a(); Log.d("MicroMsg.SDK.NoopingResult", "star parse NoopingResult"); if (a14 == null || a14.length == 0) { Log.e("MicroMsg.SDK.NoopingResult", "parse fail, buf is null"); oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NetworkErr; } else { try { } catch (Exception e14) { str2 = String.format("parse fail, build String fail, ex = %s", e14.getMessage()); Log.e("MicroMsg.SDK.NoopingResult", str2); oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f33619a = oAuthErrCode3; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb4, aVar.f33619a.toString(), Integer.valueOf(aVar.f33621c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f33619a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } try { JSONObject jSONObject = new JSONObject(new String(a14, "utf-8")); int i10 = jSONObject.getInt("wx_errcode"); aVar.f33621c = i10; Log.d("MicroMsg.SDK.NoopingResult", String.format("nooping uuidStatusCode = %d", Integer.valueOf(i10))); int i14 = aVar.f33621c; if (i14 != 408) { if (i14 != 500) { switch (i14) { case 402: oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_Timeout; aVar.f33619a = oAuthErrCode4; break; case 403: oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_Cancel; aVar.f33619a = oAuthErrCode4; break; case 405: aVar.f33619a = OAuthErrCode.WechatAuth_Err_OK; aVar.f33620b = jSONObject.getString("wx_code"); break; } Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb4, aVar.f33619a.toString(), Integer.valueOf(aVar.f33621c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f33619a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { int i15 = aVar.f33621c; this.f33618d = i15; if (i15 == d.UUID_SCANED.a()) { this.f33617c.onQrcodeScanned(); } else if (aVar.f33621c != d.UUID_KEEP_CONNECT.a() && aVar.f33621c == d.UUID_CONFIRM.a()) { String str4 = aVar.f33620b; 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.f33621c))); } return aVar; } oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f33619a = oAuthErrCode4; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb4, aVar.f33619a.toString(), Integer.valueOf(aVar.f33621c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f33619a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_OK; aVar.f33619a = oAuthErrCode4; } catch (Exception e15) { str2 = String.format("parse json fail, ex = %s", e15.getMessage()); Log.e("MicroMsg.SDK.NoopingResult", str2); oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f33619a = oAuthErrCode3; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb4, aVar.f33619a.toString(), Integer.valueOf(aVar.f33621c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f33619a; 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)", sb4, aVar.f33619a.toString(), Integer.valueOf(aVar.f33621c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f33619a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } aVar.f33619a = oAuthErrCode3; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb4, aVar.f33619a.toString(), Integer.valueOf(aVar.f33621c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f33619a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } Log.i("MicroMsg.SDK.NoopingTask", "IDiffDevOAuth.stopAuth / detach invoked"); aVar = new a(); oAuthErrCode = OAuthErrCode.WechatAuth_Err_Auth_Stopped; aVar.f33619a = oAuthErrCode; return aVar; } oAuthErrCode = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f33619a = 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.f33617c.onAuthFinish(aVar2.f33619a, aVar2.f33620b); } }