75 lines
3.4 KiB
Java
75 lines
3.4 KiB
Java
package com.huawei.hms.hwid;
|
|
|
|
import android.text.TextUtils;
|
|
import com.huawei.hms.common.ApiException;
|
|
import com.huawei.hms.common.ResolvableApiException;
|
|
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.core.CommonCode;
|
|
import com.huawei.hms.support.api.hwid.RevokeAccessResult;
|
|
import com.huawei.hms.support.hianalytics.HiAnalyticsClient;
|
|
import o.nNj;
|
|
import org.json.JSONException;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class h extends TaskApiCall<c, Void> {
|
|
@Override // com.huawei.hms.common.internal.TaskApiCall
|
|
public int getApiLevel() {
|
|
return 1;
|
|
}
|
|
|
|
public h(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(c cVar, ResponseErrorCode responseErrorCode, String str, nNj<Void> nnj) {
|
|
as.b("AccountCancelAuthorizationTaskApiCall", "AccountCancelAuthorizationTaskApiCall doExecute", true);
|
|
f.a();
|
|
if (responseErrorCode == null) {
|
|
as.b("AccountCancelAuthorizationTaskApiCall", "response is null.", true);
|
|
nnj.c(new ApiException(new Status(2003, "response is null.")));
|
|
return;
|
|
}
|
|
int errorCode = responseErrorCode.getErrorCode();
|
|
if (errorCode != 0 && CommonCode.Resolution.HAS_RESOLUTION.equals(responseErrorCode.getResolution())) {
|
|
as.b("AccountCancelAuthorizationTaskApiCall", "apk version is low or is not exist.", true);
|
|
Status status = new Status(errorCode, responseErrorCode.getErrorReason());
|
|
ao.a(responseErrorCode, status);
|
|
nnj.c(new ResolvableApiException(status));
|
|
return;
|
|
}
|
|
if (!TextUtils.isEmpty(str)) {
|
|
if ("{}".equals(str)) {
|
|
as.b("AccountCancelAuthorizationTaskApiCall", "CancelAuthorization complete, body is null", true);
|
|
nnj.c(new ApiException(new Status(errorCode, responseErrorCode.getErrorReason())));
|
|
return;
|
|
}
|
|
try {
|
|
RevokeAccessResult fromJson = new RevokeAccessResult().fromJson(str);
|
|
if (!fromJson.isSuccess()) {
|
|
Status status2 = fromJson.getStatus();
|
|
nnj.c(new ApiException(new Status(status2.getStatusCode(), status2.getStatusMessage())));
|
|
} else {
|
|
nnj.b(null);
|
|
}
|
|
} catch (JSONException e) {
|
|
StringBuilder sb = new StringBuilder("JSONException:");
|
|
sb.append(e.getClass().getSimpleName());
|
|
as.b("AccountCancelAuthorizationTaskApiCall", sb.toString(), true);
|
|
Status status3 = new Status(errorCode, responseErrorCode.getErrorReason());
|
|
ao.a(responseErrorCode, status3);
|
|
nnj.c(new ApiException(status3));
|
|
}
|
|
} else {
|
|
nnj.c(new ApiException(new Status(errorCode, responseErrorCode.getErrorReason())));
|
|
}
|
|
if (cVar != null) {
|
|
HiAnalyticsClient.reportExit(cVar.getContext(), getUri(), getTransactionId(), ar.a(errorCode), errorCode);
|
|
}
|
|
}
|
|
}
|