Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autofill Service provider - showing suggestions on other apps - internal version #5561

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

cmonfortep
Copy link
Contributor

@cmonfortep cmonfortep commented Jan 30, 2025

Task/Issue URL: https://app.asana.com/0/1149059203486286/1209279712661815/f

Description

Scope:
Create autofill Service (only internal)
Parse structure
Apply heuristics
Extract packageId or Domain
Show suggestions
autofill on suggestion clicked
Show "Search in DDG" suggestion (only UI)

Steps to test this PR

The easiest way to test the logic here is to do it using #5508
And use https://app.asana.com/0/1149059203486286/1209279712661812/f for test scenarios

UI changes

Before After
!(Upload before screenshot) (Upload after screenshot)

@cmonfortep cmonfortep changed the title Autofill Service provider - showing suggestion on apps Autofill Service provider - showing suggestions on other apps Jan 30, 2025
@cmonfortep cmonfortep changed the title Autofill Service provider - showing suggestions on other apps Autofill Service provider - showing suggestions on other apps - internal version Jan 30, 2025
@cmonfortep cmonfortep force-pushed the feature/cristian/autofill/autofill_provider_poc branch from 1814778 to 3a16022 Compare January 30, 2025 11:13
@cmonfortep
Copy link
Contributor Author

cmonfortep commented Jan 30, 2025

@cmonfortep cmonfortep marked this pull request as ready for review January 30, 2025 11:14
@cmonfortep cmonfortep requested a review from CDRussell January 30, 2025 11:14
@cmonfortep cmonfortep force-pushed the feature/cristian/autofill/autofill_provider_poc branch from 3a16022 to 8647864 Compare January 30, 2025 11:51
autofill/autofill-impl/build.gradle Show resolved Hide resolved
override fun parseStructure(structure: AssistStructure): MutableList<AutofillRootNode> {
val autofillRootNodes = mutableListOf<AutofillRootNode>()
val windowNodeCount = structure.windowNodeCount
Timber.i("DDGAutofillService windowNodeCount: $windowNodeCount")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: will comment on the logging just the once, but this comment applies to all logs added in this PR

  • are all the logs added going to be too noisy to keep around as is, especially at the info level?
  • maybe worth doing a pass seeing if they should be kept and/or downgraded to verbose

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the proposal of keeping the debug ones as verbose.

I'm gonna do some clean up, but some of them are really helpful when understanding heuristics results.

import timber.log.Timber

@InjectWith(scope = ServiceScope::class)
class RealAutofillService : AutofillService() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want some global error handling around the autofill service parsing, and in here is the likely place i think. going on the model that any errors happening in autofill service should not result in our app crashing.

e.g., top level runCatching inside onFillRequest ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add some runCatching now, but intention is to send an error pixel if it crashes. That will be included when we implement pixels.

return PendingIntent
.getActivity(
context,
Random.nextInt(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment to explain why Random.nextInt() is needed here

val domain = credential.nonEmptyDomain()
val domainTitle = credential.nonEmptyDomainTitle()

val title = listOfNotNull(userName, domainTitle, domain).first()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.first() will crash if the list is empty. not sure if that’s possible at this point or not, or if the caller of this function prevents it. but would be best if we didn’t rely on the caller to avoid a crash. maybe use firstOrNull and handle the null case in here?

@cmonfortep cmonfortep force-pushed the feature/cristian/autofill/autofill_provider_poc branch from cb79246 to 12bf984 Compare February 4, 2025 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants