package com.huawei.hms.framework.network.grs.g; import android.content.Context; import android.os.SystemClock; import com.huawei.hms.framework.common.IoUtils; import com.huawei.hms.framework.common.Logger; import com.huawei.hms.framework.network.grs.GrsBaseInfo; import com.huawei.hms.framework.network.grs.e.c; import com.huawei.hms.framework.network.grs.h.f.a; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Map; import java.util.concurrent.Callable; import javax.net.ssl.HttpsURLConnection; public class h extends b implements Callable<e> { private static final String i = "h"; public h(String str, int i2, a aVar, Context context, String str2, GrsBaseInfo grsBaseInfo, c cVar) { super(str, i2, aVar, context, str2, grsBaseInfo, cVar); } /* JADX INFO: finally extract failed */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r12v0, types: [byte[]] */ /* JADX WARN: Type inference failed for: r12v1 */ /* JADX WARN: Type inference failed for: r7v7, types: [byte[]] */ /* JADX WARNING: Removed duplicated region for block: B:29:0x00e0 */ /* JADX WARNING: Unknown variable types count: 1 */ @Override // java.util.concurrent.Callable public e call() { long j; long j2; long j3; IOException e; Logger.i(i, "Post call execute"); long j4 = 0; try { long elapsedRealtime = SystemClock.elapsedRealtime(); try { j2 = System.currentTimeMillis(); HttpsURLConnection a = a.a(c(), b(), e()); InputStream inputStream = null; if (a == null) { Logger.w(i, "create HttpsURLConnection instance by url return null."); return null; } a.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); a.setRequestMethod("POST"); a.setDoOutput(true); a.setDoInput(true); a.connect(); OutputStream outputStream = a.getOutputStream(); outputStream.write(f().a("services", "").getBytes("UTF-8")); outputStream.close(); int responseCode = a.getResponseCode(); if (responseCode == 200) { try { inputStream = a.getInputStream(); ?? byteArray = IoUtils.toByteArray(inputStream); IoUtils.closeSecure(inputStream); inputStream = byteArray; } catch (Throwable th) { IoUtils.closeSecure(inputStream); throw th; } } Map headerFields = a.getHeaderFields(); a.disconnect(); long elapsedRealtime2 = SystemClock.elapsedRealtime(); j = System.currentTimeMillis(); this.a = new e(responseCode, headerFields, inputStream == null ? new byte[0] : inputStream, elapsedRealtime2 - elapsedRealtime); this.a.a(c()); this.a.a(d()); this.a.b(j2); this.a.a(j); if (a() != null) { a().a(this.a); } return this.a; } catch (IOException e2) { e = e2; j4 = elapsedRealtime; j3 = 0; long elapsedRealtime3 = SystemClock.elapsedRealtime(); j = System.currentTimeMillis(); Logger.w(i, "RequestCallableV2 run task catch IOException", e); this.a = new e(e, elapsedRealtime3 - j4); j2 = j3; this.a.a(c()); this.a.a(d()); this.a.b(j2); this.a.a(j); if (a() != null) { } return this.a; } } catch (IOException e3) { e = e3; j3 = 0; long elapsedRealtime32 = SystemClock.elapsedRealtime(); j = System.currentTimeMillis(); Logger.w(i, "RequestCallableV2 run task catch IOException", e); this.a = new e(e, elapsedRealtime32 - j4); j2 = j3; this.a.a(c()); this.a.a(d()); this.a.b(j2); this.a.a(j); if (a() != null) { } return this.a; } } }