Loading core/java/android/widget/CompoundButton.java +6 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.view.ViewDebug; import android.view.ViewHierarchyEncoder; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.autofill.AutoFillManager; import android.view.autofill.AutoFillType; import android.view.autofill.AutoFillValue; Loading Loading @@ -164,6 +165,10 @@ public abstract class CompoundButton extends Button implements Checkable { if (mOnCheckedChangeWidgetListener != null) { mOnCheckedChangeWidgetListener.onCheckedChanged(this, mChecked); } final AutoFillManager afm = mContext.getSystemService(AutoFillManager.class); if (afm != null) { afm.valueChanged(this); } mBroadcasting = false; } Loading Loading @@ -563,8 +568,6 @@ public abstract class CompoundButton extends Button implements Checkable { // TODO(b/33197203): add unit/CTS tests for auto-fill methods (and make sure they handle enable) // TODO(b/33197203): override onProvideAutoFillStructure and add a change listener @Override public void autoFill(AutoFillValue value) { if (!isEnabled()) return; Loading @@ -579,6 +582,6 @@ public abstract class CompoundButton extends Button implements Checkable { @Override public AutoFillValue getAutoFillValue() { return isEnabled() ? null : AutoFillValue.forToggle(isChecked()); return isEnabled() ? AutoFillValue.forToggle(isChecked()) : null; } } core/java/android/widget/RadioGroup.java +5 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.autofill.AutoFillManager; import android.view.autofill.AutoFillType; import android.view.autofill.AutoFillValue; Loading Loading @@ -177,6 +178,10 @@ public class RadioGroup extends LinearLayout { if (mOnCheckedChangeListener != null) { mOnCheckedChangeListener.onCheckedChanged(this, mCheckedId); } final AutoFillManager afm = mContext.getSystemService(AutoFillManager.class); if (afm != null) { afm.valueChanged(this); } } private void setCheckedStateForView(int viewId, boolean checked) { Loading Loading @@ -405,8 +410,6 @@ public class RadioGroup extends LinearLayout { // TODO(b/33197203): add unit/CTS tests for auto-fill methods (and make sure they handle enable) // TODO(b/33197203): override onProvideAutoFillStructure and add a change listener @Override public void autoFill(AutoFillValue value) { if (!isEnabled()) return; Loading core/java/android/widget/TextView.java +10 −32 Original line number Diff line number Diff line Loading @@ -726,9 +726,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // mAutoSizeStepGranularityInPx. private boolean mHasPresetAutoSizeValues = false; // Watcher used to notify changes to auto-fill manager. private AutoFillChangeWatcher mAutoFillChangeWatcher; // Indicates whether the text was set from resources or dynamically, so it can be used to // sanitize auto-fill request. private boolean mTextFromResource = false; Loading Loading @@ -9112,6 +9109,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener list.get(i).afterTextChanged(text); } } // Always notify AutoFillManager - it will return right away if auto-fill is disabled. final AutoFillManager afm = mContext.getSystemService(AutoFillManager.class); if (afm != null) { if (DEBUG_AUTOFILL) { Log.v(LOG_TAG, "sendAfterTextChanged(): notify AFM for text=" + text); } afm.valueChanged(TextView.this); } hideErrorIfUnchanged(); } Loading Loading @@ -9876,11 +9883,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener || isPasswordInputType(getInputType()); if (forAutoFill) { structure.setSanitized(mTextFromResource); if (mAutoFillChangeWatcher == null && isTextEditable()) { mAutoFillChangeWatcher = new AutoFillChangeWatcher(); addTextChangedListener(mAutoFillChangeWatcher); // TODO(b/33197203): remove mAutoFillValueListener auto-fill session is finished } } if (!isPassword || forAutoFill) { Loading Loading @@ -11507,30 +11509,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } } // TODO(b/33197203): implements SpanWatcher too? private final class AutoFillChangeWatcher implements TextWatcher { private final AutoFillManager mAfm = mContext.getSystemService(AutoFillManager.class); @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (mAfm != null) { if (DEBUG_AUTOFILL) { Log.v(LOG_TAG, "AutoFillChangeWatcher.afterTextChanged(): s=" + s); } mAfm.valueChanged(TextView.this); } } } private class ChangeWatcher implements TextWatcher, SpanWatcher { private CharSequence mBeforeText; Loading services/autofill/java/com/android/server/autofill/AutoFillManagerServiceImpl.java +17 −16 Original line number Diff line number Diff line Loading @@ -792,8 +792,8 @@ final class AutoFillManagerServiceImpl { return; } if ((flags & FLAG_VALUE_CHANGED) != 0 && value != null && !value.equals(viewState.mAutoFillValue)) { if ((flags & FLAG_VALUE_CHANGED) != 0) { if (value != null && !value.equals(viewState.mAutoFillValue)) { viewState.mValueUpdated = true; // Must check if this update was caused by auto-filling the view, in which Loading @@ -811,6 +811,7 @@ final class AutoFillManagerServiceImpl { // Update the chooser UI mUi.updateFillUi(value.coerceToString()); } return; } Loading Loading
core/java/android/widget/CompoundButton.java +6 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.view.ViewDebug; import android.view.ViewHierarchyEncoder; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.autofill.AutoFillManager; import android.view.autofill.AutoFillType; import android.view.autofill.AutoFillValue; Loading Loading @@ -164,6 +165,10 @@ public abstract class CompoundButton extends Button implements Checkable { if (mOnCheckedChangeWidgetListener != null) { mOnCheckedChangeWidgetListener.onCheckedChanged(this, mChecked); } final AutoFillManager afm = mContext.getSystemService(AutoFillManager.class); if (afm != null) { afm.valueChanged(this); } mBroadcasting = false; } Loading Loading @@ -563,8 +568,6 @@ public abstract class CompoundButton extends Button implements Checkable { // TODO(b/33197203): add unit/CTS tests for auto-fill methods (and make sure they handle enable) // TODO(b/33197203): override onProvideAutoFillStructure and add a change listener @Override public void autoFill(AutoFillValue value) { if (!isEnabled()) return; Loading @@ -579,6 +582,6 @@ public abstract class CompoundButton extends Button implements Checkable { @Override public AutoFillValue getAutoFillValue() { return isEnabled() ? null : AutoFillValue.forToggle(isChecked()); return isEnabled() ? AutoFillValue.forToggle(isChecked()) : null; } }
core/java/android/widget/RadioGroup.java +5 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.autofill.AutoFillManager; import android.view.autofill.AutoFillType; import android.view.autofill.AutoFillValue; Loading Loading @@ -177,6 +178,10 @@ public class RadioGroup extends LinearLayout { if (mOnCheckedChangeListener != null) { mOnCheckedChangeListener.onCheckedChanged(this, mCheckedId); } final AutoFillManager afm = mContext.getSystemService(AutoFillManager.class); if (afm != null) { afm.valueChanged(this); } } private void setCheckedStateForView(int viewId, boolean checked) { Loading Loading @@ -405,8 +410,6 @@ public class RadioGroup extends LinearLayout { // TODO(b/33197203): add unit/CTS tests for auto-fill methods (and make sure they handle enable) // TODO(b/33197203): override onProvideAutoFillStructure and add a change listener @Override public void autoFill(AutoFillValue value) { if (!isEnabled()) return; Loading
core/java/android/widget/TextView.java +10 −32 Original line number Diff line number Diff line Loading @@ -726,9 +726,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // mAutoSizeStepGranularityInPx. private boolean mHasPresetAutoSizeValues = false; // Watcher used to notify changes to auto-fill manager. private AutoFillChangeWatcher mAutoFillChangeWatcher; // Indicates whether the text was set from resources or dynamically, so it can be used to // sanitize auto-fill request. private boolean mTextFromResource = false; Loading Loading @@ -9112,6 +9109,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener list.get(i).afterTextChanged(text); } } // Always notify AutoFillManager - it will return right away if auto-fill is disabled. final AutoFillManager afm = mContext.getSystemService(AutoFillManager.class); if (afm != null) { if (DEBUG_AUTOFILL) { Log.v(LOG_TAG, "sendAfterTextChanged(): notify AFM for text=" + text); } afm.valueChanged(TextView.this); } hideErrorIfUnchanged(); } Loading Loading @@ -9876,11 +9883,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener || isPasswordInputType(getInputType()); if (forAutoFill) { structure.setSanitized(mTextFromResource); if (mAutoFillChangeWatcher == null && isTextEditable()) { mAutoFillChangeWatcher = new AutoFillChangeWatcher(); addTextChangedListener(mAutoFillChangeWatcher); // TODO(b/33197203): remove mAutoFillValueListener auto-fill session is finished } } if (!isPassword || forAutoFill) { Loading Loading @@ -11507,30 +11509,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } } // TODO(b/33197203): implements SpanWatcher too? private final class AutoFillChangeWatcher implements TextWatcher { private final AutoFillManager mAfm = mContext.getSystemService(AutoFillManager.class); @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (mAfm != null) { if (DEBUG_AUTOFILL) { Log.v(LOG_TAG, "AutoFillChangeWatcher.afterTextChanged(): s=" + s); } mAfm.valueChanged(TextView.this); } } } private class ChangeWatcher implements TextWatcher, SpanWatcher { private CharSequence mBeforeText; Loading
services/autofill/java/com/android/server/autofill/AutoFillManagerServiceImpl.java +17 −16 Original line number Diff line number Diff line Loading @@ -792,8 +792,8 @@ final class AutoFillManagerServiceImpl { return; } if ((flags & FLAG_VALUE_CHANGED) != 0 && value != null && !value.equals(viewState.mAutoFillValue)) { if ((flags & FLAG_VALUE_CHANGED) != 0) { if (value != null && !value.equals(viewState.mAutoFillValue)) { viewState.mValueUpdated = true; // Must check if this update was caused by auto-filling the view, in which Loading @@ -811,6 +811,7 @@ final class AutoFillManagerServiceImpl { // Update the chooser UI mUi.updateFillUi(value.coerceToString()); } return; } Loading