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