From 2ce5790af5f36b9b3fff6676c60b7044e1e26f57 Mon Sep 17 00:00:00 2001 From: Sergejs Luhmirins Date: Tue, 18 Jun 2024 11:13:46 +0300 Subject: [PATCH 1/2] MS-472 Start using shortService type instead of dataSync where appropriate --- id/src/main/AndroidManifest.xml | 2 +- .../events/down/EventDownSyncResetService.kt | 31 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/id/src/main/AndroidManifest.xml b/id/src/main/AndroidManifest.xml index 9e039a6b96..98a2903136 100644 --- a/id/src/main/AndroidManifest.xml +++ b/id/src/main/AndroidManifest.xml @@ -25,7 +25,7 @@ = Build.VERSION_CODES.O) { val chan = NotificationChannel( @@ -69,11 +80,17 @@ class EventDownSyncResetService : Service() { .setPriority(NotificationManager.IMPORTANCE_LOW) .setCategory(Notification.CATEGORY_SERVICE) .build() - // if runtime >= Q then use FOREGROUND_SERVICE_TYPE_DATA_SYNC - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - startForeground(1, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC) - } else { - startForeground(1, notification) + + when { + // In Android 15 dataSync type might be timed out/restricted + // while shortService ensures that it will always be executed + Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> + startForeground(1, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE) + // Starting from Android 10 foreground services must declare type + Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> + startForeground(1, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC) + + else -> startForeground(1, notification) } } } From e9fd1f4b82dc017cd464e4af03b623d3f44a784f Mon Sep 17 00:00:00 2001 From: Sergejs Luhmirins Date: Wed, 19 Jun 2024 10:41:59 +0300 Subject: [PATCH 2/2] MS-472 Raise the target SDK level --- build-logic/convention/src/main/kotlin/common/SdkVersions.kt | 2 +- .../orchestrator/src/main/res/layout/activity_orchestrator.xml | 3 ++- .../java/com/simprints/core/tools/extentions/Context.ext.kt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/common/SdkVersions.kt b/build-logic/convention/src/main/kotlin/common/SdkVersions.kt index 21dfb26f49..c206b122b1 100644 --- a/build-logic/convention/src/main/kotlin/common/SdkVersions.kt +++ b/build-logic/convention/src/main/kotlin/common/SdkVersions.kt @@ -5,7 +5,7 @@ import org.gradle.api.JavaVersion object SdkVersions { const val MIN = 23 - const val TARGET = 34 + const val TARGET = 35 val JAVA_TARGET = JavaVersion.VERSION_17 } diff --git a/feature/orchestrator/src/main/res/layout/activity_orchestrator.xml b/feature/orchestrator/src/main/res/layout/activity_orchestrator.xml index d28450dc20..9f437ce57a 100644 --- a/feature/orchestrator/src/main/res/layout/activity_orchestrator.xml +++ b/feature/orchestrator/src/main/res/layout/activity_orchestrator.xml @@ -2,7 +2,8 @@ + android:layout_height="match_parent" + android:fitsSystemWindows="true">