• 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.app.pinner;
18 
19 import static android.app.Flags.FLAG_PINNER_SERVICE_CLIENT_API;
20 
21 import android.annotation.FlaggedApi;
22 import android.annotation.NonNull;
23 import android.annotation.TestApi;
24 import android.os.Parcel;
25 import android.os.Parcelable;
26 
27 /**
28  * @hide
29  */
30 @TestApi
31 @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
32 public final class PinnedFileStat implements Parcelable {
33     private String filename;
34     private long bytesPinned;
35     private String groupName;
36 
37     /**
38      * @hide
39      */
40     @TestApi
41     @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
getBytesPinned()42     public long getBytesPinned() {
43         return bytesPinned;
44     }
45 
46     /**
47      * @hide
48      */
49     @TestApi
50     @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
getFilename()51     public @NonNull String getFilename() {
52         return filename;
53     }
54 
55     /**
56      * @hide
57      */
58     @TestApi
59     @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
getGroupName()60     public @NonNull String getGroupName() {
61         return groupName;
62     }
63 
64     /**
65      * @hide
66      */
67     @TestApi
68     @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
PinnedFileStat(@onNull String filename, long bytesPinned, @NonNull String groupName)69     public PinnedFileStat(@NonNull String filename, long bytesPinned, @NonNull String groupName) {
70         this.filename = filename;
71         this.bytesPinned = bytesPinned;
72         this.groupName = groupName;
73     }
74 
PinnedFileStat(Parcel source)75     private PinnedFileStat(Parcel source) {
76         readFromParcel(source);
77     }
78 
79     /**
80      * @hide
81      */
82     @TestApi
83     @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
84     @Override
writeToParcel(@onNull Parcel dest, int flags)85     public void writeToParcel(@NonNull Parcel dest, int flags) {
86         dest.writeString8(filename);
87         dest.writeLong(bytesPinned);
88         dest.writeString8(groupName);
89     }
90 
readFromParcel(@onNull Parcel source)91     private void readFromParcel(@NonNull Parcel source) {
92         filename = source.readString8();
93         bytesPinned = source.readLong();
94         groupName = source.readString8();
95     }
96 
97     /**
98      * @hide
99      */
100     @TestApi
101     @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
102     @Override
describeContents()103     public int describeContents() {
104         return 0;
105     }
106 
107     /**
108      * @hide
109      */
110     @TestApi
111     @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
112     public static final @NonNull Creator<PinnedFileStat> CREATOR = new Creator<>() {
113         /**
114          * @hide
115          */
116         @TestApi
117         @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
118         @Override
119         public PinnedFileStat createFromParcel(Parcel source) {
120             return new PinnedFileStat(source);
121         }
122 
123         /**
124          * @hide
125          */
126         @TestApi
127         @FlaggedApi(FLAG_PINNER_SERVICE_CLIENT_API)
128         @Override
129         public PinnedFileStat[] newArray(int size) {
130             return new PinnedFileStat[size];
131         }
132     };
133 }
134