• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.changelog;
18 
19 import android.annotation.NonNull;
20 import android.health.connect.HealthConnectManager;
21 import android.os.Parcel;
22 import android.os.Parcelable;
23 
24 import java.util.Objects;
25 
26 /**
27  * Response class for {@link HealthConnectManager#getChangeLogToken}}
28  *
29  * @see HealthConnectManager#getChangeLogToken
30  */
31 public final class ChangeLogTokenResponse implements Parcelable {
32     private final String mToken;
33 
34     /**
35      * Response for {@link HealthConnectManager#getChangeLogToken}
36      *
37      * @hide
38      */
ChangeLogTokenResponse(@onNull String token)39     public ChangeLogTokenResponse(@NonNull String token) {
40         Objects.requireNonNull(token);
41 
42         mToken = token;
43     }
44 
ChangeLogTokenResponse(Parcel in)45     private ChangeLogTokenResponse(Parcel in) {
46         mToken = in.readString();
47     }
48 
49     @NonNull
50     public static final Parcelable.Creator<ChangeLogTokenResponse> CREATOR =
51             new Parcelable.Creator<>() {
52                 @Override
53                 public ChangeLogTokenResponse createFromParcel(Parcel in) {
54                     return new ChangeLogTokenResponse(in);
55                 }
56 
57                 @Override
58                 public ChangeLogTokenResponse[] newArray(int size) {
59                     return new ChangeLogTokenResponse[size];
60                 }
61             };
62 
63     /** Returns the token for the change logs request */
64     @NonNull
getToken()65     public String getToken() {
66         return mToken;
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.writeString(mToken);
77     }
78 }
79