package D;

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.riyaz.zvytour.R;

/* JADX INFO: renamed from: D.v, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0050v extends K {

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

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

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

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public PendingIntent f418h;
    public PendingIntent i;

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

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

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

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

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

    @Override // D.K
    public final void a(Bundle bundle) {
        super.a(bundle);
        bundle.putInt("android.callType", this.f415e);
        bundle.putBoolean("android.callIsVideo", this.f419j);
        Y y5 = this.f416f;
        if (y5 != null) {
            if (Build.VERSION.SDK_INT >= 28) {
                bundle.putParcelable("android.callPerson", AbstractC0048t.b(M.r(y5)));
            } else {
                bundle.putParcelable("android.callPersonCompat", y5.b());
            }
        }
        IconCompat iconCompat = this.f422m;
        if (iconCompat != null) {
            bundle.putParcelable("android.verificationIcon", AbstractC0047s.a(iconCompat.h(this.f317a.f392a)));
        }
        bundle.putCharSequence("android.verificationText", this.f423n);
        bundle.putParcelable("android.answerIntent", this.f417g);
        bundle.putParcelable("android.declineIntent", this.f418h);
        bundle.putParcelable("android.hangUpIntent", this.i);
        Integer num = this.f420k;
        if (num != null) {
            bundle.putInt("android.answerColor", num.intValue());
        }
        Integer num2 = this.f421l;
        if (num2 != null) {
            bundle.putInt("android.declineColor", num2.intValue());
        }
    }

    @Override // D.K
    public final void b(P p) {
        int i = Build.VERSION.SDK_INT;
        Notification.Builder builder = p.f322b;
        String string = null;
        callStyleA = null;
        Notification.CallStyle callStyleA = null;
        if (i < 31) {
            Y y5 = this.f416f;
            builder.setContentTitle(y5 != null ? y5.f348a : null);
            Bundle bundle = this.f317a.f413y;
            CharSequence charSequence = (bundle == null || !bundle.containsKey("android.text")) ? null : this.f317a.f413y.getCharSequence("android.text");
            if (charSequence == null) {
                int i5 = this.f415e;
                if (i5 == 1) {
                    string = this.f317a.f392a.getResources().getString(R.string.call_notification_incoming_text);
                } else if (i5 == 2) {
                    string = this.f317a.f392a.getResources().getString(R.string.call_notification_ongoing_text);
                } else if (i5 == 3) {
                    string = this.f317a.f392a.getResources().getString(R.string.call_notification_screening_text);
                }
                charSequence = string;
            }
            builder.setContentText(charSequence);
            Y y6 = this.f416f;
            if (y6 != null) {
                IconCompat iconCompat = y6.f349b;
                if (iconCompat != null) {
                    AbstractC0047s.b(builder, iconCompat.h(this.f317a.f392a));
                }
                if (i >= 28) {
                    Y y7 = this.f416f;
                    y7.getClass();
                    AbstractC0048t.a(builder, M.r(y7));
                } else {
                    r.a(builder, this.f416f.f350c);
                }
            }
            r.b(builder, "call");
            return;
        }
        int i6 = this.f415e;
        if (i6 == 1) {
            Y y8 = this.f416f;
            y8.getClass();
            callStyleA = AbstractC0049u.a(M.r(y8), this.f418h, this.f417g);
        } else if (i6 == 2) {
            Y y9 = this.f416f;
            y9.getClass();
            callStyleA = AbstractC0049u.b(M.r(y9), this.i);
        } else if (i6 == 3) {
            Y y10 = this.f416f;
            y10.getClass();
            callStyleA = AbstractC0049u.c(M.r(y10), this.i, this.f417g);
        } else if (Log.isLoggable("NotifCompat", 3)) {
            Log.d("NotifCompat", "Unrecognized call type in CallStyle: " + String.valueOf(this.f415e));
        }
        if (callStyleA != null) {
            callStyleA.setBuilder(builder);
            Integer num = this.f420k;
            if (num != null) {
                AbstractC0049u.d(callStyleA, num.intValue());
            }
            Integer num2 = this.f421l;
            if (num2 != null) {
                AbstractC0049u.e(callStyleA, num2.intValue());
            }
            AbstractC0049u.h(callStyleA, this.f423n);
            IconCompat iconCompat2 = this.f422m;
            if (iconCompat2 != null) {
                AbstractC0049u.g(callStyleA, iconCompat2.h(this.f317a.f392a));
            }
            AbstractC0049u.f(callStyleA, this.f419j);
        }
    }

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

    @Override // D.K
    public final void d(Bundle bundle) {
        super.d(bundle);
        this.f415e = bundle.getInt("android.callType");
        this.f419j = bundle.getBoolean("android.callIsVideo");
        if (Build.VERSION.SDK_INT >= 28 && bundle.containsKey("android.callPerson")) {
            this.f416f = M.c(AbstractC0046q.d(bundle.getParcelable("android.callPerson")));
        } else if (bundle.containsKey("android.callPersonCompat")) {
            this.f416f = Y.a(bundle.getBundle("android.callPersonCompat"));
        }
        if (bundle.containsKey("android.verificationIcon")) {
            this.f422m = IconCompat.b((Icon) bundle.getParcelable("android.verificationIcon"));
        } else if (bundle.containsKey("android.verificationIconCompat")) {
            this.f422m = IconCompat.a(bundle.getBundle("android.verificationIconCompat"));
        }
        this.f423n = bundle.getCharSequence("android.verificationText");
        this.f417g = (PendingIntent) bundle.getParcelable("android.answerIntent");
        this.f418h = (PendingIntent) bundle.getParcelable("android.declineIntent");
        this.i = (PendingIntent) bundle.getParcelable("android.hangUpIntent");
        this.f420k = bundle.containsKey("android.answerColor") ? Integer.valueOf(bundle.getInt("android.answerColor")) : null;
        this.f421l = bundle.containsKey("android.declineColor") ? Integer.valueOf(bundle.getInt("android.declineColor")) : null;
    }

    public final C0038i e(int i, int i5, Integer num, int i6, PendingIntent pendingIntent) {
        if (num == null) {
            num = Integer.valueOf(this.f317a.f392a.getColor(i6));
        }
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
        spannableStringBuilder.append((CharSequence) this.f317a.f392a.getResources().getString(i5));
        spannableStringBuilder.setSpan(new ForegroundColorSpan(num.intValue()), 0, spannableStringBuilder.length(), 18);
        Context context = this.f317a.f392a;
        PorterDuff.Mode mode = IconCompat.f3929k;
        context.getClass();
        C0038i c0038iA = new C0037h(IconCompat.e(context.getResources(), context.getPackageName(), i), spannableStringBuilder, pendingIntent).a();
        c0038iA.f370a.putBoolean("key_action_priority", true);
        return c0038iA;
    }
}
