package e;

import android.content.Context;
import android.content.IntentFilter;
import android.location.Location;
import android.os.PowerManager;
import java.util.Calendar;

/* JADX INFO: loaded from: classes.dex */
public final class h0 extends j0 {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ int f25219c = 0;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ m0 f25220d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final Object f25221e;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public h0(m0 m0Var, xyz.stream.utils.t tVar) {
        super(m0Var);
        this.f25220d = m0Var;
        this.f25221e = tVar;
    }

    @Override // e.j0
    public final int b() {
        long j10;
        boolean z10;
        int i10 = this.f25219c;
        Object obj = this.f25221e;
        switch (i10) {
            case 0:
                if (!c0.a((PowerManager) obj)) {
                    break;
                }
                break;
            default:
                xyz.stream.utils.t tVar = (xyz.stream.utils.t) obj;
                v0 v0Var = (v0) tVar.f36174d;
                if (v0Var.f25346b <= System.currentTimeMillis()) {
                    Location locationO = g0.l.a((Context) tVar.f36172b, "android.permission.ACCESS_COARSE_LOCATION") == 0 ? tVar.o("network") : null;
                    Location locationO2 = g0.l.a((Context) tVar.f36172b, "android.permission.ACCESS_FINE_LOCATION") == 0 ? tVar.o("gps") : null;
                    if (locationO2 == null || locationO == null ? locationO2 != null : locationO2.getTime() > locationO.getTime()) {
                        locationO = locationO2;
                    }
                    if (locationO == null) {
                        int i11 = Calendar.getInstance().get(11);
                        if (i11 < 6 || i11 >= 22) {
                        }
                    } else {
                        v0 v0Var2 = (v0) tVar.f36174d;
                        long jCurrentTimeMillis = System.currentTimeMillis();
                        if (androidx.emoji2.text.l0.f2245d == null) {
                            androidx.emoji2.text.l0.f2245d = new androidx.emoji2.text.l0();
                        }
                        androidx.emoji2.text.l0 l0Var = androidx.emoji2.text.l0.f2245d;
                        l0Var.a(locationO.getLatitude(), locationO.getLongitude(), jCurrentTimeMillis - 86400000);
                        l0Var.a(locationO.getLatitude(), locationO.getLongitude(), jCurrentTimeMillis);
                        boolean z11 = l0Var.f2246a == 1;
                        long j11 = l0Var.f2248c;
                        long j12 = l0Var.f2247b;
                        l0Var.a(locationO.getLatitude(), locationO.getLongitude(), jCurrentTimeMillis + 86400000);
                        long j13 = l0Var.f2248c;
                        if (j11 == -1 || j12 == -1) {
                            j10 = 43200000 + jCurrentTimeMillis;
                        } else {
                            if (jCurrentTimeMillis > j12) {
                                j11 = j13;
                            } else if (jCurrentTimeMillis > j11) {
                                j11 = j12;
                            }
                            j10 = j11 + 60000;
                        }
                        v0Var2.f25345a = z11;
                        v0Var2.f25346b = j10;
                        z10 = v0Var.f25345a;
                    }
                } else {
                    z10 = v0Var.f25345a;
                }
                if (z10) {
                }
                break;
        }
        return 1;
    }

    @Override // e.j0
    public final IntentFilter createIntentFilterForBroadcastReceiver() {
        switch (this.f25219c) {
            case 0:
                IntentFilter intentFilter = new IntentFilter();
                intentFilter.addAction("android.os.action.POWER_SAVE_MODE_CHANGED");
                return intentFilter;
            default:
                IntentFilter intentFilter2 = new IntentFilter();
                intentFilter2.addAction("android.intent.action.TIME_SET");
                intentFilter2.addAction("android.intent.action.TIMEZONE_CHANGED");
                intentFilter2.addAction("android.intent.action.TIME_TICK");
                return intentFilter2;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public h0(m0 m0Var, Context context) {
        super(m0Var);
        this.f25220d = m0Var;
        this.f25221e = (PowerManager) context.getApplicationContext().getSystemService("power");
    }
}
