1cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann/* 2cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Copyright (C) 2017 The Android Open Source Project 3cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 4cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Licensed under the Apache License, Version 2.0 (the "License"); 5cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * you may not use this file except in compliance with the License. 6cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * You may obtain a copy of the License at 7cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 8cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * http://www.apache.org/licenses/LICENSE-2.0 9cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 10cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Unless required by applicable law or agreed to in writing, software 11cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * distributed under the License is distributed on an "AS IS" BASIS, 12cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * See the License for the specific language governing permissions and 14cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * limitations under the License. 15cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 16cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 17cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannpackage android.service.autofill; 18cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 19cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport android.annotation.IntDef; 20cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport android.annotation.Nullable; 21cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport android.content.IntentSender; 22cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport android.os.Bundle; 23cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport android.os.Parcel; 24cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport android.os.Parcelable; 25cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport android.view.autofill.AutofillId; 26cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport android.widget.RemoteViews; 27cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 28cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport com.android.internal.util.Preconditions; 29cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 30cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport java.lang.annotation.Retention; 31cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport java.lang.annotation.RetentionPolicy; 32cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport java.util.ArrayList; 33cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannimport java.util.List; 34cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 35cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann/** 362e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * Describes what happened after the last 372e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, FillCallback)} 382e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * call. 392e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * 402e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * <p>This history is typically used to keep track of previous user actions to optimize further 412e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * requests. For example, the service might return email addresses in alphabetical order by 422e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * default, but change that order based on the address the user picked on previous requests. 432e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * 442e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * <p>The history is not persisted over reboots, and it's cleared every time the service 452e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * replies to a 462e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, FillCallback)} 472e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * by calling {@link FillCallback#onSuccess(FillResponse)} or 482e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * {@link FillCallback#onFailure(CharSequence)} (if the service doesn't call any of these methods, 492e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * the history will clear out after some pre-defined time). 50cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 51cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmannpublic final class FillEventHistory implements Parcelable { 52cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 53cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Not in parcel. The UID of the {@link AutofillService} that created the {@link FillResponse}. 54cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 55cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann private final int mServiceUid; 56cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 57d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme /** 58d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme * Not in parcel. The ID of the autofill session that created the {@link FillResponse}. 59d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme */ 60d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme private final int mSessionId; 61d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme 62cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Nullable private final Bundle mClientState; 63cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Nullable List<Event> mEvents; 64cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 65cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 66cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Gets the UID of the {@link AutofillService} that created the {@link FillResponse}. 67cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 68cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @return The UID of the {@link AutofillService} 69cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 70cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @hide 71cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 72cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public int getServiceUid() { 73cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann return mServiceUid; 74cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 75cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 76d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme /** @hide */ 77d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme public int getSessionId() { 78d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme return mSessionId; 79d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme } 80d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme 81cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 822e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * Returns the client state set in the previous {@link FillResponse}. 83cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 842e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * <p><b>NOTE: </b>the state is associated with the app that was autofilled in the previous 852e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, FillCallback)} 862e30c6f371be6211f1fa2b2257084df24a535795Felipe Leme * , which is not necessary the same app being autofilled now. 87cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 88cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Nullable public Bundle getClientState() { 89cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann return mClientState; 90cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 91cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 92cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 93cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Returns the events occurred after the latest call to 94cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * {@link FillCallback#onSuccess(FillResponse)}. 95cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 96cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @return The list of events or {@code null} if non occurred. 97cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 98cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Nullable public List<Event> getEvents() { 99cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann return mEvents; 100cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 101cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 102cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 103cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @hide 104cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 105cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public void addEvent(Event event) { 106cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann if (mEvents == null) { 107cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann mEvents = new ArrayList<>(1); 108cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 109cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann mEvents.add(event); 110cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 111cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 112cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 113cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @hide 114cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 115d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme public FillEventHistory(int serviceUid, int sessionId, @Nullable Bundle clientState) { 116cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann mClientState = clientState; 117cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann mServiceUid = serviceUid; 118d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme mSessionId = sessionId; 119cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 120cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 121cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Override 122cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public int describeContents() { 123cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann return 0; 124cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 125cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 126cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Override 127cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public void writeToParcel(Parcel dest, int flags) { 128cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann dest.writeBundle(mClientState); 129cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 130cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann if (mEvents == null) { 131cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann dest.writeInt(0); 132cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } else { 133cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann dest.writeInt(mEvents.size()); 134cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 135cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann int numEvents = mEvents.size(); 136cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann for (int i = 0; i < numEvents; i++) { 137cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann Event event = mEvents.get(i); 138cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann dest.writeInt(event.getType()); 139cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann dest.writeString(event.getDatasetId()); 140cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 141cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 142cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 143cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 144cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 145cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Description of an event that occured after the latest call to 146cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * {@link FillCallback#onSuccess(FillResponse)}. 147cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 148cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public static final class Event { 149cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 150cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * A dataset was selected. The dataset selected can be read from {@link #getDatasetId()}. 151cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 152cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public static final int TYPE_DATASET_SELECTED = 0; 153cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 154cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 155cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * A {@link Dataset.Builder#setAuthentication(IntentSender) dataset authentication} was 156cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * selected. The dataset authenticated can be read from {@link #getDatasetId()}. 157cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 158cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public static final int TYPE_DATASET_AUTHENTICATION_SELECTED = 1; 159cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 160cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 161cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * A {@link FillResponse.Builder#setAuthentication(AutofillId[], IntentSender, RemoteViews) 162cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * fill response authentication} was selected. 163cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 164cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public static final int TYPE_AUTHENTICATION_SELECTED = 2; 165cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 166cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** A save UI was shown. */ 167cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public static final int TYPE_SAVE_SHOWN = 3; 168cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 169cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** @hide */ 170cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @IntDef( 171cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann value = {TYPE_DATASET_SELECTED, 172cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann TYPE_DATASET_AUTHENTICATION_SELECTED, 173cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann TYPE_AUTHENTICATION_SELECTED, 174cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann TYPE_SAVE_SHOWN}) 175cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Retention(RetentionPolicy.SOURCE) 176cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @interface EventIds{} 177cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 178cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @EventIds private final int mEventType; 179cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Nullable private final String mDatasetId; 180cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 181cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 182cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Returns the type of the event. 183cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 184cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @return The type of the event 185cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 186cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public int getType() { 187cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann return mEventType; 188cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 189cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 190cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 191cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Returns the id of dataset the id was on. 192cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 193cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @return The id of dataset, or {@code null} the event is not associated with a dataset. 194cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 195cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Nullable public String getDatasetId() { 196cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann return mDatasetId; 197cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 198cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 199cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann /** 200cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * Creates a new event. 201cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 202cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @param eventType The type of the event 203cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @param datasetId The dataset the event was on, or {@code null} if the event was on the 204cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * whole response. 205cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * 206cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann * @hide 207cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann */ 208cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public Event(int eventType, String datasetId) { 209cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann mEventType = Preconditions.checkArgumentInRange(eventType, 0, TYPE_SAVE_SHOWN, 210cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann "eventType"); 211cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann mDatasetId = datasetId; 212cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 213cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 214cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 215cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public static final Parcelable.Creator<FillEventHistory> CREATOR = 216cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann new Parcelable.Creator<FillEventHistory>() { 217cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Override 218cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public FillEventHistory createFromParcel(Parcel parcel) { 219d013bcea9713d178627cc1d3e8a0f291ccbcd293Felipe Leme FillEventHistory selection = new FillEventHistory(0, 0, parcel.readBundle()); 220cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 221cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann int numEvents = parcel.readInt(); 222cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann for (int i = 0; i < numEvents; i++) { 223cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann selection.addEvent(new Event(parcel.readInt(), parcel.readString())); 224cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 225cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 226cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann return selection; 227cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 228cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann 229cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann @Override 230cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann public FillEventHistory[] newArray(int size) { 231cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann return new FillEventHistory[size]; 232cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann } 233cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann }; 234cc684ed41f17ccdce45a056fd4034efc35b213d5Philip P. Moltmann} 235