package androidx.core.app;

import android.app.Notification;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.graphics.drawable.IconCompat;

/* JADX INFO: loaded from: classes.dex */
public abstract class n0 {
    @Nullable
    @RequiresApi(30)
    public static p0 fromPlatform(@Nullable Notification.BubbleMetadata bubbleMetadata) {
        o0 o0Var;
        if (bubbleMetadata == null) {
            return null;
        }
        if (bubbleMetadata.getShortcutId() != null) {
            String shortcutId = bubbleMetadata.getShortcutId();
            o0Var = new o0();
            if (TextUtils.isEmpty(shortcutId)) {
                throw new NullPointerException("Bubble requires a non-null shortcut id");
            }
            o0Var.f1614g = shortcutId;
        } else {
            o0Var = new o0(bubbleMetadata.getIntent(), IconCompat.createFromIcon(bubbleMetadata.getIcon()));
        }
        o0Var.b(1, bubbleMetadata.getAutoExpandBubble());
        o0Var.setDeleteIntent(bubbleMetadata.getDeleteIntent()).b(2, bubbleMetadata.isNotificationSuppressed());
        if (bubbleMetadata.getDesiredHeight() != 0) {
            o0Var.f1610c = Math.max(bubbleMetadata.getDesiredHeight(), 0);
            o0Var.f1611d = 0;
        }
        if (bubbleMetadata.getDesiredHeightResId() != 0) {
            o0Var.f1611d = bubbleMetadata.getDesiredHeightResId();
            o0Var.f1610c = 0;
        }
        return o0Var.a();
    }

    @Nullable
    @RequiresApi(30)
    public static Notification.BubbleMetadata toPlatform(@Nullable p0 p0Var) {
        if (p0Var == null) {
            return null;
        }
        Notification.BubbleMetadata.Builder builder = p0Var.getShortcutId() != null ? new Notification.BubbleMetadata.Builder(p0Var.getShortcutId()) : new Notification.BubbleMetadata.Builder(p0Var.getIntent(), p0Var.getIcon().toIcon(null));
        builder.setDeleteIntent(p0Var.getDeleteIntent()).setAutoExpandBubble((p0Var.f1625f & 1) != 0).setSuppressNotification((p0Var.f1625f & 2) != 0);
        int i10 = p0Var.f1623d;
        if (i10 != 0) {
            builder.setDesiredHeight(i10);
        }
        int i11 = p0Var.f1624e;
        if (i11 != 0) {
            builder.setDesiredHeightResId(i11);
        }
        return builder.build();
    }
}
