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 com.tencent.thumbplayer.tmediacodec.codec.CodecError; 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 f80266a; /* renamed from: b reason: collision with root package name */ private String f80267b; /* renamed from: c reason: collision with root package name */ private OAuthListener f80268c; /* renamed from: d reason: collision with root package name */ private int f80269d; public static class a { /* renamed from: a reason: collision with root package name */ public OAuthErrCode f80270a; /* renamed from: b reason: collision with root package name */ public String f80271b; /* renamed from: c reason: collision with root package name */ public int f80272c; } public c(String str, OAuthListener oAuthListener) { this.f80266a = str; this.f80268c = oAuthListener; this.f80267b = 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:0x0132 */ /* JADX WARNING: Removed duplicated region for block: B:59:0x016b 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.f80266a; 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 sb5 = new StringBuilder(); sb5.append(this.f80267b); if (this.f80269d == 0) { str = ""; } else { str = "&last=" + this.f80269d; } sb5.append(str); String sb6 = sb5.toString(); long currentTimeMillis = System.currentTimeMillis(); byte[] a15 = com.tencent.mm.opensdk.channel.a.a.a(sb6, (int) CodecError.DEQUEUEOUTPUTBUFFER_ILLEGAL); long currentTimeMillis2 = System.currentTimeMillis(); aVar = new a(); Log.d("MicroMsg.SDK.NoopingResult", "star parse NoopingResult"); if (a15 == null || a15.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(a15, "utf-8")); int i15 = jSONObject.getInt("wx_errcode"); aVar.f80272c = i15; Log.d("MicroMsg.SDK.NoopingResult", String.format("nooping uuidStatusCode = %d", Integer.valueOf(i15))); int i16 = aVar.f80272c; if (i16 != 408) { if (i16 != 500) { switch (i16) { case 402: oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_Timeout; aVar.f80270a = oAuthErrCode4; break; case 403: oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_Cancel; aVar.f80270a = oAuthErrCode4; break; case 405: aVar.f80270a = OAuthErrCode.WechatAuth_Err_OK; aVar.f80271b = jSONObject.getString("wx_code"); break; } Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb6, aVar.f80270a.toString(), Integer.valueOf(aVar.f80272c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f80270a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { int i17 = aVar.f80272c; this.f80269d = i17; if (i17 == d.UUID_SCANED.a()) { this.f80268c.onQrcodeScanned(); } else if (aVar.f80272c != d.UUID_KEEP_CONNECT.a() && aVar.f80272c == d.UUID_CONFIRM.a()) { String str4 = aVar.f80271b; 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.f80272c))); } return aVar; } oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f80270a = oAuthErrCode4; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb6, aVar.f80270a.toString(), Integer.valueOf(aVar.f80272c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f80270a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_OK; aVar.f80270a = 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.f80270a = oAuthErrCode3; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb6, aVar.f80270a.toString(), Integer.valueOf(aVar.f80272c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f80270a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } } catch (Exception e16) { str2 = String.format("parse fail, build String fail, ex = %s", e16.getMessage()); Log.e("MicroMsg.SDK.NoopingResult", str2); oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f80270a = oAuthErrCode3; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb6, aVar.f80270a.toString(), Integer.valueOf(aVar.f80272c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f80270a; 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)", sb6, aVar.f80270a.toString(), Integer.valueOf(aVar.f80272c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f80270a; if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) { } return aVar; } aVar.f80270a = oAuthErrCode3; Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb6, aVar.f80270a.toString(), Integer.valueOf(aVar.f80272c), Long.valueOf(currentTimeMillis2 - currentTimeMillis))); oAuthErrCode2 = aVar.f80270a; 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.f80270a = oAuthErrCode; return aVar; } oAuthErrCode = OAuthErrCode.WechatAuth_Err_NormalErr; aVar.f80270a = 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.f80268c.onAuthFinish(aVar2.f80270a, aVar2.f80271b); } }