package com.huawei.hms.hwid; import android.text.TextUtils; import com.huawei.hms.common.ApiException; import com.huawei.hms.common.internal.ResponseErrorCode; import com.huawei.hms.common.internal.TaskApiCall; import com.huawei.hms.support.api.client.Status; import com.huawei.hms.support.api.entity.common.CommonNaming; import com.huawei.hms.support.api.hwid.SignOutResult; import com.huawei.hms.support.hianalytics.HiAnalyticsClient; import o.nNj; import org.json.JSONException; /* loaded from: classes2.dex */ public class ad extends TaskApiCall { @Override // com.huawei.hms.common.internal.TaskApiCall public int getApiLevel() { return 1; } public ad(String str, String str2, String str3) { super(str, str2, str3); } /* JADX INFO: Access modifiers changed from: protected */ @Override // com.huawei.hms.common.internal.TaskApiCall /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void doExecute(u uVar, ResponseErrorCode responseErrorCode, String str, nNj nnj) { if (responseErrorCode == null) { as.b("[HUAWEIIDSDK]HuaweiIdSignOutTaskApiCall", "response is null.", true); nnj.c(new ApiException(new Status(2003, "response is null."))); return; } a(responseErrorCode, str); int errorCode = responseErrorCode.getErrorCode(); if (!TextUtils.isEmpty(str)) { try { SignOutResult fromJson = new SignOutResult().fromJson(str); errorCode = fromJson.getStatus().getStatusCode(); if (fromJson.isSuccess()) { nnj.b(null); } else { nnj.c(new ApiException(fromJson.getStatus())); } } catch (JSONException unused) { nnj.c(new ApiException(new Status(responseErrorCode.getErrorCode(), responseErrorCode.getErrorReason()))); } } else { nnj.c(new ApiException(new Status(responseErrorCode.getErrorCode(), responseErrorCode.getErrorReason()))); } if (uVar != null) { HiAnalyticsClient.reportExit(uVar.getContext(), CommonNaming.signout, getTransactionId(), ar.a(errorCode), errorCode); } } private void a(ResponseErrorCode responseErrorCode, String str) { StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new StringBuilder("headerErrorCode:"); sb2.append(responseErrorCode.getErrorCode()); sb.append(sb2.toString()); as.b("[HUAWEIIDSDK]HuaweiIdSignOutTaskApiCall", sb.toString(), true); } }