79 lines
3.6 KiB
Java
79 lines
3.6 KiB
Java
package com.huawei.hms.hwid;
|
|
|
|
import android.app.Activity;
|
|
import android.app.PendingIntent;
|
|
import android.content.Intent;
|
|
import android.content.IntentSender;
|
|
import android.os.Parcelable;
|
|
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.common.ActivityMgr;
|
|
import com.huawei.hms.support.hianalytics.HiAnalyticsClient;
|
|
import com.huawei.hms.utils.UIUtil;
|
|
import o.nNj;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class k extends TaskApiCall<c, Intent> {
|
|
@Override // com.huawei.hms.common.internal.TaskApiCall
|
|
public int getApiLevel() {
|
|
return 1;
|
|
}
|
|
|
|
public k(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<Intent> nnj) {
|
|
if (responseErrorCode == null) {
|
|
as.b("AccountNoticeTaskApiCall", "header is null.", true);
|
|
nnj.c(new ApiException(new Status(2003, "response is null.")));
|
|
return;
|
|
}
|
|
if (responseErrorCode.getStatusCode() == 0 && responseErrorCode.getErrorCode() == 0) {
|
|
as.b("AccountNoticeTaskApiCall", "Jos Notice onResult success.", true);
|
|
a(responseErrorCode.getParcelable(), cVar, responseErrorCode, nnj);
|
|
} else {
|
|
StringBuilder sb = new StringBuilder("Jos Notice onResult failed:");
|
|
sb.append(responseErrorCode.getErrorCode());
|
|
sb.append(",ErrReason:");
|
|
sb.append(responseErrorCode.getErrorReason());
|
|
as.c("AccountNoticeTaskApiCall", sb.toString(), true);
|
|
}
|
|
if (cVar != null) {
|
|
HiAnalyticsClient.reportExit(cVar.getContext(), getUri(), getTransactionId(), responseErrorCode.getStatusCode(), responseErrorCode.getErrorCode());
|
|
}
|
|
}
|
|
|
|
private void a(Parcelable parcelable, c cVar, ResponseErrorCode responseErrorCode, nNj<Intent> nnj) {
|
|
Activity currentActivity = ActivityMgr.INST.getCurrentActivity();
|
|
if (currentActivity == null || currentActivity.isFinishing() || currentActivity.isDestroyed()) {
|
|
as.b("AccountNoticeTaskApiCall", "launchNoticeActivity failed, launchActivity is invalid", true);
|
|
return;
|
|
}
|
|
if (parcelable instanceof Intent) {
|
|
try {
|
|
currentActivity.startActivity((Intent) parcelable);
|
|
} catch (Exception unused) {
|
|
as.d("AccountNoticeTaskApiCall", "Jos Notice startActivity meet exception", true);
|
|
}
|
|
} else if (parcelable instanceof PendingIntent) {
|
|
PendingIntent pendingIntent = (PendingIntent) parcelable;
|
|
try {
|
|
if (UIUtil.isBackground(cVar.getContext())) {
|
|
as.b("AccountNoticeTaskApiCall", "ui isBackground.", true);
|
|
nnj.c(new ApiException(new Status(responseErrorCode.getErrorCode(), responseErrorCode.getErrorReason(), pendingIntent)));
|
|
} else {
|
|
currentActivity.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0);
|
|
}
|
|
} catch (IntentSender.SendIntentException unused2) {
|
|
as.d("AccountNoticeTaskApiCall", "Jos Notice startIntentSender meet exception", true);
|
|
}
|
|
}
|
|
}
|
|
}
|