大漢易經書院.apk(点击下载) / dr.java


package com.xiaomi.push;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.text.TextUtils;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.xiaomi.channel.commonutils.logger.b;
import com.xiaomi.push.al;
import com.xiaomi.push.service.ax;

public class dr {
    private static volatile dr a;

    /* renamed from: a  reason: collision with other field name */
    private Context f6867a;

    /* renamed from: a  reason: collision with other field name */
    private a f6868a;

    public interface a {
        void a();
    }

    private dr(Context context) {
        this.f6867a = context;
    }

    public static int a(int i) {
        return Math.max(60, i);
    }

    public static dr a(Context context) {
        if (a == null) {
            synchronized (dr.class) {
                if (a == null) {
                    a = new dr(context);
                }
            }
        }
        return a;
    }

    private void a(ax axVar, al alVar, boolean z) {
        if (axVar.a(ho.UploadSwitch.a(), true)) {
            dw dwVar = new dw(this.f6867a);
            if (z) {
                alVar.a((al.a) dwVar, a(axVar.a(ho.UploadFrequency.a(), RemoteMessageConst.DEFAULT_TTL)));
            } else {
                alVar.m9119a((al.a) dwVar);
            }
        }
    }

    private boolean a() {
        if (Build.VERSION.SDK_INT >= 14) {
            try {
                ((Application) (this.f6867a instanceof Application ? this.f6867a : this.f6867a.getApplicationContext())).registerActivityLifecycleCallbacks(new dl(this.f6867a, String.valueOf(System.currentTimeMillis() / 1000)));
                return true;
            } catch (Exception e) {
                b.a(e);
            }
        }
        return false;
    }

    /* access modifiers changed from: private */
    public void b() {
        a aVar;
        al a2 = al.a(this.f6867a);
        ax a3 = ax.a(this.f6867a);
        SharedPreferences sharedPreferences = this.f6867a.getSharedPreferences("mipush_extra", 0);
        long currentTimeMillis = System.currentTimeMillis();
        long j = sharedPreferences.getLong("first_try_ts", currentTimeMillis);
        if (j == currentTimeMillis) {
            sharedPreferences.edit().putLong("first_try_ts", currentTimeMillis).commit();
        }
        if (Math.abs(currentTimeMillis - j) >= 172800000) {
            a(a3, a2, false);
            if (a3.a(ho.StorageCollectionSwitch.a(), true)) {
                int a4 = a(a3.a(ho.StorageCollectionFrequency.a(), RemoteMessageConst.DEFAULT_TTL));
                a2.a(new dv(this.f6867a, a4), a4, 0);
            }
            boolean a5 = a3.a(ho.AppIsInstalledCollectionSwitch.a(), false);
            String a6 = a3.a(ho.AppIsInstalledList.a(), (String) null);
            if (a5 && !TextUtils.isEmpty(a6)) {
                int a7 = a(a3.a(ho.AppIsInstalledCollectionFrequency.a(), RemoteMessageConst.DEFAULT_TTL));
                a2.a(new dt(this.f6867a, a7, a6), a7, 0);
            }
            if (l.m9609a(this.f6867a) && (aVar = this.f6868a) != null) {
                aVar.a();
            }
            if (a3.a(ho.ActivityTSSwitch.a(), false)) {
                a();
            }
            a(a3, a2, true);
        }
    }

    /* renamed from: a  reason: collision with other method in class */
    public void m9224a() {
        al.a(this.f6867a).a(new ds(this));
    }
}