package com.seewo.ota;

import android.app.Application;
import android.os.SystemProperties;
import android.provider.Settings;
import android.text.TextUtils;
import com.seewo.ota.util.l;
import com.seewo.ota.util.n;
import com.seewo.ota.v.p;
import com.seewo.ota.v.u.r;
import d.e.a.a;

/* JADX INFO: loaded from: classes.dex */
public class OTAApplication extends Application {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static OTAApplication f1907b;

    private String a() {
        String string = SystemProperties.get("persist.sys.ota.mock_url", "");
        if (TextUtils.isEmpty(string)) {
            string = Settings.Global.getString(getContentResolver(), "persist.sys.ota.mock_url");
        }
        return getResources().getBoolean(R.bool.is_CN) ? "https://pub.cvte.com/" : TextUtils.isEmpty(string) ? getResources().getString(R.string.overseas_base_url) : string;
    }

    public static Application b() {
        return f1907b;
    }

    private void c() {
        try {
            SystemProperties.set("persist.sys.seewo.ota.url", a());
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    @Override // android.app.Application
    public void onCreate() {
        super.onCreate();
        f1907b = this;
        com.seewo.ota.data.b.i().m(this);
        d.e.e.d.g().a(this, com.seewo.ota.data.b.i().n(), true, a());
        if (com.seewo.ota.data.b.i().r()) {
            d.e.a.a.g().h(this, a.d.SERVER);
        }
        d.e.g.a.o().l(this);
        n.b().c(this);
        p.r().w(this);
        r.d().f(this);
        com.seewo.ota.t.n.j().m(this);
        com.seewo.ota.v.t.d.f().k(this);
        c();
        l.a.c(this);
    }

    @Override // android.app.Application
    public void onTerminate() {
        super.onTerminate();
        p.r().D();
    }
}
