package D;

import android.app.Notification;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Iterator;

/* JADX INFO: loaded from: classes.dex */
public final class E extends K {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final ArrayList f300e = new ArrayList();

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final ArrayList f301f = new ArrayList();

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public Y f302g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public CharSequence f303h;
    public Boolean i;

    public E() {
    }

    /* JADX WARN: Removed duplicated region for block: B:47:0x0095  */
    /* JADX WARN: Removed duplicated region for block: B:4:0x0007  */
    /* JADX WARN: Removed duplicated region for block: B:97:0x017c  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static D.E e(android.app.Notification r6) {
        /*
            Method dump skipped, instruction units count: 462
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: D.E.e(android.app.Notification):D.E");
    }

    @Override // D.K
    public final void a(Bundle bundle) {
        super.a(bundle);
        bundle.putCharSequence("android.selfDisplayName", this.f302g.f348a);
        bundle.putBundle("android.messagingStyleUser", this.f302g.b());
        bundle.putCharSequence("android.hiddenConversationTitle", this.f303h);
        if (this.f303h != null && this.i.booleanValue()) {
            bundle.putCharSequence("android.conversationTitle", this.f303h);
        }
        ArrayList arrayList = this.f300e;
        if (!arrayList.isEmpty()) {
            bundle.putParcelableArray("android.messages", D.a(arrayList));
        }
        ArrayList arrayList2 = this.f301f;
        if (!arrayList2.isEmpty()) {
            bundle.putParcelableArray("android.messages.historic", D.a(arrayList2));
        }
        Boolean bool = this.i;
        if (bool != null) {
            bundle.putBoolean("android.isGroupConversation", bool.booleanValue());
        }
    }

    @Override // D.K
    public final void b(P p) {
        Notification.MessagingStyle messagingStyleB;
        this.i = Boolean.valueOf(f());
        if (Build.VERSION.SDK_INT >= 28) {
            Y y5 = this.f302g;
            y5.getClass();
            messagingStyleB = A.a(M.r(y5));
        } else {
            messagingStyleB = AbstractC0053y.b(this.f302g.f348a);
        }
        Iterator it = this.f300e.iterator();
        while (it.hasNext()) {
            AbstractC0053y.a(messagingStyleB, ((D) it.next()).c());
        }
        if (Build.VERSION.SDK_INT >= 26) {
            Iterator it2 = this.f301f.iterator();
            while (it2.hasNext()) {
                AbstractC0054z.a(messagingStyleB, ((D) it2.next()).c());
            }
        }
        if (this.i.booleanValue() || Build.VERSION.SDK_INT >= 28) {
            AbstractC0053y.c(messagingStyleB, this.f303h);
        }
        if (Build.VERSION.SDK_INT >= 28) {
            A.b(messagingStyleB, this.i.booleanValue());
        }
        messagingStyleB.setBuilder(p.f322b);
    }

    @Override // D.K
    public final String c() {
        return "androidx.core.app.NotificationCompat$MessagingStyle";
    }

    @Override // D.K
    public final void d(Bundle bundle) {
        super.d(bundle);
        ArrayList arrayList = this.f300e;
        arrayList.clear();
        if (bundle.containsKey("android.messagingStyleUser")) {
            this.f302g = Y.a(bundle.getBundle("android.messagingStyleUser"));
        } else {
            String string = bundle.getString("android.selfDisplayName");
            Y y5 = new Y();
            y5.f348a = string;
            y5.f349b = null;
            y5.f350c = null;
            y5.f351d = null;
            y5.f352e = false;
            y5.f353f = false;
            this.f302g = y5;
        }
        CharSequence charSequence = bundle.getCharSequence("android.conversationTitle");
        this.f303h = charSequence;
        if (charSequence == null) {
            this.f303h = bundle.getCharSequence("android.hiddenConversationTitle");
        }
        Parcelable[] parcelableArray = bundle.getParcelableArray("android.messages");
        if (parcelableArray != null) {
            arrayList.addAll(D.b(parcelableArray));
        }
        Parcelable[] parcelableArray2 = bundle.getParcelableArray("android.messages.historic");
        if (parcelableArray2 != null) {
            this.f301f.addAll(D.b(parcelableArray2));
        }
        if (bundle.containsKey("android.isGroupConversation")) {
            this.i = Boolean.valueOf(bundle.getBoolean("android.isGroupConversation"));
        }
    }

    public final boolean f() {
        C0044o c0044o = this.f317a;
        if (c0044o != null && c0044o.f392a.getApplicationInfo().targetSdkVersion < 28 && this.i == null) {
            return this.f303h != null;
        }
        Boolean bool = this.i;
        if (bool != null) {
            return bool.booleanValue();
        }
        return false;
    }

    public E(Y y5) {
        if (!TextUtils.isEmpty(y5.f348a)) {
            this.f302g = y5;
            return;
        }
        throw new IllegalArgumentException("User's name must not be empty.");
    }
}
