From 12bf9849a07fe6e6a4469f8fafb802527c932943 Mon Sep 17 00:00:00 2001 From: Cristian Monforte Date: Thu, 30 Jan 2025 13:22:07 +0100 Subject: [PATCH] fixing lint --- autofill/autofill-impl/lint-baseline.xml | 66 +++++++++++++++++++ .../service/AutofillProviderSuggestions.kt | 3 +- .../service/AutofillServiceViewProvider.kt | 7 +- .../RealAutofillProviderSuggestionsTest.kt | 5 +- 4 files changed, 72 insertions(+), 9 deletions(-) diff --git a/autofill/autofill-impl/lint-baseline.xml b/autofill/autofill-impl/lint-baseline.xml index 855a3d582afa..31a2c68a6859 100644 --- a/autofill/autofill-impl/lint-baseline.xml +++ b/autofill/autofill-impl/lint-baseline.xml @@ -2025,6 +2025,17 @@ column="25"/> + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillProviderSuggestions.kt b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillProviderSuggestions.kt index fe23edf7de65..eb2dde66a635 100644 --- a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillProviderSuggestions.kt +++ b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillProviderSuggestions.kt @@ -20,7 +20,6 @@ import android.annotation.SuppressLint import android.app.PendingIntent import android.content.Context import android.content.Intent -import android.os.Build.VERSION_CODES import android.service.autofill.Dataset import android.service.autofill.FillRequest import android.service.autofill.FillResponse @@ -142,7 +141,7 @@ class RealAutofillProviderSuggestions @Inject constructor( return ddgAppDataSetBuild } - @RequiresApi(VERSION_CODES.R) + @RequiresApi(30) private fun Dataset.Builder.addInlinePresentationsIfSupported( context: Context, request: FillRequest, diff --git a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillServiceViewProvider.kt b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillServiceViewProvider.kt index 89e3e54ca39d..ebbcd1905bc8 100644 --- a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillServiceViewProvider.kt +++ b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/service/AutofillServiceViewProvider.kt @@ -21,7 +21,6 @@ import android.app.PendingIntent import android.app.slice.Slice import android.content.Context import android.graphics.drawable.Icon -import android.os.Build.VERSION_CODES import android.service.autofill.InlinePresentation import android.widget.RemoteViews import android.widget.inline.InlinePresentationSpec @@ -72,7 +71,7 @@ class RealAutofillServiceViewProvider @Inject constructor( iconRes = icon, ) - @RequiresApi(VERSION_CODES.R) + @RequiresApi(30) override fun createInlinePresentation( context: Context, pendingIntent: PendingIntent, @@ -89,7 +88,7 @@ class RealAutofillServiceViewProvider @Inject constructor( return null } - @RequiresApi(VERSION_CODES.R) + @RequiresApi(30) private fun isInlineSuggestionSupported(inlinePresentationSpec: InlinePresentationSpec?): Boolean { // requires >= android 11 return if (appBuildConfig.sdkInt >= 30 && inlinePresentationSpec != null) { @@ -100,7 +99,7 @@ class RealAutofillServiceViewProvider @Inject constructor( } @SuppressLint("RestrictedApi") // because getSlice, but docs clearly indicate you need to use that method. - @RequiresApi(VERSION_CODES.R) + @RequiresApi(30) private fun createSlice( context: Context, pendingIntent: PendingIntent, diff --git a/autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/service/RealAutofillProviderSuggestionsTest.kt b/autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/service/RealAutofillProviderSuggestionsTest.kt index 263d090b8d57..753049c04fc2 100644 --- a/autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/service/RealAutofillProviderSuggestionsTest.kt +++ b/autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/service/RealAutofillProviderSuggestionsTest.kt @@ -16,7 +16,6 @@ package com.duckduckgo.autofill.impl.service -import android.os.Build.VERSION_CODES import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry import com.duckduckgo.appbuildconfig.api.AppBuildConfig @@ -44,7 +43,7 @@ class RealAutofillProviderSuggestionsTest { private val context = InstrumentationRegistry.getInstrumentation().targetContext private val appBuildConfig = mock().apply { - whenever(sdkInt).thenReturn(VERSION_CODES.R) + whenever(sdkInt).thenReturn(30) } private val autofillStore = mock() @@ -68,7 +67,7 @@ class RealAutofillProviderSuggestionsTest { val credentials = listOf( LoginCredentials(1L, "username", "password", "example.com"), ) - whenever(appBuildConfig.sdkInt).thenReturn(VERSION_CODES.Q) + whenever(appBuildConfig.sdkInt).thenReturn(29) whenever(autofillStore.getCredentials(any())).thenReturn(credentials) whenever(mockViewProvider.createFormPresentation(any(), any(), any(), any())).thenReturn(mock()) whenever(mockViewProvider.createInlinePresentation(any(), any(), any(), any(), any(), any())).thenReturn(null)