Skip to content

Commit

Permalink
fixing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cmonfortep committed Feb 4, 2025
1 parent fc50c76 commit 12bf984
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 9 deletions.
66 changes: 66 additions & 0 deletions autofill/autofill-impl/lint-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2025,6 +2025,17 @@
column="25"/>
</issue>

<issue
id="Overdraw"
message="Possible overdraw: Root element paints background `@color/gray0` with a theme that also paints a background (inferred theme is `@android:style/Theme.Holo`)"
errorLine1=" android:background=&quot;@color/gray0&quot;>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/autofill_remote_view.xml"
line="11"
column="5"/>
</issue>

<issue
id="Overdraw"
message="Possible overdraw: Root element paints background `?attr/colorPrimaryDark` with a theme that also paints a background (inferred theme is `@android:style/Theme.Holo`)"
Expand Down Expand Up @@ -2436,4 +2447,59 @@
column="10"/>
</issue>

<issue
id="DeprecatedWidgetInXml"
message="Always favor the use of the Design System Component"
errorLine1=" &lt;TextView"
errorLine2=" ~~~~~~~~">
<location
file="src/main/res/layout/autofill_remote_view.xml"
line="29"
column="10"/>
</issue>

<issue
id="DeprecatedWidgetInXml"
message="Always favor the use of the Design System Component"
errorLine1=" &lt;TextView"
errorLine2=" ~~~~~~~~">
<location
file="src/main/res/layout/autofill_remote_view.xml"
line="36"
column="10"/>
</issue>

<issue
id="InvalidColorAttribute"
message="@colors are not allowed, used ?attr/daxColor instead"
errorLine1=" android:background=&quot;@color/gray0&quot;>"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/autofill_remote_view.xml"
line="11"
column="5"/>
</issue>

<issue
id="InvalidColorAttribute"
message="@colors are not allowed, used ?attr/daxColor instead"
errorLine1=" android:textColor=&quot;@color/gray100&quot;/>"
errorLine2=" ~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/autofill_remote_view.xml"
line="34"
column="13"/>
</issue>

<issue
id="InvalidColorAttribute"
message="@colors are not allowed, used ?attr/daxColor instead"
errorLine1=" android:textColor=&quot;@color/gray100&quot;/>"
errorLine2=" ~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/autofill_remote_view.xml"
line="41"
column="13"/>
</issue>

</issues>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -72,7 +71,7 @@ class RealAutofillServiceViewProvider @Inject constructor(
iconRes = icon,
)

@RequiresApi(VERSION_CODES.R)
@RequiresApi(30)
override fun createInlinePresentation(
context: Context,
pendingIntent: PendingIntent,
Expand All @@ -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) {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -44,7 +43,7 @@ class RealAutofillProviderSuggestionsTest {
private val context = InstrumentationRegistry.getInstrumentation().targetContext

private val appBuildConfig = mock<AppBuildConfig>().apply {
whenever(sdkInt).thenReturn(VERSION_CODES.R)
whenever(sdkInt).thenReturn(30)
}

private val autofillStore = mock<AutofillStore>()
Expand All @@ -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)
Expand Down

0 comments on commit 12bf984

Please sign in to comment.