package X6FRs_4.IMuAHx_6.Mqv2r_3;

import X6FRs_4.IMuAHx_6.Mqv2r_3.IFxWkV_5;
import android.app.Notification;
import android.app.RemoteInput;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.SparseArray;
import android.widget.RemoteViews;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* compiled from: NotificationCompatBuilder.java */
/* loaded from: classes.dex */
public class IMuAHx_6 implements X6FRs_4 {
    public int KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final IFxWkV_5.QxJ9d_1 f458KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final Notification.Builder f459KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public RemoteViews f461KQgRr5e_0;
    public RemoteViews PGPF6hQ_2;
    public RemoteViews QxJ9d_1;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final List<Bundle> f462KQgRr5e_0 = new ArrayList();

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final Bundle f460KQgRr5e_0 = new Bundle();

    public IMuAHx_6(IFxWkV_5.QxJ9d_1 qxJ9d_1) {
        ArrayList<String> arrayList;
        this.f458KQgRr5e_0 = qxJ9d_1;
        if (Build.VERSION.SDK_INT >= 26) {
            this.f459KQgRr5e_0 = new Notification.Builder(qxJ9d_1.f431KQgRr5e_0, qxJ9d_1.f442Mqv2r_3);
        } else {
            this.f459KQgRr5e_0 = new Notification.Builder(qxJ9d_1.f431KQgRr5e_0);
        }
        Notification notification = qxJ9d_1.f449QxJ9d_1;
        this.f459KQgRr5e_0.setWhen(notification.when).setSmallIcon(notification.icon, notification.iconLevel).setContent(notification.contentView).setTicker(notification.tickerText, qxJ9d_1.f434KQgRr5e_0).setVibrate(notification.vibrate).setLights(notification.ledARGB, notification.ledOnMS, notification.ledOffMS).setOngoing((notification.flags & 2) != 0).setOnlyAlertOnce((notification.flags & 8) != 0).setAutoCancel((notification.flags & 16) != 0).setDefaults(notification.defaults).setContentTitle(qxJ9d_1.f435KQgRr5e_0).setContentText(qxJ9d_1.f452QxJ9d_1).setContentInfo(qxJ9d_1.f445PGPF6hQ_2).setContentIntent(qxJ9d_1.f430KQgRr5e_0).setDeleteIntent(notification.deleteIntent).setFullScreenIntent(qxJ9d_1.f450QxJ9d_1, (notification.flags & RecyclerView.WGk6X_27.FLAG_IGNORE) != 0).setLargeIcon(qxJ9d_1.f432KQgRr5e_0).setNumber(qxJ9d_1.KQgRr5e_0).setProgress(qxJ9d_1.PGPF6hQ_2, qxJ9d_1.f3116Mqv2r_3, qxJ9d_1.f448PGPF6hQ_2);
        if (Build.VERSION.SDK_INT < 21) {
            this.f459KQgRr5e_0.setSound(notification.sound, notification.audioStreamType);
        }
        if (Build.VERSION.SDK_INT >= 16) {
            this.f459KQgRr5e_0.setSubText(qxJ9d_1.f441Mqv2r_3).setUsesChronometer(qxJ9d_1.f455QxJ9d_1).setPriority(qxJ9d_1.QxJ9d_1);
            Iterator<IFxWkV_5.KQgRr5e_0> it = qxJ9d_1.f437KQgRr5e_0.iterator();
            while (it.hasNext()) {
                KQgRr5e_0(it.next());
            }
            Bundle bundle = qxJ9d_1.f433KQgRr5e_0;
            if (bundle != null) {
                this.f460KQgRr5e_0.putAll(bundle);
            }
            if (Build.VERSION.SDK_INT < 20) {
                if (qxJ9d_1.f457X6FRs_4) {
                    this.f460KQgRr5e_0.putBoolean("android.support.localOnly", true);
                }
                String str = qxJ9d_1.f436KQgRr5e_0;
                if (str != null) {
                    this.f460KQgRr5e_0.putString("android.support.groupKey", str);
                    if (qxJ9d_1.f443Mqv2r_3) {
                        this.f460KQgRr5e_0.putBoolean("android.support.isGroupSummary", true);
                    } else {
                        this.f460KQgRr5e_0.putBoolean("android.support.useSideChannel", true);
                    }
                }
                String str2 = qxJ9d_1.f453QxJ9d_1;
                if (str2 != null) {
                    this.f460KQgRr5e_0.putString("android.support.sortKey", str2);
                }
            }
            this.f461KQgRr5e_0 = qxJ9d_1.f451QxJ9d_1;
            this.QxJ9d_1 = qxJ9d_1.f444PGPF6hQ_2;
        }
        if (Build.VERSION.SDK_INT >= 19) {
            this.f459KQgRr5e_0.setShowWhen(qxJ9d_1.f438KQgRr5e_0);
            if (Build.VERSION.SDK_INT < 21 && (arrayList = qxJ9d_1.f447PGPF6hQ_2) != null && !arrayList.isEmpty()) {
                Bundle bundle2 = this.f460KQgRr5e_0;
                ArrayList<String> arrayList2 = qxJ9d_1.f447PGPF6hQ_2;
                bundle2.putStringArray("android.people", (String[]) arrayList2.toArray(new String[arrayList2.size()]));
            }
        }
        if (Build.VERSION.SDK_INT >= 20) {
            this.f459KQgRr5e_0.setLocalOnly(qxJ9d_1.f457X6FRs_4).setGroup(qxJ9d_1.f436KQgRr5e_0).setGroupSummary(qxJ9d_1.f443Mqv2r_3).setSortKey(qxJ9d_1.f453QxJ9d_1);
            this.KQgRr5e_0 = qxJ9d_1.f3113FSaI4_7;
        }
        if (Build.VERSION.SDK_INT >= 21) {
            this.f459KQgRr5e_0.setCategory(qxJ9d_1.f446PGPF6hQ_2).setColor(qxJ9d_1.f3117X6FRs_4).setVisibility(qxJ9d_1.f3114IFxWkV_5).setPublicVersion(qxJ9d_1.f429KQgRr5e_0).setSound(notification.sound, notification.audioAttributes);
            Iterator<String> it2 = qxJ9d_1.f447PGPF6hQ_2.iterator();
            while (it2.hasNext()) {
                this.f459KQgRr5e_0.addPerson(it2.next());
            }
            this.PGPF6hQ_2 = qxJ9d_1.f440Mqv2r_3;
            if (qxJ9d_1.f454QxJ9d_1.size() > 0) {
                Bundle bundle3 = qxJ9d_1.m307KQgRr5e_0().getBundle("android.car.EXTENSIONS");
                bundle3 = bundle3 == null ? new Bundle() : bundle3;
                Bundle bundle4 = new Bundle();
                for (int i = 0; i < qxJ9d_1.f454QxJ9d_1.size(); i++) {
                    bundle4.putBundle(Integer.toString(i), FSaI4_7.KQgRr5e_0(qxJ9d_1.f454QxJ9d_1.get(i)));
                }
                bundle3.putBundle("invisible_actions", bundle4);
                qxJ9d_1.m307KQgRr5e_0().putBundle("android.car.EXTENSIONS", bundle3);
                this.f460KQgRr5e_0.putBundle("android.car.EXTENSIONS", bundle3);
            }
        }
        if (Build.VERSION.SDK_INT >= 24) {
            this.f459KQgRr5e_0.setExtras(qxJ9d_1.f433KQgRr5e_0).setRemoteInputHistory(qxJ9d_1.f439KQgRr5e_0);
            RemoteViews remoteViews = qxJ9d_1.f451QxJ9d_1;
            if (remoteViews != null) {
                this.f459KQgRr5e_0.setCustomContentView(remoteViews);
            }
            RemoteViews remoteViews2 = qxJ9d_1.f444PGPF6hQ_2;
            if (remoteViews2 != null) {
                this.f459KQgRr5e_0.setCustomBigContentView(remoteViews2);
            }
            RemoteViews remoteViews3 = qxJ9d_1.f440Mqv2r_3;
            if (remoteViews3 != null) {
                this.f459KQgRr5e_0.setCustomHeadsUpContentView(remoteViews3);
            }
        }
        if (Build.VERSION.SDK_INT >= 26) {
            this.f459KQgRr5e_0.setBadgeIconType(qxJ9d_1.f3115IMuAHx_6).setShortcutId(qxJ9d_1.f456X6FRs_4).setTimeoutAfter(qxJ9d_1.f427KQgRr5e_0).setGroupAlertBehavior(qxJ9d_1.f3113FSaI4_7);
            if (qxJ9d_1.f426IMuAHx_6) {
                this.f459KQgRr5e_0.setColorized(qxJ9d_1.f425IFxWkV_5);
            }
            if (TextUtils.isEmpty(qxJ9d_1.f442Mqv2r_3)) {
                return;
            }
            this.f459KQgRr5e_0.setSound(null).setDefaults(0).setLights(0, 0, 0).setVibrate(null);
        }
    }

