Rabbit-R1/original r1/java/sources/androidx/media3/common/util/NotificationUtil.java
2024-05-21 17:08:36 -04:00

51 lines
2 KiB
Java

package androidx.media3.common.util;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/* loaded from: classes2.dex */
public final class NotificationUtil {
public static final int IMPORTANCE_DEFAULT = 3;
public static final int IMPORTANCE_HIGH = 4;
public static final int IMPORTANCE_LOW = 2;
public static final int IMPORTANCE_MIN = 1;
public static final int IMPORTANCE_NONE = 0;
public static final int IMPORTANCE_UNSPECIFIED = -1000;
@Target({ElementType.TYPE_USE})
@Documented
@Retention(RetentionPolicy.SOURCE)
/* loaded from: classes2.dex */
public @interface Importance {
}
public static void createNotificationChannel(Context context, String str, int i, int i2, int i3) {
if (Util.SDK_INT >= 26) {
NotificationManager notificationManager = (NotificationManager) Assertions.checkNotNull((NotificationManager) context.getSystemService("notification"));
NotificationChannel notificationChannel = new NotificationChannel(str, context.getString(i), i3);
if (i2 != 0) {
notificationChannel.setDescription(context.getString(i2));
}
notificationManager.createNotificationChannel(notificationChannel);
}
}
public static void setNotification(Context context, int i, Notification notification) {
NotificationManager notificationManager = (NotificationManager) Assertions.checkNotNull((NotificationManager) context.getSystemService("notification"));
if (notification != null) {
notificationManager.notify(i, notification);
} else {
notificationManager.cancel(i);
}
}
private NotificationUtil() {
}
}