diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-04-24 16:06:48 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2022-04-24 16:47:50 +0530 |
commit | 95f16cbf5afef3c55ed23bbad615607954db50d3 (patch) | |
tree | fd9a2de1030390262688b71192dbada12bbed823 | |
parent | 9cae158e3469be142aae1c38c511a34201b52dc0 (diff) |
app: address InlinedApi lint
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 @@ -2,72 +2,6 @@ <issues format="6" by="lint 7.1.3" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.3)" variant="all" version="7.1.3"> <issue - id="InlinedApi" - message="Field requires API level 31 (current min is 26): `android.app.PendingIntent#FLAG_MUTABLE`" - errorLine1=" PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE," - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~"> - <location - file="src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt" - line="81" - column="48"/> - </issue> - - <issue - id="InlinedApi" - message="Field requires API level 31 (current min is 26): `android.app.PendingIntent#FLAG_MUTABLE`" - errorLine1=" PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE," - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~"> - <location - file="src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt" - line="70" - column="48"/> - </issue> - - <issue - id="InlinedApi" - message="Field requires API level 31 (current min is 26): `android.app.PendingIntent#FLAG_MUTABLE`" - errorLine1=" PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE," - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~"> - <location - file="src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillFilterView.kt" - line="77" - column="48"/> - </issue> - - <issue - id="InlinedApi" - message="Field requires API level 31 (current min is 26): `android.app.PendingIntent#FLAG_MUTABLE`" - errorLine1=" PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_MUTABLE," - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~"> - <location - file="src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillPublisherChangedActivity.kt" - line="57" - column="48"/> - </issue> - - <issue - id="InlinedApi" - message="Field requires API level 31 (current min is 23): `android.app.PendingIntent#FLAG_MUTABLE`" - errorLine1=" PendingIntent.FLAG_MUTABLE" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~"> - <location - file="src/main/java/dev/msfjarvis/aps/util/autofill/AutofillViewUtils.kt" - line="59" - column="7"/> - </issue> - - <issue - id="InlinedApi" - message="Field requires API level 31 (current min is 23): `android.app.PendingIntent#FLAG_MUTABLE`" - errorLine1=" PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~"> - <location - file="src/main/java/dev/msfjarvis/aps/util/services/ClipboardService.kt" - line="122" - column="48"/> - </issue> - - <issue id="VectorRaster" message="Resource references will not work correctly in images generated for this vector icon for API < 24; check generated icon to make sure it looks acceptable" errorLine1=" android:tint="?attr/colorControlNormal"" 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 b6b8a78a..291c654f 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 @@ -78,7 +78,11 @@ class AutofillDecryptActivity : 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 } @@ -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<IOpenPgpService2> { 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 = |