Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# Copyright © 2021-2024 Matt Robinson
# Copyright © 2021-2025 Matt Robinson
#
# SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
strategy:
matrix:
api-level:
- 21
- 23
- 29
- 30
- 35
Expand Down Expand Up @@ -101,7 +101,6 @@ jobs:
api-level: ${{ matrix.api-level }}
arch: ${{ matrix.api-level >= 31 && 'x86_64' || 'x86' }}
target: ${{ matrix.api-level >= 30 && 'aosp_atd' || 'default' }}
sdcard-path-or-size: ${{ matrix.api-level == 21 && '100M' || '' }}
script: for i in {1..3}; do
./gradlew connectedCheck && r=0 && break || r=$?; done; exit $r

Expand Down
15 changes: 10 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ android {

defaultConfig {
applicationId = "com.nerdoftheherd.tasker.rsync"
minSdk = 21
minSdk = 23
targetSdk = 35
versionCode = gitVersionCode()
versionName = gitVersionName()
Expand Down Expand Up @@ -105,9 +105,14 @@ android {
}

packaging {
jniLibs.excludes.add("lib/*/libdropbear.so")
jniLibs.excludes.add("lib/*/libdropbearconvert.so")
jniLibs.excludes.add("lib/*/libscp.so")
jniLibs {
excludes.add("lib/*/libdropbear.so")
excludes.add("lib/*/libdropbearconvert.so")
excludes.add("lib/*/libscp.so")

// Compress the binaries so they are extracted to nativeLibraryDir
useLegacyPackaging = true
}
}
}

Expand Down Expand Up @@ -166,7 +171,7 @@ tasks.check {

dependencies {
implementation("androidx.core:core-ktx:1.17.0")
implementation("androidx.activity:activity-ktx:1.11.0")
implementation("androidx.activity:activity-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.9.4")
implementation("com.google.android.material:material:1.13.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ class RsyncRunnerTest {

@Test
fun errorMessageFromMissingSrcPermission() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return
}

val context = ApplicationProvider.getApplicationContext<Context>()
val srcPath = "${TestUtils.primaryStorageDir(context)}/src"
val config = RsyncConfig("$srcPath dest", "", false)
Expand Down Expand Up @@ -165,10 +161,6 @@ class RsyncRunnerTest {

@Test
fun errorMessageFromMissingDestPermission() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return
}

val context = ApplicationProvider.getApplicationContext<Context>()
val destPath = "${TestUtils.primaryStorageDir(context)}/dest"
val config = RsyncConfig("src $destPath", "", false)
Expand Down Expand Up @@ -199,10 +191,6 @@ class RsyncRunnerTest {

@Test
fun errorMessageFromMissingLogPermission() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return
}

val context = ApplicationProvider.getApplicationContext<Context>()
val logPath = "${TestUtils.primaryStorageDir(context)}/rsync.log"
val config = RsyncConfig("--log-file=$logPath src dest", "", false)
Expand Down Expand Up @@ -233,10 +221,6 @@ class RsyncRunnerTest {

@Test
fun errorMessageFromMissingSdcardPermission() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return
}

val context = ApplicationProvider.getApplicationContext<Context>()
val config = RsyncConfig("/sdcard/src dest", "", false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class TestUtils {
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
Process.myUserHandle(),
)
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
} else {
val uiAutomation =
InstrumentationRegistry
.getInstrumentation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
package com.nerdoftheherd.tasker.rsync

import android.content.Context
import android.os.Build
import android.util.Log
import androidx.core.content.ContextCompat
import com.joaomgcd.taskerpluginlibrary.action.TaskerPluginRunnerAction
import com.joaomgcd.taskerpluginlibrary.input.TaskerInput
import com.joaomgcd.taskerpluginlibrary.runner.TaskerPluginResult
Expand All @@ -24,13 +22,7 @@ class DbclientRunner(
override val notificationProperties get() =
NotificationProperties(
iconResId = R.drawable.ic_notification,
) { context ->
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
setColor(ContextCompat.getColor(context, R.color.primary))
} else {
setColor(context.getColor(R.color.primary))
}
}
) { context -> setColor(context.getColor(R.color.primary)) }

override fun run(
context: Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
package com.nerdoftheherd.tasker.rsync

import android.content.Context
import android.os.Build
import android.util.Log
import androidx.core.content.ContextCompat
import com.joaomgcd.taskerpluginlibrary.action.TaskerPluginRunnerActionNoOutput
import com.joaomgcd.taskerpluginlibrary.input.TaskerInput
import com.joaomgcd.taskerpluginlibrary.runner.TaskerPluginResult
Expand All @@ -23,13 +21,7 @@ class PrivateKeyRunner : TaskerPluginRunnerActionNoOutput<PrivateKeyConfig>() {
override val notificationProperties get() =
NotificationProperties(
iconResId = R.drawable.ic_notification,
) { context ->
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
setColor(ContextCompat.getColor(context, R.color.primary))
} else {
setColor(context.getColor(R.color.primary))
}
}
) { context -> setColor(context.getColor(R.color.primary)) }

override fun run(
context: Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
package com.nerdoftheherd.tasker.rsync

import android.content.Context
import android.os.Build
import android.util.Log
import androidx.core.content.ContextCompat
import com.joaomgcd.taskerpluginlibrary.action.TaskerPluginRunnerActionNoInput
import com.joaomgcd.taskerpluginlibrary.input.TaskerInput
import com.joaomgcd.taskerpluginlibrary.runner.TaskerPluginResult
Expand All @@ -22,13 +20,7 @@ class PublicKeyRunner : TaskerPluginRunnerActionNoInput<PublicKeyOutput>() {
override val notificationProperties get() =
NotificationProperties(
iconResId = R.drawable.ic_notification,
) { context ->
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
setColor(ContextCompat.getColor(context, R.color.primary))
} else {
setColor(context.getColor(R.color.primary))
}
}
) { context -> setColor(context.getColor(R.color.primary)) }

override fun run(
context: Context,
Expand Down
13 changes: 1 addition & 12 deletions app/src/main/java/com/nerdoftheherd/tasker/rsync/RsyncRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import android.os.Build
import android.os.Environment
import android.os.storage.StorageManager
import android.util.Log
import androidx.core.content.ContextCompat
import com.joaomgcd.taskerpluginlibrary.action.TaskerPluginRunnerAction
import com.joaomgcd.taskerpluginlibrary.input.TaskerInput
import com.joaomgcd.taskerpluginlibrary.runner.TaskerPluginResult
Expand All @@ -30,22 +29,12 @@ class RsyncRunner(
override val notificationProperties get() =
NotificationProperties(
iconResId = R.drawable.ic_notification,
) { context ->
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
setColor(ContextCompat.getColor(context, R.color.primary))
} else {
setColor(context.getColor(R.color.primary))
}
}
) { context -> setColor(context.getColor(R.color.primary)) }

private fun checkForMissingPermission(
context: Context,
args: RsyncArgExtractor,
): TaskerPluginResult<CommandOutput>? {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return null
}

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
if (context.checkSelfPermission(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,13 @@ class UpdateNotifier {

updateIntent.putExtra("info", info)

val pendingFlags =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.FLAG_UPDATE_CURRENT or
PendingIntent.FLAG_IMMUTABLE
} else {
PendingIntent.FLAG_UPDATE_CURRENT
}

val updatePI =
PendingIntent.getActivity(
context,
0,
updateIntent,
pendingFlags,
PendingIntent.FLAG_UPDATE_CURRENT or
PendingIntent.FLAG_IMMUTABLE,
)

val notifBuilder =
Expand Down