summaryrefslogtreecommitdiff
path: root/com/android/server/autofill/Session.java
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2017-10-19 09:30:56 -0400
committerJason Monk <jmonk@google.com>2017-10-19 09:30:56 -0400
commitd439404c9988df6001e4ff8bce31537e2692660e (patch)
treeb1462a7177b8a2791140964761eb49d173cdc878 /com/android/server/autofill/Session.java
parent93b7ee4fce01df52a6607f0b1965cbafdfeaf1a6 (diff)
downloadandroid-28-d439404c9988df6001e4ff8bce31537e2692660e.tar.gz
Import Android SDK Platform P [4402356]
/google/data/ro/projects/android/fetch_artifact \ --bid 4386628 \ --target sdk_phone_armv7-win_sdk \ sdk-repo-linux-sources-4402356.zip AndroidVersion.ApiLevel has been modified to appear as 28 Change-Id: Ie49e24e1f4ae9dc96306111e953d3db1e1495b53
Diffstat (limited to 'com/android/server/autofill/Session.java')
-rw-r--r--com/android/server/autofill/Session.java43
1 files changed, 33 insertions, 10 deletions
diff --git a/com/android/server/autofill/Session.java b/com/android/server/autofill/Session.java
index ed00ffed..3c12d670 100644
--- a/com/android/server/autofill/Session.java
+++ b/com/android/server/autofill/Session.java
@@ -495,7 +495,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
notifyUnavailableToClient(false);
}
synchronized (mLock) {
- processResponseLocked(response, requestFlags);
+ processResponseLocked(response, null, requestFlags);
}
final LogMaker log = newLogMaker(MetricsEvent.AUTOFILL_REQUEST, servicePackageName)
@@ -762,13 +762,21 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
}
final Parcelable result = data.getParcelable(AutofillManager.EXTRA_AUTHENTICATION_RESULT);
- if (sDebug) Slog.d(TAG, "setAuthenticationResultLocked(): result=" + result);
+ final Bundle newClientState = data.getBundle(AutofillManager.EXTRA_CLIENT_STATE);
+ if (sDebug) {
+ Slog.d(TAG, "setAuthenticationResultLocked(): result=" + result
+ + ", clientState=" + newClientState);
+ }
if (result instanceof FillResponse) {
writeLog(MetricsEvent.AUTOFILL_AUTHENTICATED);
- replaceResponseLocked(authenticatedResponse, (FillResponse) result);
+ replaceResponseLocked(authenticatedResponse, (FillResponse) result, newClientState);
} else if (result instanceof Dataset) {
if (datasetIdx != AutofillManager.AUTHENTICATION_ID_DATASET_ID_UNDEFINED) {
writeLog(MetricsEvent.AUTOFILL_DATASET_AUTHENTICATED);
+ if (newClientState != null) {
+ if (sDebug) Slog.d(TAG, "Updating client state from auth dataset");
+ mClientState = newClientState;
+ }
final Dataset dataset = (Dataset) result;
authenticatedResponse.getDatasets().set(datasetIdx, dataset);
autoFill(requestId, datasetIdx, dataset, false);
@@ -1491,8 +1499,14 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
ArraySet<AutofillId> trackedViews = null;
boolean saveOnAllViewsInvisible = false;
+ boolean saveOnFinish = true;
final SaveInfo saveInfo = response.getSaveInfo();
+ final AutofillId saveTriggerId;
if (saveInfo != null) {
+ saveTriggerId = saveInfo.getTriggerId();
+ if (saveTriggerId != null) {
+ writeLog(MetricsEvent.AUTOFILL_EXPLICIT_SAVE_TRIGGER_DEFINITION);
+ }
saveOnAllViewsInvisible =
(saveInfo.getFlags() & SaveInfo.FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE) != 0;
@@ -1509,6 +1523,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
Collections.addAll(trackedViews, saveInfo.getOptionalIds());
}
}
+ if ((saveInfo.getFlags() & SaveInfo.FLAG_DONT_SAVE_ON_FINISH) != 0) {
+ saveOnFinish = false;
+ }
+
+ } else {
+ saveTriggerId = null;
}
// Must also track that are part of datasets, otherwise the FillUI won't be hidden when
@@ -1533,17 +1553,18 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
try {
if (sVerbose) {
- Slog.v(TAG, "updateTrackedIdsLocked(): " + trackedViews + " => " + fillableIds);
+ Slog.v(TAG, "updateTrackedIdsLocked(): " + trackedViews + " => " + fillableIds
+ + " (triggering on " + saveTriggerId + ")");
}
mClient.setTrackedViews(id, toArray(trackedViews), saveOnAllViewsInvisible,
- toArray(fillableIds));
+ saveOnFinish, toArray(fillableIds), saveTriggerId);
} catch (RemoteException e) {
Slog.w(TAG, "Cannot set tracked ids", e);
}
}
private void replaceResponseLocked(@NonNull FillResponse oldResponse,
- @NonNull FillResponse newResponse) {
+ @NonNull FillResponse newResponse, @Nullable Bundle newClientState) {
// Disassociate view states with the old response
setViewStatesLocked(oldResponse, ViewState.STATE_INITIAL, true);
// Move over the id
@@ -1551,7 +1572,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
// Replace the old response
mResponses.put(newResponse.getRequestId(), newResponse);
// Now process the new response
- processResponseLocked(newResponse, 0);
+ processResponseLocked(newResponse, newClientState, 0);
}
private void processNullResponseLocked(int flags) {
@@ -1565,7 +1586,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
removeSelf();
}
- private void processResponseLocked(@NonNull FillResponse newResponse, int flags) {
+ private void processResponseLocked(@NonNull FillResponse newResponse,
+ @Nullable Bundle newClientState, int flags) {
// Make sure we are hiding the UI which will be shown
// only if handling the current response requires it.
mUi.hideAll(this);
@@ -1573,14 +1595,15 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
final int requestId = newResponse.getRequestId();
if (sVerbose) {
Slog.v(TAG, "processResponseLocked(): mCurrentViewId=" + mCurrentViewId
- + ",flags=" + flags + ", reqId=" + requestId + ", resp=" + newResponse);
+ + ",flags=" + flags + ", reqId=" + requestId + ", resp=" + newResponse
+ + ",newClientState=" + newClientState);
}
if (mResponses == null) {
mResponses = new SparseArray<>(4);
}
mResponses.put(requestId, newResponse);
- mClientState = newResponse.getClientState();
+ mClientState = newClientState != null ? newClientState : newResponse.getClientState();
setViewStatesLocked(newResponse, ViewState.STATE_FILLABLE, false);
updateTrackedIdsLocked();