diff options
8 files changed, 327 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp index d04eb17adf15..b0099d10857c 100644 --- a/Android.bp +++ b/Android.bp @@ -759,6 +759,46 @@ cc_library { }, } +filegroup { + name: "incremental_aidl", + srcs: [ + "core/java/android/os/incremental/IIncrementalService.aidl", + "core/java/android/os/incremental/IIncrementalServiceProxy.aidl", + "core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl", + "core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl", + "core/java/android/os/incremental/NamedParcelFileDescriptor.aidl", + ], + path: "core/java", +} + +filegroup { + name: "incremental_data_loader_aidl", + srcs: [ + "core/java/android/service/incremental/IIncrementalDataLoaderStatusListener.aidl", + "core/java/android/service/incremental/IIncrementalDataLoaderService.aidl", + ], + path: "core/java", +} + +aidl_interface { + name: "libincremental_aidl", + srcs: [ + ":incremental_aidl", + ":incremental_data_loader_aidl", + ], + backend: { + java: { + sdk_version: "28", + }, + cpp: { + enabled: true, + }, + ndk: { + enabled: true, + }, + }, + api_dir: "aidl/incremental", +} gensrcs { name: "gen-platform-proto-constants", diff --git a/core/java/android/os/incremental/IIncrementalService.aidl b/core/java/android/os/incremental/IIncrementalService.aidl new file mode 100644 index 000000000000..1c832ca9e6db --- /dev/null +++ b/core/java/android/os/incremental/IIncrementalService.aidl @@ -0,0 +1,96 @@ +/* + * 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.os.incremental.IncrementalDataLoaderParamsParcel; + +/** @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 IncrementalDataLoaderParamsParcel params, int createMode); + int createLinkedStorage(in @utf8InCpp String path, int otherStorageId, int createMode); + + /** + * 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 pathUnderStorage, 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 relative path under the storage. + */ + int makeDirectory(int storageId, in @utf8InCpp String pathUnderStorage); + + /** + * Creates a file under a storage, specifying its name, size and metadata. + */ + int makeFile(int storageId, in @utf8InCpp String pathUnderStorage, long size, in byte[] metadata); + + /** + * Creates a file under a storage. Content of the file is from a range inside another file. + * Both files are specified by relative paths under storage. + */ + int makeFileFromRange(int storageId, in @utf8InCpp String targetPathUnderStorage, in @utf8InCpp String sourcePathUnderStorage, long start, long end); + + /** + * Creates a hard link between two files in a storage. + * Both source and destination are specified by relative paths under storage. + */ + int makeLink(int storageId, in @utf8InCpp String sourcePathUnderStorage, in @utf8InCpp String destPathUnderStorage); + + /** + * Deletes a hard link in a storage, specified by the relative path of the link target under storage. + */ + int unlink(int storageId, in @utf8InCpp String pathUnderStorage); + + /** + * Checks if a file's certain range is loaded. File is specified by relative file path under storage. + */ + boolean isFileRangeLoaded(int storageId, in @utf8InCpp String pathUnderStorage, long start, long end); + + /** + * Reads the metadata of a file. File is specified by relative path under storage. + */ + byte[] getFileMetadata(int storageId, in @utf8InCpp String pathUnderStorage); + + /** + * Returns the list of file paths under a storage. + */ + @utf8InCpp String[] getFileList(int storageId); + + /** + * Starts loading data for a storage. + */ + boolean startLoading(int storageId); +} diff --git a/core/java/android/os/incremental/IIncrementalServiceProxy.aidl b/core/java/android/os/incremental/IIncrementalServiceProxy.aidl new file mode 100644 index 000000000000..12740eaf3425 --- /dev/null +++ b/core/java/android/os/incremental/IIncrementalServiceProxy.aidl @@ -0,0 +1,37 @@ +/* + * 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.os.incremental.IncrementalFileSystemControlParcel; +import android.os.incremental.IncrementalDataLoaderParamsParcel; +import android.service.incremental.IIncrementalDataLoaderStatusListener; + +/** + * Binder service to receive calls from native Incremental Service and handle Java tasks such as + * looking up data loader service package names, binding and talking to the data loader service. + * @hide + */ +interface IIncrementalServiceProxy { + boolean prepareDataLoader(int mountId, + in IncrementalFileSystemControlParcel control, + in IncrementalDataLoaderParamsParcel params, + in IIncrementalDataLoaderStatusListener listener); + boolean startDataLoader(int mountId); + void showHealthBlockedUI(int mountId); + void destroyDataLoader(int mountId); + void newFileForDataLoader(int mountId, long inode, in byte[] metadata); +} diff --git a/core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl b/core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl new file mode 100644 index 000000000000..50c28f0a4c17 --- /dev/null +++ b/core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl @@ -0,0 +1,29 @@ +/* + * 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.os.incremental.NamedParcelFileDescriptor; + +/** + * Class for holding data loader configuration parameters. + * @hide + */ +parcelable IncrementalDataLoaderParamsParcel { + @utf8InCpp String staticUri; + @utf8InCpp String packageName; + NamedParcelFileDescriptor[] dynamicArgs; +} diff --git a/core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl b/core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl new file mode 100644 index 000000000000..0ae353d2741f --- /dev/null +++ b/core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl @@ -0,0 +1,27 @@ +/* + * 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; + +/** + * Wraps two file descriptors that Incremental Service uses to communicate + * with Incremental FileSystem. + * @hide + */ +parcelable IncrementalFileSystemControlParcel { + @nullable ParcelFileDescriptor cmd; + @nullable ParcelFileDescriptor log; +} diff --git a/core/java/android/os/incremental/NamedParcelFileDescriptor.aidl b/core/java/android/os/incremental/NamedParcelFileDescriptor.aidl new file mode 100644 index 000000000000..038ced1744a1 --- /dev/null +++ b/core/java/android/os/incremental/NamedParcelFileDescriptor.aidl @@ -0,0 +1,28 @@ +/* + * 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.os.ParcelFileDescriptor; + +/** + * A named ParcelFileDescriptor. + * @hide + */ +parcelable NamedParcelFileDescriptor { + @utf8InCpp String name; + ParcelFileDescriptor fd; +} diff --git a/core/java/android/service/incremental/IIncrementalDataLoaderService.aidl b/core/java/android/service/incremental/IIncrementalDataLoaderService.aidl new file mode 100644 index 000000000000..723fc594bd72 --- /dev/null +++ b/core/java/android/service/incremental/IIncrementalDataLoaderService.aidl @@ -0,0 +1,34 @@ +/* + * 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.service.incremental; + +import android.os.incremental.IncrementalDataLoaderParamsParcel; +import android.os.incremental.IncrementalFileSystemControlParcel; +import android.service.incremental.IIncrementalDataLoaderStatusListener; + +/** @hide */ +oneway interface IIncrementalDataLoaderService { + void createDataLoader(in int storageId, + in IncrementalFileSystemControlParcel control, + in IncrementalDataLoaderParamsParcel params, + in IIncrementalDataLoaderStatusListener listener, + in boolean start); + void startDataLoader(in int storageId); + void stopDataLoader(in int storageId); + void destroyDataLoader(in int storageId); + void onFileCreated(in int storageId, in long inode, in byte[] metadata); +} diff --git a/core/java/android/service/incremental/IIncrementalDataLoaderStatusListener.aidl b/core/java/android/service/incremental/IIncrementalDataLoaderStatusListener.aidl new file mode 100644 index 000000000000..f04242dc6c02 --- /dev/null +++ b/core/java/android/service/incremental/IIncrementalDataLoaderStatusListener.aidl @@ -0,0 +1,36 @@ +/* + * 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.service.incremental; + +/** + * Callbacks from DataLoaderService to IncrementalService to report data loader status. + * @hide + */ +oneway interface IIncrementalDataLoaderStatusListener { + /** Data loader status */ + const int DATA_LOADER_READY = 0; + const int DATA_LOADER_NOT_READY = 1; + const int DATA_LOADER_RUNNING = 2; + const int DATA_LOADER_STOPPED = 3; + const int DATA_LOADER_SLOW_CONNECTION = 4; + const int DATA_LOADER_NO_CONNECTION = 5; + const int DATA_LOADER_CONNECTION_OK = 6; + + /** Data loader status callback */ + void onStatusChanged(in int storageId, in int status); +} + |