From fece0741e5a1cf562e0bcfedae3aac327d7d5739 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Sun, 27 Jul 2025 12:17:44 +0530 Subject: [PATCH] Suppress NewApi --- .../newpipe/local/feed/notifications/NotificationWorker.kt | 4 ++-- .../schabi/newpipe/player/notification/NotificationUtil.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationWorker.kt b/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationWorker.kt index ad2f1055c..ca48a4243 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationWorker.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationWorker.kt @@ -2,7 +2,6 @@ package org.schabi.newpipe.local.feed.notifications import android.content.Context import android.content.pm.ServiceInfo -import android.os.Build import android.util.Log import androidx.core.app.NotificationCompat import androidx.work.Constraints @@ -85,7 +84,8 @@ class NotificationWorker( .setPriority(NotificationCompat.PRIORITY_LOW) .setContentTitle(applicationContext.getString(R.string.feed_notification_loading)) .build() - val serviceType = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC else 0 + @Suppress("NewApi") // ServiceInfo constant is inlined + val serviceType = ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC setForegroundAsync(ForegroundInfo(FeedLoadService.NOTIFICATION_ID, notification, serviceType)) } diff --git a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationUtil.java b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationUtil.java index e5e2544b2..f314f713a 100644 --- a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationUtil.java +++ b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationUtil.java @@ -167,7 +167,7 @@ public final class NotificationUtil { && notificationBuilder.mActions.get(2).actionIntent != null); } - + @SuppressLint("NewApi") // ServiceInfo constant is inlined public void createNotificationAndStartForeground() { if (notificationBuilder == null) { notificationBuilder = createNotification();