Debian Codegraph @

core/java/android/os/incremental/IIncrementalService.aidl

raw
1 /*
2 * Copyright (C) 2019 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.os.incremental;
18
19 import android.content.pm.DataLoaderParamsParcel;
20 import android.content.pm.IDataLoaderStatusListener;
21 import android.os.incremental.IncrementalNewFileParams;
22 import android.os.incremental.IStorageLoadingProgressListener;
23 import android.os.incremental.IStorageHealthListener;
24 import android.os.incremental.PerUidReadTimeouts;
25 import android.os.incremental.StorageHealthCheckParams;
26 import android.os.PersistableBundle;
27
28 /** @hide */
29 interface IIncrementalService {
30 /**
31 * A set of flags for the |createMode| parameters when creating a new Incremental storage.
32 */
33 const int CREATE_MODE_TEMPORARY_BIND = 1;
34 const int CREATE_MODE_PERMANENT_BIND = 2;
35 const int CREATE_MODE_CREATE = 4;
36 const int CREATE_MODE_OPEN_EXISTING = 8;
37
38 /**
39 * Opens or creates a storage given a target path and data loader params. Returns the storage ID.
40 */
41 int openStorage(in @utf8InCpp String path);
42 int createStorage(in @utf8InCpp String path, in DataLoaderParamsParcel params, int createMode);
43 int createLinkedStorage(in @utf8InCpp String path, int otherStorageId, int createMode);
44
45 /**
46 * Loops DataLoader through bind/create/start with params.
47 */
48 boolean startLoading(int storageId,
49 in DataLoaderParamsParcel params,
50 in IDataLoaderStatusListener statusListener,
51 in StorageHealthCheckParams healthCheckParams,
52 in IStorageHealthListener healthListener,
53 in PerUidReadTimeouts[] perUidReadTimeouts);
54
55 /**
56 * PM/system is done with this storage, ok to increase timeouts.
57 */
58 void onInstallationComplete(int storageId);
59
60 /**
61 * Bind-mounts a path under a storage to a full path. Can be permanent or temporary.
62 */
63 const int BIND_TEMPORARY = 0;
64 const int BIND_PERMANENT = 1;
65 int makeBindMount(int storageId, in @utf8InCpp String sourcePath, in @utf8InCpp String targetFullPath, int bindType);
66
67 /**
68 * Deletes an existing bind mount on a path under a storage. Returns 0 on success, and -errno on failure.
69 */
70 int deleteBindMount(int storageId, in @utf8InCpp String targetFullPath);
71
72 /**
73 * Creates a directory under a storage. The target directory is specified by its path.
74 */
75 int makeDirectory(int storageId, in @utf8InCpp String path);
76
77 /**
78 * Recursively creates a directory under a storage. The target directory is specified by its path.
79 * All the parent directories of the target directory will be created if they do not exist already.
80 */
81 int makeDirectories(int storageId, in @utf8InCpp String path);
82
83 /**
84 * Creates a file under a storage.
85 */
86 int makeFile(int storageId, in @utf8InCpp String path, in IncrementalNewFileParams params, in @nullable byte[] content);
87
88 /**
89 * Creates a file under a storage. Content of the file is from a range inside another file.
90 * Both files are specified by their paths.
91 */
92 int makeFileFromRange(int storageId, in @utf8InCpp String targetPath, in @utf8InCpp String sourcePath, long start, long end);
93
94 /**
95 * Creates a hard link between two files in two storage instances.
96 * Source and dest specified by parent storage IDs and their paths.
97 * The source and dest storage instances should be in the same fs mount.
98 * Note: destStorageId can be the same as sourceStorageId.
99 */
100 int makeLink(int sourceStorageId, in @utf8InCpp String sourcePath, int destStorageId, in @utf8InCpp String destPath);
101
102 /**
103 * Deletes a hard link in a storage, specified by its path.
104 */
105 int unlink(int storageId, in @utf8InCpp String path);
106
107 /**
108 * Checks if a file is fully loaded. File is specified by its path.
109 * 0 - fully loaded
110 * >0 - certain pages missing
111 * <0 - -errcode
112 */
113 int isFileFullyLoaded(int storageId, in @utf8InCpp String path);
114
115 /**
116 * Checks if all files in the storage are fully loaded.
117 * 0 - fully loaded
118 * >0 - certain pages missing
119 * <0 - -errcode
120 */
121 int isFullyLoaded(int storageId);
122
123 /**
124 * Returns overall loading progress of all the files on a storage, progress value between [0,1].
125 * Returns a negative value on error.
126 */
127 float getLoadingProgress(int storageId);
128
129 /**
130 * Reads the metadata of a file. File is specified by either its path or 16 byte id.
131 */
132 byte[] getMetadataByPath(int storageId, in @utf8InCpp String path);
133 byte[] getMetadataById(int storageId, in byte[] fileId);
134
135 /**
136 * Deletes a storage given its ID. Deletes its bind mounts and unmount it. Stop its data loader.
137 */
138 void deleteStorage(int storageId);
139
140 /**
141 * Permanently disable readlogs reporting for a storage given its ID.
142 */
143 void disallowReadLogs(int storageId);
144
145 /**
146 * Setting up native library directories and extract native libs onto a storage if needed.
147 */
148 boolean configureNativeBinaries(int storageId, in @utf8InCpp String apkFullPath, in @utf8InCpp String libDirRelativePath, in @utf8InCpp String abi, boolean extractNativeLibs);
149
150 /**
151 * Waits until all native library extraction is done for the storage
152 */
153 boolean waitForNativeBinariesExtraction(int storageId);
154
155 /**
156 * Register to start listening for loading progress change for a storage.
157 */
158 boolean registerLoadingProgressListener(int storageId, IStorageLoadingProgressListener listener);
159
160 /**
161 * Stop listening for the loading progress change for a storage.
162 */
163 boolean unregisterLoadingProgressListener(int storageId);
164
165 /**
166 * Metrics key for the duration in milliseconds between now and the oldest pending read. The value is a long.
167 */
168 const @utf8InCpp String METRICS_MILLIS_SINCE_OLDEST_PENDING_READ = "millisSinceOldestPendingRead";
169 /**
170 * Metrics key for whether read logs are enabled. The value is a boolean.
171 */
172 const @utf8InCpp String METRICS_READ_LOGS_ENABLED = "readLogsEnabled";
173 /**
174 * Metrics key for the storage health status. The value is an int.
175 */
176 const @utf8InCpp String METRICS_STORAGE_HEALTH_STATUS_CODE = "storageHealthStatusCode";
177 /**
178 * Metrics key for the data loader status. The value is an int.
179 */
180 const @utf8InCpp String METRICS_DATA_LOADER_STATUS_CODE = "dataLoaderStatusCode";
181 /**
182 * Metrics key for duration since last data loader binding attempt. The value is a long.
183 */
184 const @utf8InCpp String METRICS_MILLIS_SINCE_LAST_DATA_LOADER_BIND = "millisSinceLastDataLoaderBind";
185 /**
186 * Metrics key for delay in milliseconds to retry data loader binding. The value is a long.
187 */
188 const @utf8InCpp String METRICS_DATA_LOADER_BIND_DELAY_MILLIS = "dataLoaderBindDelayMillis";
189 /**
190 * Metrics key for total count of delayed reads caused by pending reads. The value is an int.
191 */
192 const @utf8InCpp String METRICS_TOTAL_DELAYED_READS = "totalDelayedReads";
193 /**
194 * Metrics key for total count of delayed reads caused by pending reads. The value is an int.
195 */
196 const @utf8InCpp String METRICS_TOTAL_DELAYED_READS_MILLIS = "totalDelayedReadsMillis";
197 /**
198 * Metrics key for total count of failed reads. The value is an int.
199 */
200 const @utf8InCpp String METRICS_TOTAL_FAILED_READS = "totalFailedReads";
201 /**
202 * Metrics key for the uid of the last read error. The value is an int.
203 */
204 const @utf8InCpp String METRICS_LAST_READ_ERROR_UID = "lastReadErrorUid";
205 /**
206 * Metrics key for duration in milliseconds since the last read error. The value is a long.
207 */
208 const @utf8InCpp String METRICS_MILLIS_SINCE_LAST_READ_ERROR = "millisSinceLastReadError";
209 /**
210 * Metrics key for the error number of the last read error. The value is an int.
211 */
212 const @utf8InCpp String METRICS_LAST_READ_ERROR_NUMBER = "lastReadErrorNo";
213 /**
214 * Return a bundle containing the requested metrics keys and their values.
215 */
216 PersistableBundle getMetrics(int storageId);
217 }