package androidx.core.app;

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

/* JADX INFO: loaded from: classes.dex */
public abstract class m0 {
    @Nullable
    @RequiresApi(29)
    public static p0 fromPlatform(@Nullable Notification.BubbleMetadata bubbleMetadata) {
        if (bubbleMetadata == null || bubbleMetadata.getIntent() == null) {
            return null;
        }
        o0 o0Var = new o0(bubbleMetadata.getIntent(), IconCompat.createFromIcon(bubbleMetadata.getIcon()));
        o0Var.b(1, bubbleMetadata.getAutoExpandBubble());
        o0 deleteIntent = o0Var.setDeleteIntent(bubbleMetadata.getDeleteIntent());
        deleteIntent.b(2, bubbleMetadata.isNotificationSuppressed());
        if (bubbleMetadata.getDesiredHeight() != 0) {
            deleteIntent.f1610c = Math.max(bubbleMetadata.getDesiredHeight(), 0);
            deleteIntent.f1611d = 0;
        }
        if (bubbleMetadata.getDesiredHeightResId() != 0) {
            deleteIntent.f1611d = bubbleMetadata.getDesiredHeightResId();
            deleteIntent.f1610c = 0;
        }
        return deleteIntent.a();
    }

    @Nullable
    @RequiresApi(29)
    public static Notification.BubbleMetadata toPlatform(@Nullable p0 p0Var) {
        if (p0Var == null || p0Var.getIntent() == null) {
            return null;
        }
        Notification.BubbleMetadata.Builder suppressNotification = new Notification.BubbleMetadata.Builder().setIcon(p0Var.getIcon().toIcon(null)).setIntent(p0Var.getIntent()).setDeleteIntent(p0Var.getDeleteIntent()).setAutoExpandBubble((p0Var.f1625f & 1) != 0).setSuppressNotification((p0Var.f1625f & 2) != 0);
        int i10 = p0Var.f1623d;
        if (i10 != 0) {
            suppressNotification.setDesiredHeight(i10);
        }
        int i11 = p0Var.f1624e;
        if (i11 != 0) {
            suppressNotification.setDesiredHeightResId(i11);
        }
        return suppressNotification.build();
    }
}
