package pg;

import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;
import kotlin.text.y;
import wg.i0;
import wg.v;

/* loaded from: classes4.dex */
public final class a {

    /* renamed from: b, reason: collision with root package name */
    public static final C0742a f32617b = new C0742a(null);

    /* renamed from: a, reason: collision with root package name */
    private final v f32618a;

    /* renamed from: pg.a$a, reason: collision with other inner class name */
    /* loaded from: classes4.dex */
    public static final class C0742a {
        private C0742a() {
        }

        public /* synthetic */ C0742a(k kVar) {
            this();
        }
    }

    public a() {
        i0 f10 = i0.f();
        t.f(f10, "ServiceProvider.getInstance()");
        this.f32618a = f10.d().a("AdobeMobile_ConfigState");
    }

    private final String a() {
        i0 f10 = i0.f();
        t.f(f10, "ServiceProvider.getInstance()");
        return f10.e().m("ADBMobileAppID");
    }

    private final String b() {
        v vVar = this.f32618a;
        if (vVar != null) {
            return vVar.getString("config.appID", null);
        }
        return null;
    }

    public final String c() {
        String b10 = b();
        if (b10 != null) {
            wg.t.e("Configuration", "AppIdManager", "Retrieved AppId from persistence.", new Object[0]);
        }
        if (b10 == null && (b10 = a()) != null) {
            wg.t.e("Configuration", "AppIdManager", "Retrieved AppId from manifest.", new Object[0]);
            e(b10);
        }
        return b10;
    }

    public final void d() {
        wg.t.e("Configuration", "AppIdManager", "Attempting to set empty App Id into persistence.", new Object[0]);
        v vVar = this.f32618a;
        if (vVar != null) {
            vVar.remove("config.appID");
        }
    }

    public final void e(String appId) {
        boolean C;
        t.g(appId, "appId");
        C = y.C(appId);
        if (C) {
            wg.t.e("Configuration", "AppIdManager", "Attempting to set empty App Id into persistence.", new Object[0]);
            return;
        }
        v vVar = this.f32618a;
        if (vVar != null) {
            vVar.e("config.appID", appId);
        }
    }
}
