diff options
author | Justin Klaassen <justinklaassen@google.com> | 2017-11-30 18:18:21 -0500 |
---|---|---|
committer | Justin Klaassen <justinklaassen@google.com> | 2017-11-30 18:18:21 -0500 |
commit | 4217cf85c20565a3446a662a7f07f26137b26b7f (patch) | |
tree | a0417b47a8cc802f6642f369fd2371165bec7b5c /com/android/server/autofill/Session.java | |
parent | 6a65f2da209bff03cb0eb6da309710ac6ee5026d (diff) | |
download | android-28-4217cf85c20565a3446a662a7f07f26137b26b7f.tar.gz |
Import Android SDK Platform P [4477446]
/google/data/ro/projects/android/fetch_artifact \
--bid 4477446 \
--target sdk_phone_armv7-win_sdk \
sdk-repo-linux-sources-4477446.zip
AndroidVersion.ApiLevel has been modified to appear as 28
Change-Id: If0559643d7c328e36aafca98f0c114641d33642c
Diffstat (limited to 'com/android/server/autofill/Session.java')
-rw-r--r-- | com/android/server/autofill/Session.java | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/com/android/server/autofill/Session.java b/com/android/server/autofill/Session.java index af4668a6..99b92b9c 100644 --- a/com/android/server/autofill/Session.java +++ b/com/android/server/autofill/Session.java @@ -561,7 +561,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // FillServiceCallbacks @Override - public void onSaveRequestSuccess(@NonNull String servicePackageName) { + public void onSaveRequestSuccess(@NonNull String servicePackageName, + @Nullable IntentSender intentSender) { synchronized (mLock) { mIsSaving = false; @@ -572,8 +573,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } } LogMaker log = newLogMaker(MetricsEvent.AUTOFILL_DATA_SAVE_REQUEST, servicePackageName) - .setType(MetricsEvent.TYPE_SUCCESS); + .setType(intentSender == null ? MetricsEvent.TYPE_SUCCESS : MetricsEvent.TYPE_OPEN); mMetricsLogger.write(log); + if (intentSender != null) { + if (sDebug) Slog.d(TAG, "Starting intent sender on save()"); + startIntentSender(intentSender); + } // Nothing left to do... removeSelf(); @@ -1167,7 +1172,16 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState break; } } + value = getSanitizedValue(sanitizers, id, value); + if (value == null) { + if (sDebug) { + Slog.d(TAG, "value of required field " + id + " failed sanitization"); + } + allRequiredAreNotEmpty = false; + break; + } + viewState.setSanitizedValue(value); currentValues.put(id, value); final AutofillValue filledValue = viewState.getAutofilledValue(); @@ -1337,7 +1351,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return sanitizers; } - @NonNull + @Nullable private AutofillValue getSanitizedValue( @Nullable ArrayMap<AutofillId, InternalSanitizer> sanitizers, @NonNull AutofillId id, @@ -1431,10 +1445,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (sVerbose) Slog.v(TAG, "callSaveLocked(): updating " + context); for (int viewStateNum = 0; viewStateNum < mViewStates.size(); viewStateNum++) { - final ViewState state = mViewStates.valueAt(viewStateNum); + final ViewState viewState = mViewStates.valueAt(viewStateNum); - final AutofillId id = state.id; - final AutofillValue value = state.getCurrentValue(); + final AutofillId id = viewState.id; + final AutofillValue value = viewState.getCurrentValue(); if (value == null) { if (sVerbose) Slog.v(TAG, "callSaveLocked(): skipping " + id); continue; @@ -1446,9 +1460,17 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } if (sVerbose) Slog.v(TAG, "callSaveLocked(): updating " + id + " to " + value); - final AutofillValue sanitizedValue = getSanitizedValue(sanitizers, id, value); + AutofillValue sanitizedValue = viewState.getSanitizedValue(); - node.updateAutofillValue(sanitizedValue); + if (sanitizedValue == null) { + // Field is optional and haven't been sanitized yet. + sanitizedValue = getSanitizedValue(sanitizers, id, value); + } + if (sanitizedValue != null) { + node.updateAutofillValue(sanitizedValue); + } else if (sDebug) { + Slog.d(TAG, "Not updating field " + id + " because it failed sanitization"); + } } // Sanitize structure before it's sent to service. |