    public Notification KQgRr5e_0() {
        Bundle KQgRr5e_0;
        RemoteViews PGPF6hQ_2;
        RemoteViews KQgRr5e_02;
        IFxWkV_5.PGPF6hQ_2 pGPF6hQ_2 = this.f458KQgRr5e_0.f428KQgRr5e_0;
        if (pGPF6hQ_2 != null) {
            pGPF6hQ_2.m305KQgRr5e_0((X6FRs_4) this);
        }
        RemoteViews QxJ9d_1 = pGPF6hQ_2 != null ? pGPF6hQ_2.QxJ9d_1(this) : null;
        Notification QxJ9d_12 = QxJ9d_1();
        if (QxJ9d_1 != null) {
            QxJ9d_12.contentView = QxJ9d_1;
        } else {
            RemoteViews remoteViews = this.f458KQgRr5e_0.f451QxJ9d_1;
            if (remoteViews != null) {
                QxJ9d_12.contentView = remoteViews;
            }
        }
        if (Build.VERSION.SDK_INT >= 16 && pGPF6hQ_2 != null && (KQgRr5e_02 = pGPF6hQ_2.KQgRr5e_0((X6FRs_4) this)) != null) {
            QxJ9d_12.bigContentView = KQgRr5e_02;
        }
        if (Build.VERSION.SDK_INT >= 21 && pGPF6hQ_2 != null && (PGPF6hQ_2 = this.f458KQgRr5e_0.f428KQgRr5e_0.PGPF6hQ_2(this)) != null) {
            QxJ9d_12.headsUpContentView = PGPF6hQ_2;
        }
        if (Build.VERSION.SDK_INT >= 16 && pGPF6hQ_2 != null && (KQgRr5e_0 = IFxWkV_5.KQgRr5e_0(QxJ9d_12)) != null) {
            pGPF6hQ_2.KQgRr5e_0(KQgRr5e_0);
        }
        return QxJ9d_12;
    }

