Debian Codegraph @

core/java/android/app/usage/ExternalStorageStats.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2017 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.usage;
18
19 import android.annotation.BytesLong;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 import android.os.UserHandle;
23
24 /**
25 * Shared/external storage statistics for a {@link UserHandle} on a single
26 * storage volume.
27 *
28 * @see StorageStatsManager
29 */
30 public final class ExternalStorageStats implements Parcelable {
31 /** {@hide} */ public long totalBytes;
32 /** {@hide} */ public long audioBytes;
33 /** {@hide} */ public long videoBytes;
34 /** {@hide} */ public long imageBytes;
35 /** {@hide} */ public long appBytes;
36 /** {@hide} */ public long obbBytes;
37
38 /**
39 * Return the total bytes used by all files in the shared/external storage
40 * hosted on this volume.
41 * <p>
42 * This value only includes data which is isolated for each user on a
43 * multiuser device. Any OBB data shared between users is not accounted in
44 * this value.
45 */
46 public @BytesLong long getTotalBytes() {
47 return totalBytes;
48 }
49
50 /**
51 * Return the total bytes used by all audio files in the shared/external
52 * storage hosted on this volume.
53 * <p>
54 * This value only includes data which is isolated for each user on a
55 * multiuser device. This value does not include any app files which are all
56 * accounted under {@link #getAppBytes()}.
57 */
58 public @BytesLong long getAudioBytes() {
59 return audioBytes;
60 }
61
62 /**
63 * Return the total bytes used by all video files in the shared/external
64 * storage hosted on this volume.
65 * <p>
66 * This value only includes data which is isolated for each user on a
67 * multiuser device. This value does not include any app files which are all
68 * accounted under {@link #getAppBytes()}.
69 */
70 public @BytesLong long getVideoBytes() {
71 return videoBytes;
72 }
73
74 /**
75 * Return the total bytes used by all image files in the shared/external
76 * storage hosted on this volume.
77 * <p>
78 * This value only includes data which is isolated for each user on a
79 * multiuser device. This value does not include any app files which are all
80 * accounted under {@link #getAppBytes()}.
81 */
82 public @BytesLong long getImageBytes() {
83 return imageBytes;
84 }
85
86 /**
87 * Return the total bytes used by app files in the shared/external storage
88 * hosted on this volume.
89 * <p>
90 * This data is already accounted against individual apps as returned
91 * through {@link StorageStats}.
92 * <p>
93 * This value only includes data which is isolated for each user on a
94 * multiuser device.
95 */
96 public @BytesLong long getAppBytes() {
97 return appBytes;
98 }
99
100 /** {@hide} */
101 public @BytesLong long getObbBytes() {
102 return obbBytes;
103 }
104
105 /** {@hide} */
106 public ExternalStorageStats() {
107 }
108
109 /** {@hide} */
110 public ExternalStorageStats(Parcel in) {
111 this.totalBytes = in.readLong();
112 this.audioBytes = in.readLong();
113 this.videoBytes = in.readLong();
114 this.imageBytes = in.readLong();
115 this.appBytes = in.readLong();
116 this.obbBytes = in.readLong();
117 }
118
119 @Override
120 public int describeContents() {
121 return 0;
122 }
123
124 @Override
125 public void writeToParcel(Parcel dest, int flags) {
126 dest.writeLong(totalBytes);
127 dest.writeLong(audioBytes);
128 dest.writeLong(videoBytes);
129 dest.writeLong(imageBytes);
130 dest.writeLong(appBytes);
131 dest.writeLong(obbBytes);
132 }
133
134 public static final @android.annotation.NonNull Creator<ExternalStorageStats> CREATOR = new Creator<ExternalStorageStats>() {
135 @Override
136 public ExternalStorageStats createFromParcel(Parcel in) {
137 return new ExternalStorageStats(in);
138 }
139
140 @Override
141 public ExternalStorageStats[] newArray(int size) {
142 return new ExternalStorageStats[size];
143 }
144 };
145 }