package androidx.core.app;

import V.AbstractC0624s;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Icon;
import android.os.Build;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import androidx.core.graphics.drawable.IconCompat;
import com.debridstream.tv.R;
import java.util.ArrayList;
import x1.AbstractC3209a;

/* JADX INFO: renamed from: androidx.core.app.s, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1011s extends C {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f11274a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public O f11275b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public PendingIntent f11276c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public PendingIntent f11277d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public PendingIntent f11278e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public boolean f11279f;

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

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public Integer f11281h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public IconCompat f11282i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public CharSequence f11283j;

    @Override // androidx.core.app.C
    public final void addCompatExtras(Bundle bundle) {
        super.addCompatExtras(bundle);
        bundle.putInt("android.callType", this.f11274a);
        bundle.putBoolean("android.callIsVideo", this.f11279f);
        O o6 = this.f11275b;
        if (o6 != null) {
            if (Build.VERSION.SDK_INT >= 28) {
                o6.getClass();
                bundle.putParcelable("android.callPerson", AbstractC1010q.b(E.d(o6)));
            } else {
                bundle.putParcelable("android.callPersonCompat", o6.b());
            }
        }
        IconCompat iconCompat = this.f11282i;
        if (iconCompat != null) {
            bundle.putParcelable("android.verificationIcon", AbstractC1009p.a(iconCompat.h(this.mBuilder.f11249a)));
        }
        bundle.putCharSequence("android.verificationText", this.f11283j);
        bundle.putParcelable("android.answerIntent", this.f11276c);
        bundle.putParcelable("android.declineIntent", this.f11277d);
        bundle.putParcelable("android.hangUpIntent", this.f11278e);
        Integer num = this.f11280g;
        if (num != null) {
            bundle.putInt("android.answerColor", num.intValue());
        }
        Integer num2 = this.f11281h;
        if (num2 != null) {
            bundle.putInt("android.declineColor", num2.intValue());
        }
    }

    @Override // androidx.core.app.C
    public final void apply(InterfaceC1001h interfaceC1001h) {
        int i6 = Build.VERSION.SDK_INT;
        String string = null;
        callStyleA = null;
        Notification.CallStyle callStyleA = null;
        if (i6 < 31) {
            Notification.Builder builder = ((G) interfaceC1001h).f11193b;
            O o6 = this.f11275b;
            builder.setContentTitle(o6 != null ? o6.f11217a : null);
            Bundle bundle = this.mBuilder.f11268u;
            CharSequence charSequence = (bundle == null || !bundle.containsKey("android.text")) ? null : this.mBuilder.f11268u.getCharSequence("android.text");
            if (charSequence == null) {
                int i7 = this.f11274a;
                if (i7 == 1) {
                    string = this.mBuilder.f11249a.getResources().getString(R.string.call_notification_incoming_text);
                } else if (i7 == 2) {
                    string = this.mBuilder.f11249a.getResources().getString(R.string.call_notification_ongoing_text);
                } else if (i7 == 3) {
                    string = this.mBuilder.f11249a.getResources().getString(R.string.call_notification_screening_text);
                }
                charSequence = string;
            }
            builder.setContentText(charSequence);
            O o7 = this.f11275b;
            if (o7 != null) {
                IconCompat iconCompat = o7.f11218b;
                if (iconCompat != null) {
                    AbstractC1009p.b(builder, iconCompat.h(this.mBuilder.f11249a));
                }
                if (i6 >= 28) {
                    O o8 = this.f11275b;
                    o8.getClass();
                    AbstractC1010q.a(builder, E.d(o8));
                } else {
                    AbstractC1008o.a(builder, this.f11275b.f11219c);
                }
            }
            AbstractC1008o.b(builder, "call");
            return;
        }
        int i8 = this.f11274a;
        if (i8 == 1) {
            O o9 = this.f11275b;
            o9.getClass();
            callStyleA = r.a(E.d(o9), this.f11277d, this.f11276c);
        } else if (i8 == 2) {
            O o10 = this.f11275b;
            o10.getClass();
            callStyleA = r.b(E.d(o10), this.f11278e);
        } else if (i8 == 3) {
            O o11 = this.f11275b;
            o11.getClass();
            callStyleA = r.c(E.d(o11), this.f11278e, this.f11276c);
        } else if (Log.isLoggable("NotifCompat", 3)) {
            Log.d("NotifCompat", "Unrecognized call type in CallStyle: " + String.valueOf(this.f11274a));
        }
        if (callStyleA != null) {
            callStyleA.setBuilder(((G) interfaceC1001h).f11193b);
            Integer num = this.f11280g;
            if (num != null) {
                r.d(callStyleA, num.intValue());
            }
            Integer num2 = this.f11281h;
            if (num2 != null) {
                r.e(callStyleA, num2.intValue());
            }
            r.h(callStyleA, this.f11283j);
            IconCompat iconCompat2 = this.f11282i;
            if (iconCompat2 != null) {
                r.g(callStyleA, iconCompat2.h(this.mBuilder.f11249a));
            }
            r.f(callStyleA, this.f11279f);
        }
    }

    public final C1002i c(int i6, int i7, Integer num, int i8, PendingIntent pendingIntent) {
        if (num == null) {
            num = Integer.valueOf(AbstractC3209a.getColor(this.mBuilder.f11249a, i8));
        }
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
        spannableStringBuilder.append((CharSequence) this.mBuilder.f11249a.getResources().getString(i7));
        spannableStringBuilder.setSpan(new ForegroundColorSpan(num.intValue()), 0, spannableStringBuilder.length(), 18);
        Context context = this.mBuilder.f11249a;
        PorterDuff.Mode mode = IconCompat.f11290k;
        context.getClass();
        IconCompat iconCompatD = IconCompat.d(context.getResources(), context.getPackageName(), i6);
        Bundle bundle = new Bundle();
        CharSequence charSequenceB = C1007n.b(spannableStringBuilder);
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        C1002i c1002i = new C1002i(iconCompatD, charSequenceB, pendingIntent, bundle, arrayList2.isEmpty() ? null : (Q[]) arrayList2.toArray(new Q[arrayList2.size()]), arrayList.isEmpty() ? null : (Q[]) arrayList.toArray(new Q[arrayList.size()]));
        c1002i.f11232a.putBoolean("key_action_priority", true);
        return c1002i;
    }

    @Override // androidx.core.app.C
    public final boolean displayCustomViewInline() {
        return true;
    }

    @Override // androidx.core.app.C
    public final String getClassName() {
        return "androidx.core.app.NotificationCompat$CallStyle";
    }

    @Override // androidx.core.app.C
    public final void restoreFromCompatExtras(Bundle bundle) {
        super.restoreFromCompatExtras(bundle);
        this.f11274a = bundle.getInt("android.callType");
        this.f11279f = bundle.getBoolean("android.callIsVideo");
        if (Build.VERSION.SDK_INT >= 28 && bundle.containsKey("android.callPerson")) {
            this.f11275b = E.b(AbstractC0624s.c(bundle.getParcelable("android.callPerson")));
        } else if (bundle.containsKey("android.callPersonCompat")) {
            this.f11275b = O.a(bundle.getBundle("android.callPersonCompat"));
        }
        if (bundle.containsKey("android.verificationIcon")) {
            this.f11282i = IconCompat.b((Icon) bundle.getParcelable("android.verificationIcon"));
        } else if (bundle.containsKey("android.verificationIconCompat")) {
            this.f11282i = IconCompat.a(bundle.getBundle("android.verificationIconCompat"));
        }
        this.f11283j = bundle.getCharSequence("android.verificationText");
        this.f11276c = (PendingIntent) bundle.getParcelable("android.answerIntent");
        this.f11277d = (PendingIntent) bundle.getParcelable("android.declineIntent");
        this.f11278e = (PendingIntent) bundle.getParcelable("android.hangUpIntent");
        this.f11280g = bundle.containsKey("android.answerColor") ? Integer.valueOf(bundle.getInt("android.answerColor")) : null;
        this.f11281h = bundle.containsKey("android.declineColor") ? Integer.valueOf(bundle.getInt("android.declineColor")) : null;
    }
}