    public Notification QxJ9d_1() {
        int i = Build.VERSION.SDK_INT;
        if (i >= 26) {
            return this.f459KQgRr5e_0.build();
        }
        if (i >= 24) {
            Notification build = this.f459KQgRr5e_0.build();
            if (this.KQgRr5e_0 != 0) {
                if (build.getGroup() != null && (build.flags & RecyclerView.WGk6X_27.FLAG_ADAPTER_POSITION_UNKNOWN) != 0 && this.KQgRr5e_0 == 2) {
                    KQgRr5e_0(build);
                }
                if (build.getGroup() != null && (build.flags & RecyclerView.WGk6X_27.FLAG_ADAPTER_POSITION_UNKNOWN) == 0 && this.KQgRr5e_0 == 1) {
                    KQgRr5e_0(build);
                }
            }
            return build;
        } else if (i >= 21) {
            this.f459KQgRr5e_0.setExtras(this.f460KQgRr5e_0);
            Notification build2 = this.f459KQgRr5e_0.build();
            RemoteViews remoteViews = this.f461KQgRr5e_0;
            if (remoteViews != null) {
                build2.contentView = remoteViews;
            }
            RemoteViews remoteViews2 = this.QxJ9d_1;
            if (remoteViews2 != null) {
                build2.bigContentView = remoteViews2;
            }
            RemoteViews remoteViews3 = this.PGPF6hQ_2;
            if (remoteViews3 != null) {
                build2.headsUpContentView = remoteViews3;
            }
            if (this.KQgRr5e_0 != 0) {
                if (build2.getGroup() != null && (build2.flags & RecyclerView.WGk6X_27.FLAG_ADAPTER_POSITION_UNKNOWN) != 0 && this.KQgRr5e_0 == 2) {
                    KQgRr5e_0(build2);
                }
                if (build2.getGroup() != null && (build2.flags & RecyclerView.WGk6X_27.FLAG_ADAPTER_POSITION_UNKNOWN) == 0 && this.KQgRr5e_0 == 1) {
                    KQgRr5e_0(build2);
                }
            }
            return build2;
        } else if (i >= 20) {
            this.f459KQgRr5e_0.setExtras(this.f460KQgRr5e_0);
            Notification build3 = this.f459KQgRr5e_0.build();
            RemoteViews remoteViews4 = this.f461KQgRr5e_0;
            if (remoteViews4 != null) {
                build3.contentView = remoteViews4;
            }
            RemoteViews remoteViews5 = this.QxJ9d_1;
            if (remoteViews5 != null) {
                build3.bigContentView = remoteViews5;
            }
            if (this.KQgRr5e_0 != 0) {
                if (build3.getGroup() != null && (build3.flags & RecyclerView.WGk6X_27.FLAG_ADAPTER_POSITION_UNKNOWN) != 0 && this.KQgRr5e_0 == 2) {
                    KQgRr5e_0(build3);
                }
                if (build3.getGroup() != null && (build3.flags & RecyclerView.WGk6X_27.FLAG_ADAPTER_POSITION_UNKNOWN) == 0 && this.KQgRr5e_0 == 1) {
                    KQgRr5e_0(build3);
                }
            }
            return build3;
        } else if (i >= 19) {
            SparseArray<Bundle> KQgRr5e_0 = FSaI4_7.KQgRr5e_0(this.f462KQgRr5e_0);
            if (KQgRr5e_0 != null) {
                this.f460KQgRr5e_0.putSparseParcelableArray("android.support.actionExtras", KQgRr5e_0);
            }
            this.f459KQgRr5e_0.setExtras(this.f460KQgRr5e_0);
            Notification build4 = this.f459KQgRr5e_0.build();
            RemoteViews remoteViews6 = this.f461KQgRr5e_0;
            if (remoteViews6 != null) {
                build4.contentView = remoteViews6;
            }
            RemoteViews remoteViews7 = this.QxJ9d_1;
            if (remoteViews7 != null) {
                build4.bigContentView = remoteViews7;
            }
            return build4;
        } else if (i >= 16) {
            Notification build5 = this.f459KQgRr5e_0.build();
            Bundle KQgRr5e_02 = IFxWkV_5.KQgRr5e_0(build5);
            Bundle bundle = new Bundle(this.f460KQgRr5e_0);
            for (String str : this.f460KQgRr5e_0.keySet()) {
                if (KQgRr5e_02.containsKey(str)) {
                    bundle.remove(str);
                }
            }
            KQgRr5e_02.putAll(bundle);
            SparseArray<Bundle> KQgRr5e_03 = FSaI4_7.KQgRr5e_0(this.f462KQgRr5e_0);
            if (KQgRr5e_03 != null) {
                IFxWkV_5.KQgRr5e_0(build5).putSparseParcelableArray("android.support.actionExtras", KQgRr5e_03);
            }
            RemoteViews remoteViews8 = this.f461KQgRr5e_0;
            if (remoteViews8 != null) {
                build5.contentView = remoteViews8;
            }
            RemoteViews remoteViews9 = this.QxJ9d_1;
            if (remoteViews9 != null) {
                build5.bigContentView = remoteViews9;
            }
            return build5;
        } else {
            return this.f459KQgRr5e_0.getNotification();
        }
    }

