Status Update
Comments
lp...@google.com <lp...@google.com> #2
We have some support in androidx.compose.ui.autofill
Leaving this bug open in case Ralston wants to add more info
yu...@paypay-corp.co.jp <yu...@paypay-corp.co.jp> #3
I found an example
D/Autofill Status: Autofill popup isn't shown because autofill is not available.
Did you set up autofill?
1. Go to Settings > System > Languages&input > Advanced > Autofill Service
2. Pick a service
Did you add an account?
1. Go to Settings > System > Languages&input > Advanced
2. Click on the settings icon next to the Autofill Service
3. Add your account
Is this a bug on your side or do the app developers of these password managers need to change their implementation?
ek...@uber.com <ek...@uber.com> #5
mo...@google.com <mo...@google.com> #6
fe...@gmail.com <fe...@gmail.com> #7
be...@google.com <be...@google.com> #8
I setup this modifier:
@OptIn(ExperimentalComposeUiApi::class)
fun Modifier.autofill(
autofillTypes: List<AutofillType>,
onFill: ((String) -> Unit),
) = composed {
val autofill = LocalAutofill.current
val autofillNode = AutofillNode(onFill = onFill, autofillTypes = autofillTypes)
LocalAutofillTree.current += autofillNode
this.onGloballyPositioned {
autofillNode.boundingBox = it.boundsInWindow()
}.onFocusChanged { focusState ->
autofill?.run {
if (focusState.isFocused) {
requestAutofillForNode(autofillNode)
} else {
cancelAutofillForNode(autofillNode)
}
}
}
}
And use it like this:
val emailState = remember { EmailState() }
Email(
modifier = Modifier.autofill(
autofillTypes = listOf(
AutofillType.Username,
AutofillType.EmailAddress
),
onFill = { emailState.text = it },
),
emailState = emailState,
onImeAction = { onForgotPasswordSubmitted(emailState.text) }
)
With these steps, autofill works for me.
yu...@paypay-corp.co.jp <yu...@paypay-corp.co.jp> #10
Works perfectly fine on the latest stable and alpha versions. Did you check in my second comment if you enabled everything?
be...@google.com <be...@google.com> #11
I believe so?
I copied the modifier and then used
modifier = Modifier.autofill(
autofillTypes = listOf(
AutofillType.Username,
AutofillType.EmailAddress
),
onFill = { emailState.text = it },
)
on my text field.
co...@squareup.com <co...@squareup.com> #12
mo...@google.com <mo...@google.com> #13
The auto-filling works for me with the latest alpha version, but I'm never presented with the save dialog though.
I am having exactly same problem. Autofill works, but the Save dialog is never shown...
mo...@google.com <mo...@google.com> #14
Any updates on this? I can't get LastPass to display at all. I can ONLY get the Google Auto-fill service to work
se...@gmail.com <se...@gmail.com> #15
Same here, autofill in Jetpack Compose only works with the Google auto-fill service. When picking 1Password as the Auto-fill service in Settings, the debug log prints out:
D/Autofill Status: Autofill popup isn't shown because autofill is not available.
Did you set up autofill?
1. Go to Settings > System > Languages&input > Advanced > Autofill Service
2. Pick a service
Did you add an account?
1. Go to Settings > System > Languages&input > Advanced
2. Click on the settings icon next to the Autofill Service
3. Add your account
ek...@uber.com <ek...@uber.com> #16
se...@gmail.com <se...@gmail.com> #17
se...@gmail.com <se...@gmail.com> #18
1.3.1 won't dialog prompt to save a password for me but will prompt to autofill for google.
As a workaround, you can wrap the TextInputLayout from a layout file to an AndroidView in compose.
@Composable
fun TextFieldView(
modifier: Modifier = Modifier,
textState: MutableState<String>,
@LayoutRes layoutRes: Int,
textChanged: () -> Unit = {},
) {
AndroidView(
modifier = modifier
.fillMaxWidth(),
factory = { context ->
val layout = LayoutInflater.from(context).inflate(layoutRes, null)
layout.findViewById<TextInputEditText>(R.id.tilET).apply {
doAfterTextChanged {
textState.value = safeText
textChanged.invoke()
}
}
layout
},
update = {
}
)
}
val EditText?.safeText: String get() = this?.editableText?.toString().orEmpty().trim()
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.textfield.TextInputLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/til"
style="@style/TextInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tilET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:selectAllOnFocus="true" />
</com.google.android.material.textfield.TextInputLayout>
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.textfield.TextInputLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/til"
style="@style/TextInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
app:endIconMode="password_toggle">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tilET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:selectAllOnFocus="true" />
</com.google.android.material.textfield.TextInputLayout>
mo...@google.com <mo...@google.com> #19
se...@gmail.com <se...@gmail.com> #20
ta...@gotinder.com <ta...@gotinder.com> #21
I tried using similar to above example. But its not working & following logs are getting printed.
getAutofillClient(): null on super, trying to find activity thread getAutofillClient(): none of the 1 activities on com.xx@8b0a7bc have focus No AutofillClient for com.xx on context com.xxn@8b0a7bc requestHideFillUi(null): anchor = null
Autofill popup isn't shown because autofill is not available. Did you set up autofill?
- Go to Settings > System > Languages&input > Advanced > Autofill Service
- Pick a service
Did you add an account?
- Go to Settings > System > Languages&input > Advanced
- Click on the settings icon next to the Autofill Service
- Add your account
setSessionFinished(): from ACTIVE to FINISHED; autofillableIds=null
Can anyone help
yu...@paypay-corp.co.jp <yu...@paypay-corp.co.jp> #23
ta...@gotinder.com <ta...@gotinder.com> #24
Any update? It would be good to fix it asap, please.
g....@cmcmarkets.com <g....@cmcmarkets.com> #25
Any update on this?
It can be overlooked since it is simple but one of the important convenience feature.
ap...@google.com <ap...@google.com> #26
Autofill is currently listed as "In Focus" on our
pr...@google.com <pr...@google.com> #27
compose bom version: 2023.06.01
AS: Giraffe 2022.3.1
ai...@gmail.com <ai...@gmail.com> #28
Solution from AutofillManager
launches unsafe intent:
StrictMode policy violation: android.os.strictmode.UnsafeIntentLaunchViolation: Launch of unsafe intent: Intent { (has extras) }
at android.os.StrictMode.onUnsafeIntentLaunch(StrictMode.java:2329)
at android.content.Intent.prepareToLeaveProcess(Intent.java:12589)
at android.content.Intent.prepareToLeaveProcess(Intent.java:12501)
at android.app.Activity.startIntentSenderForResultInner(Activity.java:5973)
at android.app.Activity.startIntentSenderForResult(Activity.java:5915)
at android.view.autofill.AutofillClientController.autofillClientAuthenticate(AutofillClientController.java:484)
at android.view.autofill.AutofillManager.authenticate(AutofillManager.java:2433)
at android.view.autofill.AutofillManager.-$$Nest$mauthenticate(Unknown Source:0)
at android.view.autofill.AutofillManager$AutofillManagerClient.lambda$authenticate$3(AutofillManager.java:3821)
at android.view.autofill.AutofillManager$AutofillManagerClient$$ExternalSyntheticLambda3.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
au...@google.com <au...@google.com> #29
We are seeing "Contents can't be autofilled" toast message, when user has other password managers that aren't google, such as Samsung Pass
mo...@google.com <mo...@google.com> #30
Could you please post some updates on this?
- it is one year in the roadmap:
https://developer.android.com/jetpack/androidx/compose-roadmap - one CL abandoned more than a year ago:
https://android-review.googlesource.com/c/platform/frameworks/support/+/2434079 - another CL is getting silent:
https://android-review.googlesource.com/c/platform/frameworks/support/+/3009614
It is sad that almost 3 years after a stable release of Compose there is still no support for Autofill.
ta...@gotinder.com <ta...@gotinder.com> #31
A quick update here -
We built autofill for 1.7 and found that we need to do some substantial rework of the semantics system before it lands (this is ongoing top priority - aiming for hopefully 1.8).
Turning it on caused a large performance drop app-wide. We're working on fixing that, and then will turn autofill on.
It's currently #1 item on all of prioritization for compose feature work. Will give more update when it's getting closer to landing.
ta...@gotinder.com <ta...@gotinder.com> #32
pr...@google.com <pr...@google.com> #33
See
ek...@uber.com <ek...@uber.com> #34
au...@google.com <au...@google.com> #35
The majority of autofill CLs landed this week. It seems that the next alpha should have this :) 🤞
au...@google.com <au...@google.com> #36
We'd appreciate any feedback on the API shape. If you want to test the APIs, you can turn on the flag by adding ComposeUiFlags.isSemanticAutofillEnabled = true in your onCreate() method before super.onCreate() and add in the latest Snapshot version in your build.gradle file.
Please note that turning on this flag will lead to performance regressions and also know the API shape may be different when we officially release it.
Happy coding!
Description
Kotlin version: 1.9.23
Steps to Reproduce or Code Sample to Reproduce:
Ours is a View interop case. (Two text fields and a Compose Button in XML layout). Clicking on IME done crashes the app with:
Stack trace (if applicable):
```
Fatal Exception: java.lang.IllegalStateException: focus search returned a view that wasn't able to take focus!
at android.widget.TextView.onKeyUp(TextView.java:10271)
at android.view.KeyEvent.dispatch(KeyEvent.java:3175)
at android.view.View.dispatchKeyEvent(View.java:15781)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.widget.ScrollView.dispatchKeyEvent(ScrollView.java:591)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.widget.ScrollView.dispatchKeyEvent(ScrollView.java:591)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1987)
at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:669)
at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:2010)
at android.app.Activity.dispatchKeyEvent(Activity.java:4595)
at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.kt:103)
at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85)
at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.kt:117)
at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:604)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:3397)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:515)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:7822)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:7679)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7058)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7125)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7086)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:7259)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7094)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:7316)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7062)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7125)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7086)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7094)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7062)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:10383)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:10334)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:10295)
at android.view.ViewRootImpl$ViewRootHandler.handleMessageImpl(ViewRootImpl.java:6803)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:6667)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:328)
at android.app.ActivityThread.main(ActivityThread.java:9239)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:594)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
```