package com.google.android.play.core.integrity;

import C3.A;
import android.os.Bundle;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.TaskCompletionSource;

/* JADX INFO: loaded from: classes3.dex */
final class ai extends C3.w {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    final /* synthetic */ aj f13598a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final A f13599b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final TaskCompletionSource f13600c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public ai(aj ajVar, TaskCompletionSource taskCompletionSource) {
        super("com.google.android.play.core.integrity.protocol.IIntegrityServiceCallback");
        this.f13598a = ajVar;
        this.f13599b = new A("OnRequestIntegrityTokenCallback");
        this.f13600c = taskCompletionSource;
    }

    @Override // C3.x
    public final void b(Bundle bundle) {
        this.f13598a.f13601a.d(this.f13600c);
        this.f13599b.b("onRequestIntegrityToken", new Object[0]);
        ApiException apiExceptionA = this.f13598a.f13605e.a(bundle);
        if (apiExceptionA != null) {
            this.f13600c.trySetException(apiExceptionA);
            return;
        }
        String string = bundle.getString("token");
        if (string == null) {
            this.f13600c.trySetException(new IntegrityServiceException(-100, null));
            return;
        }
        ah ahVar = new ah(this, this.f13598a.f13603c, bundle.getLong("request.token.sid"));
        TaskCompletionSource taskCompletionSource = this.f13600c;
        a aVar = new a();
        aVar.b(string);
        aVar.a(ahVar);
        taskCompletionSource.trySetResult(aVar.c());
    }
}
