package com.amplifyframework.api.aws;

import java.io.IOException;
import uq.w;

/* loaded from: classes4.dex */
final class UserAgentInterceptor implements uq.w {
    private final UserAgentProvider userAgentProvider;

    /* loaded from: classes4.dex */
    interface UserAgentProvider {
        String getUserAgent();
    }

    private UserAgentInterceptor(UserAgentProvider userAgentProvider) {
        this.userAgentProvider = userAgentProvider;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public static UserAgentInterceptor using(UserAgentProvider userAgentProvider) {
        return new UserAgentInterceptor(userAgentProvider);
    }

    @Override // uq.w
    public uq.d0 intercept(w.a aVar) throws IOException {
        return aVar.b(aVar.g().h().m("User-Agent", this.userAgentProvider.getUserAgent()).b());
    }
}