    public final void KQgRr5e_0(IFxWkV_5.KQgRr5e_0 kQgRr5e_0) {
        Bundle bundle;
        int i = Build.VERSION.SDK_INT;
        if (i < 20) {
            if (i >= 16) {
                this.f462KQgRr5e_0.add(FSaI4_7.KQgRr5e_0(this.f459KQgRr5e_0, kQgRr5e_0));
                return;
            }
            return;
        }
        Notification.Action.Builder builder = new Notification.Action.Builder(kQgRr5e_0.KQgRr5e_0(), kQgRr5e_0.m300KQgRr5e_0(), kQgRr5e_0.m298KQgRr5e_0());
        if (kQgRr5e_0.m304QxJ9d_1() != null) {
            for (RemoteInput remoteInput : Xgtqvk_8.KQgRr5e_0(kQgRr5e_0.m304QxJ9d_1())) {
                builder.addRemoteInput(remoteInput);
            }
        }
        if (kQgRr5e_0.m299KQgRr5e_0() != null) {
            bundle = new Bundle(kQgRr5e_0.m299KQgRr5e_0());
        } else {
            bundle = new Bundle();
        }
        bundle.putBoolean("android.support.allowGeneratedReplies", kQgRr5e_0.m301KQgRr5e_0());
        if (Build.VERSION.SDK_INT >= 24) {
            builder.setAllowGeneratedReplies(kQgRr5e_0.m301KQgRr5e_0());
        }
        bundle.putInt("android.support.action.semanticAction", kQgRr5e_0.QxJ9d_1());
        if (Build.VERSION.SDK_INT >= 28) {
            builder.setSemanticAction(kQgRr5e_0.QxJ9d_1());
        }
        bundle.putBoolean("android.support.action.showsUserInterface", kQgRr5e_0.m303QxJ9d_1());
        builder.addExtras(bundle);
        this.f459KQgRr5e_0.addAction(builder.build());
    }

    public final void KQgRr5e_0(Notification notification) {
        notification.sound = null;
        notification.vibrate = null;
        int i = notification.defaults & (-2);
        notification.defaults = i;
        notification.defaults = i & (-3);
    }
}
