Don't add FillEventHistory events to the wrong session.
The AutofillSession.getFillEventHistory() method returns only the event history for the last onFillRequest(). In the scenario where the user switches activities and the server has multiple sessions open, only the events for the last session should be recorded. Test: existing CtsAutoFillServiceTestCases pass Test: LoginActivityTest.checkFillSelectionFromPreviousSessionIsDiscarded Fixes: 62802026 Change-Id: I447ed77c2167095867b35d616b5cf2ae43aa28db
This commit is contained in:
@@ -54,6 +54,11 @@ public final class FillEventHistory implements Parcelable {
|
||||
*/
|
||||
private final int mServiceUid;
|
||||
|
||||
/**
|
||||
* Not in parcel. The ID of the autofill session that created the {@link FillResponse}.
|
||||
*/
|
||||
private final int mSessionId;
|
||||
|
||||
@Nullable private final Bundle mClientState;
|
||||
@Nullable List<Event> mEvents;
|
||||
|
||||
@@ -68,6 +73,11 @@ public final class FillEventHistory implements Parcelable {
|
||||
return mServiceUid;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public int getSessionId() {
|
||||
return mSessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the client state set in the previous {@link FillResponse}.
|
||||
*
|
||||
@@ -102,9 +112,10 @@ public final class FillEventHistory implements Parcelable {
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public FillEventHistory(int serviceUid, @Nullable Bundle clientState) {
|
||||
public FillEventHistory(int serviceUid, int sessionId, @Nullable Bundle clientState) {
|
||||
mClientState = clientState;
|
||||
mServiceUid = serviceUid;
|
||||
mSessionId = sessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -205,7 +216,7 @@ public final class FillEventHistory implements Parcelable {
|
||||
new Parcelable.Creator<FillEventHistory>() {
|
||||
@Override
|
||||
public FillEventHistory createFromParcel(Parcel parcel) {
|
||||
FillEventHistory selection = new FillEventHistory(0, parcel.readBundle());
|
||||
FillEventHistory selection = new FillEventHistory(0, 0, parcel.readBundle());
|
||||
|
||||
int numEvents = parcel.readInt();
|
||||
for (int i = 0; i < numEvents; i++) {
|
||||
|
||||
Reference in New Issue
Block a user