From 95f16cbf5afef3c55ed23bbad615607954db50d3 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 24 Apr 2022 16:06:48 +0530 Subject: [PATCH] app: address InlinedApi lint --- app/lint-baseline.xml | 66 ------------------- .../ui/autofill/AutofillDecryptActivity.kt | 14 ++-- .../ui/autofill/AutofillDecryptActivityV2.kt | 6 +- .../aps/ui/autofill/AutofillFilterView.kt | 6 +- .../AutofillPublisherChangedActivity.kt | 6 +- .../aps/util/autofill/AutofillViewUtils.kt | 6 +- .../aps/util/services/ClipboardService.kt | 6 +- 7 files changed, 32 insertions(+), 78 deletions(-) diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index ecde9f99..b2d0b78e 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -1,72 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - = 31) { + PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE + } else { + PendingIntent.FLAG_CANCEL_CURRENT + }, ) .intentSender } @@ -147,15 +151,11 @@ class AutofillDecryptActivity : AppCompatActivity() { } } - override fun onDestroy() { - super.onDestroy() - } - private suspend fun executeOpenPgpApi( data: Intent, input: InputStream, output: OutputStream - ): Intent? { + ): Intent { var openPgpServiceConnection: OpenPgpServiceConnection? = null val openPgpService = suspendCoroutine { cont -> @@ -196,7 +196,7 @@ class AutofillDecryptActivity : AppCompatActivity() { } .onSuccess { result -> return when (val resultCode = - result?.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR) + result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR) ) { OpenPgpApi.RESULT_CODE_SUCCESS -> { runCatching { 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 a784f64b..d7287605 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 @@ -67,7 +67,11 @@ class AutofillDecryptActivityV2 : AppCompatActivity() { context, decryptFileRequestCode++, intent, - PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE, + if (Build.VERSION.SDK_INT >= 31) { + PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE + } else { + PendingIntent.FLAG_CANCEL_CURRENT + }, ) .intentSender } 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 ddabb8a8..573e5337 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 @@ -74,7 +74,11 @@ class AutofillFilterView : AppCompatActivity() { context, matchAndDecryptFileRequestCode++, intent, - PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE, + if (Build.VERSION.SDK_INT >= 31) { + PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE + } else { + PendingIntent.FLAG_CANCEL_CURRENT + }, ) .intentSender } 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 2250c52e..4ab5f45a 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 @@ -54,7 +54,11 @@ class AutofillPublisherChangedActivity : AppCompatActivity() { context, publisherChangedRequestCode++, intent, - PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE, + if (Build.VERSION.SDK_INT >= 31) { + PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE + } else { + PendingIntent.FLAG_CANCEL_CURRENT + }, ) .intentSender } 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 8c6f64c0..f37c49ba 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 @@ -56,7 +56,11 @@ fun makeInlinePresentation( context, 0, Intent(context, PasswordStore::class.java), - PendingIntent.FLAG_MUTABLE + if (Build.VERSION.SDK_INT >= 31) { + PendingIntent.FLAG_MUTABLE + } else { + 0 + }, ) val slice = InlineSuggestionUi.newContentBuilder(launchIntent).run { 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 af6c4383..580cd4b5 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 @@ -119,7 +119,11 @@ class ClipboardService : Service() { this, 0, clearIntent, - PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE + if (Build.VERSION.SDK_INT >= 31) { + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE + } else { + PendingIntent.FLAG_UPDATE_CURRENT + }, ) } val notification =