1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.health.connect.aidl; 18 19 import android.annotation.NonNull; 20 import android.health.connect.HealthConnectManager; 21 import android.os.Parcel; 22 import android.os.Parcelable; 23 24 /** 25 * A parcel to carry response to {@link HealthConnectManager#readRecords} 26 * 27 * @hide 28 */ 29 public class ReadRecordsResponseParcel implements Parcelable { 30 /** RecordsParcel read from {@link HealthConnectManager#readRecords} */ 31 private final RecordsParcel mRecordsParcel; 32 33 /** page token to be used as a token for the next read request */ 34 private final long mPageToken; 35 ReadRecordsResponseParcel(@onNull RecordsParcel recordsParcel, long pageToken)36 public ReadRecordsResponseParcel(@NonNull RecordsParcel recordsParcel, long pageToken) { 37 mRecordsParcel = recordsParcel; 38 mPageToken = pageToken; 39 } 40 ReadRecordsResponseParcel(Parcel in)41 protected ReadRecordsResponseParcel(Parcel in) { 42 mRecordsParcel = 43 in.readParcelable(RecordsParcel.class.getClassLoader(), RecordsParcel.class); 44 mPageToken = in.readLong(); 45 } 46 47 @NonNull getRecordsParcel()48 public RecordsParcel getRecordsParcel() { 49 return mRecordsParcel; 50 } 51 getPageToken()52 public long getPageToken() { 53 return mPageToken; 54 } 55 56 public static final Creator<ReadRecordsResponseParcel> CREATOR = 57 new Creator<ReadRecordsResponseParcel>() { 58 @Override 59 public ReadRecordsResponseParcel createFromParcel(Parcel in) { 60 return new ReadRecordsResponseParcel(in); 61 } 62 63 @Override 64 public ReadRecordsResponseParcel[] newArray(int size) { 65 return new ReadRecordsResponseParcel[size]; 66 } 67 }; 68 69 @Override describeContents()70 public int describeContents() { 71 return 0; 72 } 73 74 @Override writeToParcel(@onNull Parcel dest, int flags)75 public void writeToParcel(@NonNull Parcel dest, int flags) { 76 dest.writeParcelable(mRecordsParcel, 0); 77 dest.writeLong(mPageToken); 78 } 79 } 80