package androidx.core.app;

import android.app.Notification;
import android.graphics.Bitmap;
import android.graphics.drawable.Icon;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.graphics.drawable.IconCompat;

/* JADX INFO: loaded from: classes.dex */
public final class k0 extends j1 {

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

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

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

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

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

    public k0(@Nullable s0 s0Var) {
        setBuilder(s0Var);
    }

    @Nullable
    private static IconCompat asIconCompat(@Nullable Parcelable parcelable) {
        if (parcelable == null) {
            return null;
        }
        if (parcelable instanceof Icon) {
            return IconCompat.createFromIcon((Icon) parcelable);
        }
        if (parcelable instanceof Bitmap) {
            return IconCompat.c((Bitmap) parcelable);
        }
        return null;
    }

    @Nullable
    @RestrictTo({RestrictTo.Scope.f557c})
    public static IconCompat getPictureIcon(@Nullable Bundle bundle) {
        if (bundle == null) {
            return null;
        }
        Parcelable parcelable = bundle.getParcelable("android.picture");
        return parcelable != null ? asIconCompat(parcelable) : asIconCompat(bundle.getParcelable("android.pictureIcon"));
    }

    @Override // androidx.core.app.j1
    public final void apply(z zVar) {
        Notification.BigPictureStyle bigContentTitle = new Notification.BigPictureStyle(((l1) zVar).f1598b).setBigContentTitle(this.mBigContentTitle);
        IconCompat iconCompat = this.f1591a;
        if (iconCompat != null) {
            if (Build.VERSION.SDK_INT >= 31) {
                j0.a(bigContentTitle, iconCompat.toIcon(zVar instanceof l1 ? ((l1) zVar).f1597a : null));
            } else {
                int iC = iconCompat.f1702a;
                if (iC == -1) {
                    iC = k0.b.c(iconCompat.f1703b);
                }
                if (iC == 1) {
                    bigContentTitle = bigContentTitle.bigPicture(this.f1591a.getBitmap());
                }
            }
        }
        if (this.f1593c) {
            IconCompat iconCompat2 = this.f1592b;
            if (iconCompat2 == null) {
                bigContentTitle.bigLargeIcon((Bitmap) null);
            } else {
                i0.a(bigContentTitle, iconCompat2.toIcon(zVar instanceof l1 ? ((l1) zVar).f1597a : null));
            }
        }
        if (this.mSummaryTextSet) {
            bigContentTitle.setSummaryText(this.mSummaryText);
        }
        if (Build.VERSION.SDK_INT >= 31) {
            j0.c(bigContentTitle, this.f1595e);
            j0.b(bigContentTitle, this.f1594d);
        }
    }

    @NonNull
    public k0 bigLargeIcon(@Nullable Bitmap bitmap) {
        this.f1592b = bitmap == null ? null : IconCompat.c(bitmap);
        this.f1593c = true;
        return this;
    }

    @NonNull
    public k0 bigPicture(@Nullable Bitmap bitmap) {
        this.f1591a = bitmap == null ? null : IconCompat.c(bitmap);
        return this;
    }

    @Override // androidx.core.app.j1
    public final void clearCompatExtraKeys(Bundle bundle) {
        super.clearCompatExtraKeys(bundle);
        bundle.remove("android.largeIcon.big");
        bundle.remove("android.picture");
        bundle.remove("android.pictureIcon");
        bundle.remove("android.showBigPictureWhenCollapsed");
    }

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

    @Override // androidx.core.app.j1
    public final void restoreFromCompatExtras(Bundle bundle) {
        super.restoreFromCompatExtras(bundle);
        if (bundle.containsKey("android.largeIcon.big")) {
            this.f1592b = asIconCompat(bundle.getParcelable("android.largeIcon.big"));
            this.f1593c = true;
        }
        this.f1591a = getPictureIcon(bundle);
        this.f1595e = bundle.getBoolean("android.showBigPictureWhenCollapsed");
    }

    @NonNull
    public k0 setBigContentTitle(@Nullable CharSequence charSequence) {
        this.mBigContentTitle = s0.limitCharSequenceLength(charSequence);
        return this;
    }

    @NonNull
    @RequiresApi(31)
    public k0 setContentDescription(@Nullable CharSequence charSequence) {
        this.f1594d = charSequence;
        return this;
    }

    @NonNull
    public k0 setSummaryText(@Nullable CharSequence charSequence) {
        this.mSummaryText = s0.limitCharSequenceLength(charSequence);
        this.mSummaryTextSet = true;
        return this;
    }

    @NonNull
    @RequiresApi(23)
    public k0 bigLargeIcon(@Nullable Icon icon) {
        this.f1592b = icon == null ? null : IconCompat.createFromIcon(icon);
        this.f1593c = true;
        return this;
    }

    @NonNull
    @RequiresApi(31)
    public k0 bigPicture(@Nullable Icon icon) {
        this.f1591a = IconCompat.createFromIcon(icon);
        return this;
    }
}
