diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-10-12 21:02:56 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-10-12 21:02:56 +0000 |
| commit | 714be0178c763aaefde393459a1665d3ddae2e5e (patch) | |
| tree | 47e1fd471a7f966061bfc360488b4692e6a48bbb /core/java/android | |
| parent | fadda8f399b76bfb0d259654fef217315ba6708e (diff) | |
| parent | a937238eaeac6c3577af0c14ceca822890cc979b (diff) | |
Merge "Let service set the SaveRequest.getClientState() on dataset auth responses."
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/service/autofill/SaveRequest.java | 12 | ||||
| -rw-r--r-- | core/java/android/view/autofill/AutofillManager.java | 10 |
2 files changed, 18 insertions, 4 deletions
diff --git a/core/java/android/service/autofill/SaveRequest.java b/core/java/android/service/autofill/SaveRequest.java index 65fdb5c45938..f53967bde773 100644 --- a/core/java/android/service/autofill/SaveRequest.java +++ b/core/java/android/service/autofill/SaveRequest.java @@ -19,7 +19,6 @@ package android.service.autofill; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Bundle; -import android.os.CancellationSignal; import android.os.Parcel; import android.os.Parcelable; @@ -60,9 +59,14 @@ public final class SaveRequest implements Parcelable { } /** - * Gets the extra client state returned from the last {@link - * AutofillService#onFillRequest(FillRequest, CancellationSignal, FillCallback)} - * fill request}. + * Gets the latest client state extra returned from the service. + * + * <p><b>Note:</b> Prior to Android {@link android.os.Build.VERSION_CODES#P}, only client state + * bundles set by {@link FillResponse.Builder#setClientState(Bundle)} where considered. On + * Android {@link android.os.Build.VERSION_CODES#P} and higher, bundles set in the result of + * an authenticated request through the + * {@link android.view.autofill.AutofillManager#EXTRA_CLIENT_STATE} extra are + * also considered (and take precedence when set). * * @return The client state. */ diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index 4fb2a99af575..e2022de80abe 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -150,6 +150,12 @@ public final class AutofillManager { * service authentication will contain the Bundle set by * {@link android.service.autofill.FillResponse.Builder#setClientState(Bundle)} on this extra. * + * <p>On Android {@link android.os.Build.VERSION_CODES#P} and higher, the autofill service + * can also add this bundle to the {@link Intent} set as the + * {@link android.app.Activity#setResult(int, Intent) result} for an authentication request, + * so the bundle can be recovered later on + * {@link android.service.autofill.SaveRequest#getClientState()}. + * * <p> * Type: {@link android.os.Bundle} */ @@ -959,6 +965,10 @@ public final class AutofillManager { final Parcelable result = data.getParcelableExtra(EXTRA_AUTHENTICATION_RESULT); final Bundle responseData = new Bundle(); responseData.putParcelable(EXTRA_AUTHENTICATION_RESULT, result); + final Bundle newClientState = data.getBundleExtra(EXTRA_CLIENT_STATE); + if (newClientState != null) { + responseData.putBundle(EXTRA_CLIENT_STATE, newClientState); + } try { mService.setAuthenticationResult(responseData, mSessionId, authenticationId, mContext.getUserId()); |
