package p037.p123.p124.p132;

import android.app.Notification;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import androidx.work.impl.foreground.SystemForegroundService;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import p037.p123.AbstractC2562;
import p037.p123.C2557;
import p037.p123.p124.C2604;
import p037.p123.p124.InterfaceC2586;
import p037.p123.p124.p129.C2627;
import p037.p123.p124.p129.InterfaceC2626;
import p037.p123.p124.p133.C2676;
import p037.p123.p124.p134.RunnableC2708;
import p037.p123.p124.p134.p136.C2731;
import p037.p123.p124.p134.p136.InterfaceC2730;

/* JADX INFO: renamed from: މ.ޗ.ޘ.ގ.ހ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C2650 implements InterfaceC2626, InterfaceC2586 {

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public static final String f8283 = AbstractC2562.m4622("SystemFgDispatcher");

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public Context f8284;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public C2604 f8285;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final InterfaceC2730 f8286;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final Object f8287 = new Object();

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public String f8288;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public C2557 f8289;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final Map<String, C2557> f8290;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public final Map<String, C2676> f8291;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public final Set<C2676> f8292;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public final C2627 f8293;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public InterfaceC2651 f8294;

    /* JADX INFO: renamed from: މ.ޗ.ޘ.ގ.ހ$֏, reason: contains not printable characters */
    public interface InterfaceC2651 {
        void stop();

        /* JADX INFO: renamed from: ֏ */
        void mo871(int i);

        /* JADX INFO: renamed from: ֏ */
        void mo872(int i, int i2, Notification notification);

        /* JADX INFO: renamed from: ֏ */
        void mo873(int i, Notification notification);
    }

    public C2650(Context context) {
        this.f8284 = context;
        C2604 c2604M4662 = C2604.m4662(this.f8284);
        this.f8285 = c2604M4662;
        this.f8286 = c2604M4662.f8141;
        this.f8288 = null;
        this.f8289 = null;
        this.f8290 = new LinkedHashMap();
        this.f8292 = new HashSet();
        this.f8291 = new HashMap();
        this.f8293 = new C2627(this.f8284, this.f8286, this);
        this.f8285.f8143.m4642(this);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static Intent m4731(Context context, String str, C2557 c2557) {
        Intent intent = new Intent(context, (Class<?>) SystemForegroundService.class);
        intent.setAction("ACTION_NOTIFY");
        intent.putExtra("KEY_NOTIFICATION_ID", c2557.f8060);
        intent.putExtra("KEY_FOREGROUND_SERVICE_TYPE", c2557.f8061);
        intent.putExtra("KEY_NOTIFICATION", c2557.f8062);
        intent.putExtra("KEY_WORKSPEC_ID", str);
        return intent;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static Intent m4732(Context context, String str, C2557 c2557) {
        Intent intent = new Intent(context, (Class<?>) SystemForegroundService.class);
        intent.setAction("ACTION_START_FOREGROUND");
        intent.putExtra("KEY_WORKSPEC_ID", str);
        intent.putExtra("KEY_NOTIFICATION_ID", c2557.f8060);
        intent.putExtra("KEY_FOREGROUND_SERVICE_TYPE", c2557.f8061);
        intent.putExtra("KEY_NOTIFICATION", c2557.f8062);
        intent.putExtra("KEY_WORKSPEC_ID", str);
        return intent;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m4733() {
        this.f8294 = null;
        synchronized (this.f8287) {
            this.f8293.m4711();
        }
        this.f8285.f8143.m4645(this);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m4734(Intent intent) {
        int i = 0;
        int intExtra = intent.getIntExtra("KEY_NOTIFICATION_ID", 0);
        int intExtra2 = intent.getIntExtra("KEY_FOREGROUND_SERVICE_TYPE", 0);
        String stringExtra = intent.getStringExtra("KEY_WORKSPEC_ID");
        Notification notification = (Notification) intent.getParcelableExtra("KEY_NOTIFICATION");
        AbstractC2562.m4623().mo4625(f8283, String.format("Notifying with (id: %s, workSpecId: %s, notificationType: %s)", Integer.valueOf(intExtra), stringExtra, Integer.valueOf(intExtra2)), new Throwable[0]);
        if (notification == null || this.f8294 == null) {
            return;
        }
        this.f8290.put(stringExtra, new C2557(intExtra, notification, intExtra2));
        if (TextUtils.isEmpty(this.f8288)) {
            this.f8288 = stringExtra;
            this.f8294.mo872(intExtra, intExtra2, notification);
            return;
        }
        this.f8294.mo873(intExtra, notification);
        if (intExtra2 == 0 || Build.VERSION.SDK_INT < 29) {
            return;
        }
        Iterator<Map.Entry<String, C2557>> it = this.f8290.entrySet().iterator();
        while (it.hasNext()) {
            i |= it.next().getValue().f8061;
        }
        C2557 c2557 = this.f8290.get(this.f8288);
        if (c2557 != null) {
            this.f8294.mo872(c2557.f8060, i, c2557.f8062);
        }
    }

    @Override // p037.p123.p124.InterfaceC2586
    /* JADX INFO: renamed from: ֏ */
    public void mo870(String str, boolean z) {
        InterfaceC2651 interfaceC2651;
        Map.Entry<String, C2557> entry;
        synchronized (this.f8287) {
            C2676 c2676Remove = this.f8291.remove(str);
            if (c2676Remove != null ? this.f8292.remove(c2676Remove) : false) {
                this.f8293.m4712(this.f8292);
            }
        }
        this.f8289 = this.f8290.remove(str);
        if (!str.equals(this.f8288)) {
            C2557 c2557 = this.f8289;
            if (c2557 == null || (interfaceC2651 = this.f8294) == null) {
                return;
            }
            interfaceC2651.mo871(c2557.f8060);
            return;
        }
        if (this.f8290.size() > 0) {
            Iterator<Map.Entry<String, C2557>> it = this.f8290.entrySet().iterator();
            Map.Entry<String, C2557> next = it.next();
            while (true) {
                entry = next;
                if (!it.hasNext()) {
                    break;
                } else {
                    next = it.next();
                }
            }
            this.f8288 = entry.getKey();
            if (this.f8294 != null) {
                C2557 value = entry.getValue();
                this.f8294.mo872(value.f8060, value.f8061, value.f8062);
                this.f8294.mo871(value.f8060);
            }
        }
    }

    @Override // p037.p123.p124.p129.InterfaceC2626
    /* JADX INFO: renamed from: ֏ */
    public void mo879(List<String> list) {
        if (list.isEmpty()) {
            return;
        }
        for (String str : list) {
            AbstractC2562.m4623().mo4625(f8283, String.format("Constraints unmet for WorkSpec %s", str), new Throwable[0]);
            C2604 c2604 = this.f8285;
            ((C2731) c2604.f8141).f8440.execute(new RunnableC2708(c2604, str, true));
        }
    }

    @Override // p037.p123.p124.p129.InterfaceC2626
    /* JADX INFO: renamed from: ؠ */
    public void mo880(List<String> list) {
    }
}
