Skip to content

Commit

Permalink
Test with Android 14
Browse files Browse the repository at this point in the history
To finally get ahead of versions bumps, let us directly test android 14

Signed-off-by: tobiasKaminsky <[email protected]>
  • Loading branch information
tobiasKaminsky authored and AndyScherzinger committed Jul 31, 2023
1 parent dd1d4d7 commit bf19647
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: tests-stable

steps:
- name: gplay
image: ghcr.io/nextcloud/continuous-integration-android8:3
image: ghcr.io/nextcloud/continuous-integration-android14:1
privileged: true
environment:
LOG_USERNAME:
Expand Down Expand Up @@ -65,7 +65,7 @@ name: tests-master

steps:
- name: gplay
image: ghcr.io/nextcloud/continuous-integration-android8:3
image: ghcr.io/nextcloud/continuous-integration-android14:1
privileged: true
environment:
LOG_USERNAME:
Expand Down Expand Up @@ -120,7 +120,7 @@ name: allScreenshots

steps:
- name: runAllScreenshots
image: ghcr.io/nextcloud/continuous-integration-android8:3
image: ghcr.io/nextcloud/continuous-integration-android14:1
privileged: true
environment:
GIT_USERNAME:
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def perfAnalysis = project.hasProperty('perfAnalysis')

android {

compileSdkVersion 33
compileSdkPreview "UpsideDownCake"
// install this NDK version and Cmake to produce smaller APKs. Build will still work if not installed
ndkVersion "${ndkEnv.get("NDK_VERSION")}"

Expand All @@ -83,7 +83,7 @@ android {

defaultConfig {
minSdkVersion 23
targetSdkVersion 33
targetSdkPreview "UpsideDownCake"

buildConfigField 'boolean', 'CI', ciBuild.toString()
buildConfigField 'boolean', 'RUNTIME_PERF_ANALYSIS', perfAnalysis.toString()
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<!-- Used for document scanning, but lib declares it as required, which it's not -->
<uses-feature
Expand Down Expand Up @@ -378,6 +380,7 @@
android:exported="false" />
<service
android:name=".files.services.FileDownloader"
android:foregroundServiceType="dataSync"
android:exported="false" />
<service
android:name="com.nextcloud.client.files.downloader.FileTransferService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.content.pm.ServiceInfo;
import android.graphics.BitmapFactory;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
Expand Down Expand Up @@ -200,7 +202,11 @@ public void onDestroy() {
public int onStartCommand(Intent intent, int flags, int startId) {
Log_OC.d(TAG, "Starting command with id " + startId);

startForeground(FOREGROUND_SERVICE_ID, mNotification);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(FOREGROUND_SERVICE_ID, mNotification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
} else {
startForeground(FOREGROUND_SERVICE_ID, mNotification);
}

if (intent == null || !intent.hasExtra(EXTRA_USER) || !intent.hasExtra(EXTRA_FILE)) {
Log_OC.e(TAG, "Not enough information provided in intent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class LocalConnectionTest {

// THEN
// no binding is performed
verify(exactly = 0) { context.bindService(any(), any(), any()) }
verify(exactly = 0) { context.bindService(mockIntent, any(), any()) }
}

@Test
Expand Down

0 comments on commit bf19647

Please sign in to comment.