Remove NewApi suppression

This commit is contained in:
Isira Seneviratne 2025-07-29 06:18:27 +05:30
parent fece0741e5
commit ef29c318b0
2 changed files with 5 additions and 4 deletions

View file

@ -167,15 +167,16 @@ public final class NotificationUtil {
&& notificationBuilder.mActions.get(2).actionIntent != null);
}
@SuppressLint("NewApi") // ServiceInfo constant is inlined
public void createNotificationAndStartForeground() {
if (notificationBuilder == null) {
notificationBuilder = createNotification();
}
updateNotification();
final int serviceType = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
? ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK : 0;
ServiceCompat.startForeground(player.getService(), NOTIFICATION_ID,
notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);
notificationBuilder.build(), serviceType);
}
public void cancelNotificationAndStopForeground() {