diff options
| author | Felipe Leme <felipeal@google.com> | 2017-08-29 16:19:28 -0700 |
|---|---|---|
| committer | Felipe Leme <felipeal@google.com> | 2017-08-29 17:48:00 -0700 |
| commit | 1c501ebfec42eed5abefdb3b21b45f2f253f7a64 (patch) | |
| tree | 247272b05808b505f8061ff1f5ce15e52ebbbf5b /core/java | |
| parent | 75d4dc333a1a4a89e3cd9bf8623c92033b0586e7 (diff) | |
Added getClientState() to FillEvent; deprecated it on FillEventHistory.
Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases
Fixes: 62830277
Change-Id: Ib99a342c931f4fd44fc8aced1faef0b75588f63d
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/service/autofill/FillEventHistory.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/core/java/android/service/autofill/FillEventHistory.java b/core/java/android/service/autofill/FillEventHistory.java index f7dc1c58ade1..60c1c9a7e87a 100644 --- a/core/java/android/service/autofill/FillEventHistory.java +++ b/core/java/android/service/autofill/FillEventHistory.java @@ -81,10 +81,13 @@ public final class FillEventHistory implements Parcelable { /** * Returns the client state set in the previous {@link FillResponse}. * - * <p><b>NOTE: </b>the state is associated with the app that was autofilled in the previous + * <p><b>Note: </b>the state is associated with the app that was autofilled in the previous * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, FillCallback)} * , which is not necessary the same app being autofilled now. + * + * @deprecated use {@link #getEvents()} then {@link Event#getClientState()} instead. */ + @Deprecated @Nullable public Bundle getClientState() { return mClientState; } @@ -126,7 +129,6 @@ public final class FillEventHistory implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeBundle(mClientState); - if (mEvents == null) { dest.writeInt(0); } else { @@ -137,6 +139,7 @@ public final class FillEventHistory implements Parcelable { Event event = mEvents.get(i); dest.writeInt(event.getType()); dest.writeString(event.getDatasetId()); + dest.writeBundle(event.getClientState()); } } } @@ -177,6 +180,7 @@ public final class FillEventHistory implements Parcelable { @EventIds private final int mEventType; @Nullable private final String mDatasetId; + @Nullable private final Bundle mClientState; /** * Returns the type of the event. @@ -197,18 +201,32 @@ public final class FillEventHistory implements Parcelable { } /** + * Returns the client state from the {@link FillResponse} used to generate this event. + * + * <p><b>Note: </b>the state is associated with the app that was autofilled in the previous + * {@link + * AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, FillCallback)}, + * which is not necessary the same app being autofilled now. + */ + @Nullable public Bundle getClientState() { + return mClientState; + } + + /** * Creates a new event. * * @param eventType The type of the event * @param datasetId The dataset the event was on, or {@code null} if the event was on the * whole response. + * @param clientState The client state associated with the event. * * @hide */ - public Event(int eventType, String datasetId) { + public Event(int eventType, @Nullable String datasetId, @Nullable Bundle clientState) { mEventType = Preconditions.checkArgumentInRange(eventType, 0, TYPE_SAVE_SHOWN, "eventType"); mDatasetId = datasetId; + mClientState = clientState; } } @@ -220,7 +238,8 @@ public final class FillEventHistory implements Parcelable { int numEvents = parcel.readInt(); for (int i = 0; i < numEvents; i++) { - selection.addEvent(new Event(parcel.readInt(), parcel.readString())); + selection.addEvent(new Event(parcel.readInt(), parcel.readString(), + parcel.readBundle())); } return selection; |
