what-the-bank/sources/com/huawei/hms/support/api/client/ResultCallbacks.java

37 lines
1.1 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.huawei.hms.support.api.client;
import com.huawei.hms.common.api.Releasable;
import com.huawei.hms.support.api.client.Result;
import com.huawei.hms.support.log.HMSLog;
@Deprecated
/* loaded from: classes2.dex */
public abstract class ResultCallbacks<R extends Result> implements ResultCallback<R> {
private static final String TAG = "ResultCallbacks";
public abstract void onFailure(Status status);
public abstract void onSuccess(R r);
@Override // com.huawei.hms.support.api.client.ResultCallback
public final void onResult(R r) {
try {
Status status = r.getStatus();
if (status.isSuccess()) {
onSuccess(r);
return;
}
onFailure(status);
if (r instanceof Releasable) {
((Releasable) r).release();
}
} catch (Exception e) {
StringBuilder sb = new StringBuilder("Failed to release ");
sb.append(r);
sb.append(", reason: ");
sb.append(e);
HMSLog.w(TAG, sb.toString());
}
}
}