Fixed missing auto-fill save callbacks on TextView.

It was accidentally broken during a previous commit where the CTS test
failure was ignored by a known issue being fixed in another change -
this change fixes both problems.

Bug: 33550221
Bug: 3380254
Test: CtsAutoFillServiceTestCases pass (for real now :-)
Change-Id: I5b2aa6060995ca255e51d85aa6ec93a886fa522f
This commit is contained in:
Felipe Leme
2017-02-22 11:54:29 -08:00
parent 5882c4f5d2
commit 0257c8a5d2
3 changed files with 16 additions and 7 deletions

View File

@@ -5220,6 +5220,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (needEditableForNotification) {
sendAfterTextChanged((Editable) text);
} else {
// Always notify AutoFillManager - it will return right away if auto-fill is disabled.
notifyAutoFillManagerAfterTextChanged();
}
// SelectionModifierCursorController depends on textCanBeSelected, which depends on text
@@ -9112,15 +9115,19 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
// Always notify AutoFillManager - it will return right away if auto-fill is disabled.
notifyAutoFillManagerAfterTextChanged();
hideErrorIfUnchanged();
}
private void notifyAutoFillManagerAfterTextChanged() {
final AutoFillManager afm = mContext.getSystemService(AutoFillManager.class);
if (afm != null) {
if (DEBUG_AUTOFILL) {
Log.v(LOG_TAG, "sendAfterTextChanged(): notify AFM for text=" + text);
Log.v(LOG_TAG, "sendAfterTextChanged(): notify AFM for text=" + mText);
}
afm.valueChanged(TextView.this);
}
hideErrorIfUnchanged();
}
void updateAfterEdit() {

View File

@@ -726,7 +726,7 @@ final class AutoFillManagerServiceImpl {
Slog.d(TAG, "finishSessionLocked(): found a change on " + id + ": "
+ state.mAutoFillValue);
}
mUi.showSaveUi();
getUiForShowing().showSaveUi();
return;
}
}

View File

@@ -75,9 +75,11 @@ final class AutoFillUI {
void setCallbackLocked(AutoFillUiCallback callback, IBinder activityToken) {
mHandler.post(() -> {
hideAllUiThread();
mCallback = callback;
mActivityToken = activityToken;
if (callback != mCallback && activityToken != mActivityToken) {
hideAllUiThread();
mCallback = callback;
mActivityToken = activityToken;
}
});
}