@@ -43,7 +43,7 @@ public class TextInputPlugin implements ListenableEditingState.EditingStateWatch
43
43
@ NonNull private final TextInputChannel textInputChannel ;
44
44
@ NonNull private InputTarget inputTarget = new InputTarget (InputTarget .Type .NO_TARGET , 0 );
45
45
@ Nullable private TextInputChannel .Configuration configuration ;
46
- @ Nullable private SparseArray <TextInputChannel .Configuration > mAutofillConfigurations ;
46
+ @ Nullable private SparseArray <TextInputChannel .Configuration > autofillConfiguration ;
47
47
@ NonNull private ListenableEditingState mEditable ;
48
48
private boolean mRestartInputPending ;
49
49
@ Nullable private InputConnection lastInputConnection ;
@@ -556,6 +556,7 @@ void clearTextInputClient() {
556
556
}
557
557
mEditable .removeEditingStateListener (this );
558
558
notifyViewExited ();
559
+ configuration = null ;
559
560
updateAutofillConfigurationIfNeeded (null );
560
561
inputTarget = new InputTarget (InputTarget .Type .NO_TARGET , 0 );
561
562
unlockPlatformViewInputConnection ();
@@ -679,7 +680,7 @@ public void didChangeEditingState(
679
680
// have changed. However if the value of an unfocused EditableText is changed in the framework,
680
681
// such change will not be sent to the text input plugin until the next TextInput.attach call.
681
682
private boolean needsAutofill () {
682
- return mAutofillConfigurations != null ;
683
+ return autofillConfiguration != null ;
683
684
}
684
685
685
686
private void notifyViewEntered () {
@@ -724,21 +725,20 @@ private void updateAutofillConfigurationIfNeeded(TextInputChannel.Configuration
724
725
725
726
if (configuration == null || configuration .autofill == null ) {
726
727
// Disables autofill if the configuration doesn't have an autofill field.
727
- mAutofillConfigurations = null ;
728
+ autofillConfiguration = null ;
728
729
return ;
729
730
}
730
731
731
732
final TextInputChannel .Configuration [] configurations = configuration .fields ;
732
- mAutofillConfigurations = new SparseArray <>();
733
+ autofillConfiguration = new SparseArray <>();
733
734
734
735
if (configurations == null ) {
735
- mAutofillConfigurations .put (
736
- configuration .autofill .uniqueIdentifier .hashCode (), configuration );
736
+ autofillConfiguration .put (configuration .autofill .uniqueIdentifier .hashCode (), configuration );
737
737
} else {
738
738
for (TextInputChannel .Configuration config : configurations ) {
739
739
TextInputChannel .Configuration .Autofill autofill = config .autofill ;
740
740
if (autofill != null ) {
741
- mAutofillConfigurations .put (autofill .uniqueIdentifier .hashCode (), config );
741
+ autofillConfiguration .put (autofill .uniqueIdentifier .hashCode (), config );
742
742
afm .notifyValueChanged (
743
743
mView ,
744
744
autofill .uniqueIdentifier .hashCode (),
@@ -755,9 +755,9 @@ public void onProvideAutofillVirtualStructure(@NonNull ViewStructure structure,
755
755
756
756
final String triggerIdentifier = configuration .autofill .uniqueIdentifier ;
757
757
final AutofillId parentId = structure .getAutofillId ();
758
- for (int i = 0 ; i < mAutofillConfigurations .size (); i ++) {
759
- final int autofillId = mAutofillConfigurations .keyAt (i );
760
- final TextInputChannel .Configuration config = mAutofillConfigurations .valueAt (i );
758
+ for (int i = 0 ; i < autofillConfiguration .size (); i ++) {
759
+ final int autofillId = autofillConfiguration .keyAt (i );
760
+ final TextInputChannel .Configuration config = autofillConfiguration .valueAt (i );
761
761
final TextInputChannel .Configuration .Autofill autofill = config .autofill ;
762
762
if (autofill == null ) {
763
763
continue ;
@@ -801,16 +801,16 @@ public void autofill(@NonNull SparseArray<AutofillValue> values) {
801
801
return ;
802
802
}
803
803
804
- final TextInputChannel .Configuration .Autofill currentAutofill = configuration .autofill ;
805
- if (currentAutofill == null ) {
804
+ if (configuration == null || autofillConfiguration == null || configuration .autofill == null ) {
806
805
return ;
807
806
}
808
807
808
+ final TextInputChannel .Configuration .Autofill currentAutofill = configuration .autofill ;
809
809
final HashMap <String , TextInputChannel .TextEditState > editingValues = new HashMap <>();
810
810
for (int i = 0 ; i < values .size (); i ++) {
811
811
int virtualId = values .keyAt (i );
812
812
813
- final TextInputChannel .Configuration config = mAutofillConfigurations .get (virtualId );
813
+ final TextInputChannel .Configuration config = autofillConfiguration .get (virtualId );
814
814
if (config == null || config .autofill == null ) {
815
815
continue ;
816
816
}
0 commit comments