package o;

import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import androidx.core.graphics.drawable.IconCompat;
import com.google.android.gms.common.R;
import java.util.ArrayList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class FS {
    public final Context a;
    public CharSequence e;
    public CharSequence f;
    public PendingIntent g;
    public IconCompat h;
    public int i;
    public int j;
    public Eu0 l;
    public String n;

    /* renamed from: o, reason: collision with root package name */
    public Bundle f119o;
    public String r;
    public String s;
    public DM t;
    public final boolean u;
    public final Notification v;
    public final ArrayList w;
    public final ArrayList b = new ArrayList();
    public final ArrayList c = new ArrayList();
    public final ArrayList d = new ArrayList();
    public boolean k = true;
    public boolean m = false;
    public int p = 0;
    public int q = 0;

    public FS(Context context, String str) {
        Notification notification = new Notification();
        this.v = notification;
        this.a = context;
        this.r = str;
        notification.when = System.currentTimeMillis();
        notification.audioStreamType = -1;
        this.j = 0;
        this.w = new ArrayList();
        this.u = true;
    }

    public static CharSequence b(CharSequence charSequence) {
        return (charSequence != null && charSequence.length() > 5120) ? charSequence.subSequence(0, 5120) : charSequence;
    }

    public final Notification a() {
        Bundle bundle;
        S60 s60 = new S60(this);
        FS fs = (FS) s60.f325o;
        Eu0 eu0 = fs.l;
        if (eu0 != null) {
            eu0.h(s60);
        }
        Notification.Builder builder = (Notification.Builder) s60.n;
        Notification notificationBuild = Build.VERSION.SDK_INT >= 26 ? builder.build() : builder.build();
        if (eu0 != null) {
            fs.l.getClass();
        }
        if (eu0 != null && (bundle = notificationBuild.extras) != null) {
            eu0.g(bundle);
        }
        return notificationBuild;
    }

    public final void c(int i, boolean z) {
        Notification notification = this.v;
        if (z) {
            notification.flags = i | notification.flags;
        } else {
            notification.flags = (~i) & notification.flags;
        }
    }

    public final void d(Bitmap bitmap) {
        IconCompat iconCompatB;
        if (bitmap == null) {
            iconCompatB = null;
        } else {
            if (Build.VERSION.SDK_INT < 27) {
                Resources resources = this.a.getResources();
                int dimensionPixelSize = resources.getDimensionPixelSize(R.dimen.compat_notification_large_icon_max_width);
                int dimensionPixelSize2 = resources.getDimensionPixelSize(R.dimen.compat_notification_large_icon_max_height);
                if (bitmap.getWidth() > dimensionPixelSize || bitmap.getHeight() > dimensionPixelSize2) {
                    double dMin = Math.min(dimensionPixelSize / Math.max(1, bitmap.getWidth()), dimensionPixelSize2 / Math.max(1, bitmap.getHeight()));
                    bitmap = Bitmap.createScaledBitmap(bitmap, (int) Math.ceil(bitmap.getWidth() * dMin), (int) Math.ceil(bitmap.getHeight() * dMin), true);
                }
            }
            iconCompatB = IconCompat.b(bitmap);
        }
        this.h = iconCompatB;
    }

    public final void e(Eu0 eu0) {
        if (this.l != eu0) {
            this.l = eu0;
            if (((FS) eu0.a) != this) {
                eu0.a = this;
                e(eu0);
            }
        }
    }
}
