ipc/android: Clean up MonadoService

This commit is contained in:
Ryan Pavlik 2021-02-09 15:32:55 -06:00 committed by Jakob Bornecrantz
parent a1aa5611fe
commit c65ce85fe1

View file

@ -53,23 +53,27 @@ class MonadoService : Service() {
} }
private fun handleStart() { private fun handleStart() {
val pendingShutdownIntent = PendingIntent.getForegroundService(this, val pendingShutdownIntent = PendingIntent.getForegroundService(
this,
0, 0,
Intent(BuildConfig.SHUTDOWN_ACTION).setPackage(packageName), Intent(BuildConfig.SHUTDOWN_ACTION).setPackage(packageName),
0) 0
)
val notification = serviceNotification.buildNotification(this, pendingShutdownIntent) val notification = serviceNotification.buildNotification(this, pendingShutdownIntent)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(serviceNotification.getNotificationId(), startForeground(
serviceNotification.getNotificationId(),
notification, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST) ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST
)
} else { } else {
startForeground(serviceNotification.getNotificationId(), startForeground(
notification) serviceNotification.getNotificationId(),
notification
)
} }
} }
companion object { companion object {