aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-05-28 01:48:39 +0530
committerGitHub <noreply@github.com>2022-05-27 20:18:39 +0000
commit184391599b3b2946a485fc31e3b6896d2ab6f303 (patch)
tree50663ba3b5c3fb43383b864b90e38e364d15cdfa /app
parentfb7c81124cce8f89aeaa282ecdfdcdc65c460acd (diff)
Fix ClipboardService crash (#1928)
* Fix clipboard service crash on API 31 * all: use ints directly for SDK version checks I much prefer it this way
Diffstat (limited to 'app')
-rw-r--r--app/src/free/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt3
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillFilterView.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillPublisherChangedActivity.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillSaveActivity.kt3
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/settings/AutofillSettings.kt8
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/settings/GeneralSettings.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/settings/MiscSettings.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/settings/RepositorySettings.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt3
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt3
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt6
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillViewUtils.kt2
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt3
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt6
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/services/ClipboardService.kt19
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/services/OreoAutofillService.kt4
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/services/PasswordExportService.kt4
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/shortcuts/ShortcutHandler.kt8
-rw-r--r--app/src/nonFree/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt4
24 files changed, 50 insertions, 46 deletions
diff --git a/app/src/free/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt b/app/src/free/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt
index 5121a5b0..0faf3d67 100644
--- a/app/src/free/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt
+++ b/app/src/free/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt
@@ -6,11 +6,10 @@ package dev.msfjarvis.aps.autofill.oreo.ui
import android.content.Context
import android.content.IntentSender
-import android.os.Build
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
-@RequiresApi(Build.VERSION_CODES.O)
+@RequiresApi(26)
@Suppress("UNUSED_PARAMETER")
class AutofillSmsActivity : AppCompatActivity() {
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt
index bd3141a8..4a40a5e0 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt
@@ -49,7 +49,7 @@ import me.msfjarvis.openpgpktx.util.OpenPgpServiceConnection
import org.openintents.openpgp.IOpenPgpService2
import org.openintents.openpgp.OpenPgpError
-@RequiresApi(Build.VERSION_CODES.O)
+@RequiresApi(26)
@AndroidEntryPoint
class AutofillDecryptActivity : AppCompatActivity() {
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt
index af875e00..4fd8f026 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt
@@ -38,7 +38,7 @@ import kotlinx.coroutines.withContext
import logcat.LogPriority.ERROR
import logcat.logcat
-@RequiresApi(Build.VERSION_CODES.O)
+@RequiresApi(26)
@AndroidEntryPoint
class AutofillDecryptActivityV2 : AppCompatActivity() {
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillFilterView.kt b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillFilterView.kt
index 6bf238a1..b0dfa6ec 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillFilterView.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillFilterView.kt
@@ -44,7 +44,7 @@ import javax.inject.Inject
import logcat.LogPriority.ERROR
import logcat.logcat
-@TargetApi(Build.VERSION_CODES.O)
+@TargetApi(26)
@AndroidEntryPoint
class AutofillFilterView : AppCompatActivity() {
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillPublisherChangedActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillPublisherChangedActivity.kt
index b0b5ea9c..85911815 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillPublisherChangedActivity.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillPublisherChangedActivity.kt
@@ -30,7 +30,7 @@ import dev.msfjarvis.aps.util.extensions.viewBinding
import logcat.LogPriority.ERROR
import logcat.logcat
-@TargetApi(Build.VERSION_CODES.O)
+@TargetApi(26)
class AutofillPublisherChangedActivity : AppCompatActivity() {
companion object {
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillSaveActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillSaveActivity.kt
index f79ad6a8..a963836e 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillSaveActivity.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillSaveActivity.kt
@@ -8,7 +8,6 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.IntentSender
-import android.os.Build
import android.os.Bundle
import android.view.autofill.AutofillManager
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
@@ -33,7 +32,7 @@ import javax.inject.Inject
import logcat.LogPriority.ERROR
import logcat.logcat
-@RequiresApi(Build.VERSION_CODES.O)
+@RequiresApi(26)
@AndroidEntryPoint
class AutofillSaveActivity : AppCompatActivity() {
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt
index 6ce1c057..758a927d 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt
@@ -239,7 +239,7 @@ open class BasePgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBou
action = ClipboardService.ACTION_START
putExtra(ClipboardService.EXTRA_NOTIFICATION_TIME, clearAfter)
}
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ if (Build.VERSION.SDK_INT >= 26) {
startForegroundService(service)
} else {
startService(service)
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt
index 7a9ba54e..113c3bb6 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt
@@ -129,7 +129,7 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
return@registerForActivityResult
}
val bitmap =
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ if (Build.VERSION.SDK_INT >= 28) {
ImageDecoder.decodeBitmap(ImageDecoder.createSource(contentResolver, imageUri))
.copy(Bitmap.Config.ARGB_8888, true)
} else {
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt
index a35891a5..b435b6e7 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt
@@ -105,7 +105,7 @@ class PasswordCreationActivityV2 : BasePgpActivity() {
return@registerForActivityResult
}
val bitmap =
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ if (Build.VERSION.SDK_INT >= 28) {
ImageDecoder.decodeBitmap(ImageDecoder.createSource(contentResolver, imageUri))
.copy(Bitmap.Config.ARGB_8888, true)
} else {
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/settings/AutofillSettings.kt b/app/src/main/java/dev/msfjarvis/aps/ui/settings/AutofillSettings.kt
index 10dae205..80dce577 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/settings/AutofillSettings.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/settings/AutofillSettings.kt
@@ -35,11 +35,11 @@ class AutofillSettings(private val activity: FragmentActivity) : SettingsProvide
private val isAutofillServiceEnabled: Boolean
get() {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return false
+ if (Build.VERSION.SDK_INT < 26) return false
return activity.autofillManager?.hasEnabledAutofillServices() == true
}
- @RequiresApi(Build.VERSION_CODES.O)
+ @RequiresApi(26)
private fun showAutofillDialog(pref: SwitchPreference) {
val observer = LifecycleEventObserver { _, event ->
when (event) {
@@ -95,10 +95,10 @@ class AutofillSettings(private val activity: FragmentActivity) : SettingsProvide
builder.apply {
switch(PreferenceKeys.AUTOFILL_ENABLE) {
titleRes = R.string.pref_autofill_enable_title
- visible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
+ visible = Build.VERSION.SDK_INT >= 26
defaultValue = isAutofillServiceEnabled
onClick {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return@onClick true
+ if (Build.VERSION.SDK_INT < 26) return@onClick true
if (isAutofillServiceEnabled) {
activity.autofillManager?.disableAutofillServices()
} else {
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/settings/GeneralSettings.kt b/app/src/main/java/dev/msfjarvis/aps/ui/settings/GeneralSettings.kt
index 6d8ab5f6..21ecd55c 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/settings/GeneralSettings.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/settings/GeneralSettings.kt
@@ -97,7 +97,7 @@ class GeneralSettings(private val activity: FragmentActivity) : SettingsProvider
}
}
}
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
+ if (Build.VERSION.SDK_INT >= 25) {
activity.getSystemService<ShortcutManager>()?.apply {
removeDynamicShortcuts(dynamicShortcuts.map { it.id }.toMutableList())
}
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/settings/MiscSettings.kt b/app/src/main/java/dev/msfjarvis/aps/ui/settings/MiscSettings.kt
index 8921317b..5bb50cd8 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/settings/MiscSettings.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/settings/MiscSettings.kt
@@ -47,7 +47,7 @@ class MiscSettings(activity: FragmentActivity) : SettingsProvider {
putExtra("uri", uri)
}
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ if (Build.VERSION.SDK_INT >= 26) {
activity.startForegroundService(service)
} else {
activity.startService(service)
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/settings/RepositorySettings.kt b/app/src/main/java/dev/msfjarvis/aps/ui/settings/RepositorySettings.kt
index ffd0f851..df34b145 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/settings/RepositorySettings.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/settings/RepositorySettings.kt
@@ -166,7 +166,7 @@ class RepositorySettings(private val activity: FragmentActivity) : SettingsProvi
}
.onFailure { it.message?.let { message -> activity.snackbar(message = message) } }
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
+ if (Build.VERSION.SDK_INT >= 25) {
activity.getSystemService<ShortcutManager>()?.apply {
removeDynamicShortcuts(dynamicShortcuts.map { it.id }.toMutableList())
}
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt b/app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt
index 22f2db85..745bad73 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt
@@ -7,7 +7,6 @@ package dev.msfjarvis.aps.util.autofill
import android.content.Context
import android.content.IntentSender
-import android.os.Build
import android.service.autofill.Dataset
import android.service.autofill.FillCallback
import android.service.autofill.FillResponse
@@ -36,7 +35,7 @@ import logcat.asLog
import logcat.logcat
/** Implements [AutofillResponseBuilder]'s methods for API 30 and above */
-@RequiresApi(Build.VERSION_CODES.R)
+@RequiresApi(30)
class Api30AutofillResponseBuilder
@AssistedInject
constructor(
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt
index 50d2684a..6803da47 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt
@@ -5,7 +5,6 @@
package dev.msfjarvis.aps.util.autofill
import android.content.Context
-import android.os.Build
import androidx.annotation.RequiresApi
import com.github.androidpasswordstore.autofillparser.Credentials
import dev.msfjarvis.aps.data.passfile.PasswordEntry
@@ -103,7 +102,7 @@ enum class DirectoryStructure(val value: String) {
?: file.nameWithoutExtension
}
- @RequiresApi(Build.VERSION_CODES.O)
+ @RequiresApi(26)
fun getSaveFolderName(sanitizedIdentifier: String, username: String?) =
when (this) {
EncryptedUsername -> "/"
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt
index 5c1c91d6..a091e206 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt
@@ -35,7 +35,7 @@ import logcat.LogPriority.ERROR
import logcat.asLog
import logcat.logcat
-@RequiresApi(Build.VERSION_CODES.O)
+@RequiresApi(26)
class AutofillResponseBuilder
@AssistedInject
constructor(
@@ -175,7 +175,7 @@ constructor(
addDataset(it)
}
if (datasetCount == 0) return null
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ if (Build.VERSION.SDK_INT >= 28) {
setHeader(
makeRemoteView(
context,
@@ -218,7 +218,7 @@ constructor(
// fill-in dataset without any visual representation. This causes it to be missing from
// the Autofill suggestions shown after the user clears the filled out form fields.
val builder =
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ if (Build.VERSION.SDK_INT >= 28) {
Dataset.Builder()
} else {
Dataset.Builder(makeRemoteView(context, makeEmptyMetadata()))
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillViewUtils.kt b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillViewUtils.kt
index f37c49ba..20414e6f 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillViewUtils.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillViewUtils.kt
@@ -47,7 +47,7 @@ fun makeInlinePresentation(
imeSpec: InlinePresentationSpec,
metadata: DatasetMetadata
): InlinePresentation? {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) return null
+ if (Build.VERSION.SDK_INT < 30) return null
if (UiVersions.INLINE_UI_VERSION_1 !in UiVersions.getVersions(imeSpec.style)) return null
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt b/app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt
index 4e045715..cc243a09 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt
@@ -11,7 +11,6 @@ import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
-import android.os.Build
import android.util.Base64
import android.util.TypedValue
import android.view.View
@@ -33,7 +32,7 @@ import logcat.logcat
/** Get an instance of [AutofillManager]. Only available on Android Oreo and above */
val Context.autofillManager: AutofillManager?
- @RequiresApi(Build.VERSION_CODES.O) get() = getSystemService()
+ @RequiresApi(26) get() = getSystemService()
/** Get an instance of [ClipboardManager] */
val Context.clipboard
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt b/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt
index d2dda45f..67e063a4 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt
@@ -120,7 +120,7 @@ object SshKey {
context.sharedPrefs.edit { putString(PreferenceKeys.GIT_REMOTE_KEY_TYPE, value?.value) }
private val isStrongBoxSupported by unsafeLazy {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
+ if (Build.VERSION.SDK_INT >= 28)
context.packageManager.hasSystemFeature(PackageManager.FEATURE_STRONGBOX_KEYSTORE)
else false
}
@@ -162,7 +162,7 @@ object SshKey {
setKeySize(256)
setAlgorithmParameterSpec(java.security.spec.ECGenParameterSpec("secp256r1"))
setDigests(KeyProperties.DIGEST_SHA256)
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ if (Build.VERSION.SDK_INT >= 28) {
setIsStrongBoxBacked(isStrongBoxSupported)
}
}
@@ -284,7 +284,7 @@ object SshKey {
apply(algorithm.applyToSpec)
if (requireAuthentication) {
setUserAuthenticationRequired(true)
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ if (Build.VERSION.SDK_INT >= 30) {
setUserAuthenticationParameters(30, KeyProperties.AUTH_DEVICE_CREDENTIAL)
} else {
@Suppress("DEPRECATION") setUserAuthenticationValidityDurationSeconds(30)
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/services/ClipboardService.kt b/app/src/main/java/dev/msfjarvis/aps/util/services/ClipboardService.kt
index 580cd4b5..34c3a989 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/services/ClipboardService.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/services/ClipboardService.kt
@@ -112,8 +112,17 @@ class ClipboardService : Service() {
val clearTimeMs = clearTime * 1000L
val clearIntent = Intent(this, ClipboardService::class.java).apply { action = ACTION_CLEAR }
val pendingIntent =
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- PendingIntent.getForegroundService(this, 0, clearIntent, PendingIntent.FLAG_UPDATE_CURRENT)
+ if (Build.VERSION.SDK_INT >= 26) {
+ PendingIntent.getForegroundService(
+ this,
+ 0,
+ clearIntent,
+ if (Build.VERSION.SDK_INT >= 31) {
+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
+ } else {
+ PendingIntent.FLAG_UPDATE_CURRENT
+ }
+ )
} else {
PendingIntent.getService(
this,
@@ -127,7 +136,7 @@ class ClipboardService : Service() {
)
}
val notification =
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
+ if (Build.VERSION.SDK_INT <= 23) {
createNotificationApi23(pendingIntent)
} else {
createNotificationApi24(pendingIntent, clearTimeMs)
@@ -148,7 +157,7 @@ class ClipboardService : Service() {
.build()
}
- @RequiresApi(Build.VERSION_CODES.N)
+ @RequiresApi(24)
private fun createNotificationApi24(
pendingIntent: PendingIntent,
clearTimeMs: Long
@@ -167,7 +176,7 @@ class ClipboardService : Service() {
}
private fun createNotificationChannel() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ if (Build.VERSION.SDK_INT >= 26) {
val serviceChannel =
NotificationChannel(
CHANNEL_ID,
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/services/OreoAutofillService.kt b/app/src/main/java/dev/msfjarvis/aps/util/services/OreoAutofillService.kt
index 7b804f3e..3a1c69d3 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/services/OreoAutofillService.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/services/OreoAutofillService.kt
@@ -37,7 +37,7 @@ import javax.inject.Inject
import logcat.LogPriority.ERROR
import logcat.logcat
-@RequiresApi(Build.VERSION_CODES.O)
+@RequiresApi(26)
@AndroidEntryPoint
class OreoAutofillService : AutofillService() {
@@ -102,7 +102,7 @@ class OreoAutofillService : AutofillService() {
callback.onSuccess(null)
return
}
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ if (Build.VERSION.SDK_INT >= 30) {
api30ResponseBuilderFactory
.create(formToFill)
.fillCredentials(this, request.inlineSuggestionsRequest, callback)
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/services/PasswordExportService.kt b/app/src/main/java/dev/msfjarvis/aps/util/services/PasswordExportService.kt
index 6740fc04..91a7ac5f 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/services/PasswordExportService.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/services/PasswordExportService.kt
@@ -65,7 +65,7 @@ class PasswordExportService : Service() {
logcat { "Copying ${repositoryDirectory.path} to $targetDirectory" }
val dateString =
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ if (Build.VERSION.SDK_INT >= 26) {
LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)
} else {
String.format("%tFT%<tRZ", Calendar.getInstance(TimeZone.getTimeZone("Z")))
@@ -135,7 +135,7 @@ class PasswordExportService : Service() {
}
private fun createNotificationChannel() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ if (Build.VERSION.SDK_INT >= 26) {
val serviceChannel =
NotificationChannel(
CHANNEL_ID,
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/shortcuts/ShortcutHandler.kt b/app/src/main/java/dev/msfjarvis/aps/util/shortcuts/ShortcutHandler.kt
index 59eda23e..2ca881ed 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/shortcuts/ShortcutHandler.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/shortcuts/ShortcutHandler.kt
@@ -42,7 +42,7 @@ constructor(
* [MAX_SHORTCUT_COUNT] and older items are removed by a simple LRU sweep.
*/
fun addDynamicShortcut(item: PasswordItem, intent: Intent) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return
+ if (Build.VERSION.SDK_INT < 25) return
val shortcutManager: ShortcutManager = context.getSystemService() ?: return
val shortcut = buildShortcut(item, intent)
val shortcuts = shortcutManager.dynamicShortcuts
@@ -67,7 +67,7 @@ constructor(
* a no-op if the user's default launcher does not support pinned shortcuts.
*/
fun addPinnedShortcut(item: PasswordItem, intent: Intent) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
+ if (Build.VERSION.SDK_INT < 26) return
val shortcutManager: ShortcutManager = context.getSystemService() ?: return
if (!shortcutManager.isRequestPinShortcutSupported) {
logcat { "addPinnedShortcut: pin shortcuts unsupported" }
@@ -78,7 +78,7 @@ constructor(
}
/** Creates a [ShortcutInfo] from [item] and assigns [intent] to it. */
- @RequiresApi(Build.VERSION_CODES.N_MR1)
+ @RequiresApi(25)
private fun buildShortcut(item: PasswordItem, intent: Intent): ShortcutInfo {
return ShortcutInfo.Builder(context, item.fullPathToParent)
.setShortLabel(item.toString())
@@ -93,7 +93,7 @@ constructor(
* data, which ensures that the get/set dance in [addDynamicShortcut] does not cause invalidation
* of icon assets, resulting in invisible icons in all but the newest launcher shortcut.
*/
- @RequiresApi(Build.VERSION_CODES.N_MR1)
+ @RequiresApi(25)
private fun rebuildShortcut(shortcut: ShortcutInfo): ShortcutInfo {
// Non-null assertions are fine since we know these values aren't null.
return ShortcutInfo.Builder(context, shortcut.id)
diff --git a/app/src/nonFree/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt b/app/src/nonFree/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt
index e6cc3920..f251773a 100644
--- a/app/src/nonFree/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt
+++ b/app/src/nonFree/java/dev/msfjarvis/aps/autofill/oreo/ui/AutofillSmsActivity.kt
@@ -52,7 +52,7 @@ suspend fun <T> Task<T>.suspendableAwait() =
}
}
-@RequiresApi(Build.VERSION_CODES.O)
+@RequiresApi(26)
class AutofillSmsActivity : AppCompatActivity() {
companion object {
@@ -60,7 +60,7 @@ class AutofillSmsActivity : AppCompatActivity() {
private var fillOtpFromSmsRequestCode = 1
fun shouldOfferFillFromSms(context: Context): Boolean {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return false
+ if (Build.VERSION.SDK_INT < 28) return false
val googleApiAvailabilityInstance = GoogleApiAvailability.getInstance()
val googleApiStatus = googleApiAvailabilityInstance.isGooglePlayServicesAvailable(context)
if (googleApiStatus != ConnectionResult.SUCCESS) {