74 lines
3.4 KiB
Java
74 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.common.CommonNaming;
|
||
|
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 z extends TaskApiCall<u, Void> {
|
||
|
@Override // com.huawei.hms.common.internal.TaskApiCall
|
||
|
public int getApiLevel() {
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
public z(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<Void> nnj) {
|
||
|
as.b("HuaweiIdCancelAuthorizationTaskApiCall", "HuaweiIdCancelAuthorizationTaskApiCall doExecute", true);
|
||
|
x.a();
|
||
|
if (responseErrorCode == null) {
|
||
|
as.b("HuaweiIdCancelAuthorizationTaskApiCall", "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("HuaweiIdCancelAuthorizationTaskApiCall", "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("HuaweiIdCancelAuthorizationTaskApiCall", "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("HuaweiIdCancelAuthorizationTaskApiCall", sb.toString(), true);
|
||
|
nnj.c(new ApiException(new Status(errorCode, responseErrorCode.getErrorReason())));
|
||
|
}
|
||
|
} else {
|
||
|
nnj.c(new ApiException(new Status(errorCode, responseErrorCode.getErrorReason())));
|
||
|
}
|
||
|
if (uVar != null) {
|
||
|
HiAnalyticsClient.reportExit(uVar.getContext(), CommonNaming.revokeAccess, getTransactionId(), ar.a(errorCode), errorCode);
|
||
|
}
|
||
|
}
|
||
|
}
|