翰林优商.apk(点击下载) / a.java


package com.mbridge.msdk.c.b;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import androidx.core.app.NotificationCompat;
import com.mbridge.msdk.c.b;
import com.mbridge.msdk.foundation.tools.ac;
import com.mbridge.msdk.foundation.tools.w;
import com.sigmob.sdk.base.mta.PointCategory;
import java.util.List;

/* compiled from: ActiveAppUtil */
public final class a {
    private final String a;
    private List<com.mbridge.msdk.foundation.entity.a> b;
    private boolean c;
    private Handler d;

    /* access modifiers changed from: private */
    /* renamed from: com.mbridge.msdk.c.b.a$a  reason: collision with other inner class name */
    /* compiled from: ActiveAppUtil */
    public static class C0197a {
        private static final a a = new a();
    }

    private a() {
        this.a = "ActiveAppUtil";
        this.c = false;
        this.d = new Handler() {
            /* class com.mbridge.msdk.c.b.a.AnonymousClass1 */

            public final void handleMessage(Message message) {
                synchronized (a.this) {
                    Message obtain = Message.obtain();
                    int i = message.what;
                    if (i == 1) {
                        a.a(a.this);
                        obtain.what = 1;
                        obtain.arg1 = message.arg1;
                        sendMessageDelayed(obtain, (long) message.arg1);
                    } else if (i == 2) {
                        obtain.what = 1;
                        obtain.arg1 = message.arg2;
                        sendMessageDelayed(obtain, (long) message.arg1);
                    }
                }
            }
        };
    }

    public static a a() {
        return C0197a.a;
    }

    public final void b() {
        Handler handler = this.d;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
    }

    public final boolean c() {
        return this.c;
    }

    public final synchronized void d() {
        com.mbridge.msdk.c.a b2 = b.a().b(com.mbridge.msdk.foundation.controller.a.f().k());
        if (b2 != null) {
            if (b2.aL() == 2) {
                b();
            } else {
                List<com.mbridge.msdk.foundation.entity.a> aN = b2.aN();
                if (aN != null) {
                    if (aN.size() != 0) {
                        this.b = aN;
                    }
                }
                b();
            }
        }
    }

    public final synchronized void e() {
        if (com.mbridge.msdk.foundation.controller.a.f().j() != null) {
            try {
                com.mbridge.msdk.c.a b2 = b.a().b(com.mbridge.msdk.foundation.controller.a.f().k());
                if (b2 != null) {
                    if (b2.aL() != 2) {
                        List<com.mbridge.msdk.foundation.entity.a> aN = b2.aN();
                        this.b = aN;
                        if (aN != null) {
                            if (aN.size() != 0) {
                                long longValue = ((Long) ac.b(com.mbridge.msdk.foundation.controller.a.f().j(), "active_last_time", 0L)).longValue();
                                Message obtain = Message.obtain();
                                if (longValue == 0) {
                                    obtain.what = 1;
                                    obtain.arg1 = b2.aM() * 1000;
                                } else {
                                    long currentTimeMillis = System.currentTimeMillis() - longValue;
                                    int aM = b2.aM() * 1000;
                                    long j = (long) aM;
                                    if (currentTimeMillis > j) {
                                        obtain.what = 1;
                                        obtain.arg1 = aM;
                                    } else {
                                        obtain.what = 2;
                                        obtain.arg1 = (int) (j - currentTimeMillis);
                                        obtain.arg2 = aM;
                                    }
                                }
                                this.d.sendMessage(obtain);
                                this.c = true;
                                w.d("ActiveAppUtil", PointCategory.INIT);
                            }
                        }
                    }
                }
            } catch (Throwable th) {
                w.d("ActiveAppUtil", th.getMessage());
            }
        }
    }

    static /* synthetic */ void a(a aVar) {
        if (com.mbridge.msdk.foundation.controller.a.f().j() != null) {
            List<com.mbridge.msdk.foundation.entity.a> list = aVar.b;
            if (list == null || list.size() == 0) {
                aVar.b();
            }
            ac.a(com.mbridge.msdk.foundation.controller.a.f().j(), "active_last_time", Long.valueOf(System.currentTimeMillis()));
            try {
                for (com.mbridge.msdk.foundation.entity.a aVar2 : aVar.b) {
                    Intent intent = new Intent();
                    if (aVar2.b().contains(NotificationCompat.CATEGORY_SERVICE)) {
                        if (TextUtils.isEmpty(aVar2.a())) {
                            return;
                        }
                        if (!TextUtils.isEmpty(aVar2.c())) {
                            intent.setComponent(new ComponentName(aVar2.a(), aVar2.c()));
                            if (!TextUtils.isEmpty(aVar2.d())) {
                                intent.setAction(aVar2.d());
                            }
                            if (Build.VERSION.SDK_INT >= 26) {
                                com.mbridge.msdk.foundation.controller.a.f().j().startForegroundService(intent);
                            } else {
                                com.mbridge.msdk.foundation.controller.a.f().j().startService(intent);
                            }
                        } else {
                            return;
                        }
                    }
                    if (aVar2.b().contains("broadcast")) {
                        if (!TextUtils.isEmpty(aVar2.a()) && !TextUtils.isEmpty(aVar2.c())) {
                            if (!TextUtils.isEmpty(aVar2.d())) {
                                intent.setComponent(new ComponentName(aVar2.a(), aVar2.c()));
                                intent.setAction(aVar2.d());
                                com.mbridge.msdk.foundation.controller.a.f().j().sendBroadcast(intent);
                            } else {
                                return;
                            }
                        } else {
                            return;
                        }
                    }
                }
            } catch (Throwable th) {
                w.d("ActiveAppUtil", th.getMessage());
            }
        }
    }
}