Loading Android.bp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -772,7 +772,7 @@ cc_library { filegroup { filegroup { name: "incremental_aidl", name: "incremental_aidl", srcs: [ srcs: [ "core/java/android/os/incremental/IIncrementalService.aidl", "core/java/android/os/incremental/IIncrementalManager.aidl", "core/java/android/os/incremental/IIncrementalServiceProxy.aidl", "core/java/android/os/incremental/IIncrementalServiceProxy.aidl", "core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl", "core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl", "core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl", "core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl", Loading core/java/android/content/Context.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -3426,6 +3426,7 @@ public abstract class Context { //@hide: SYSTEM_UPDATE_SERVICE, //@hide: SYSTEM_UPDATE_SERVICE, //@hide: TIME_DETECTOR_SERVICE, //@hide: TIME_DETECTOR_SERVICE, PERMISSION_SERVICE, PERMISSION_SERVICE, INCREMENTAL_SERVICE, }) }) @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) public @interface ServiceName {} public @interface ServiceName {} Loading Loading @@ -4958,6 +4959,13 @@ public abstract class Context { @SystemApi @SystemApi public static final String APP_INTEGRITY_SERVICE = "app_integrity"; public static final String APP_INTEGRITY_SERVICE = "app_integrity"; /** * Use with {@link #getSystemService(String)} to retrieve an * {@link android.os.incremental.IncrementalManager}. * @hide */ public static final String INCREMENTAL_SERVICE = "incremental"; /** /** * Determine whether the given permission is allowed for a particular * Determine whether the given permission is allowed for a particular * process and user ID running in the system. * process and user ID running in the system. Loading core/java/android/os/incremental/IIncrementalService.aidl→core/java/android/os/incremental/IIncrementalManager.aidl +16 −8 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ package android.os.incremental; import android.os.incremental.IncrementalDataLoaderParamsParcel; import android.os.incremental.IncrementalDataLoaderParamsParcel; /** @hide */ /** @hide */ interface IIncrementalService { interface IIncrementalManager { /** /** * A set of flags for the |createMode| parameters when creating a new Incremental storage. * A set of flags for the |createMode| parameters when creating a new Incremental storage. */ */ Loading Loading @@ -52,6 +52,12 @@ interface IIncrementalService { */ */ int makeDirectory(int storageId, in @utf8InCpp String pathUnderStorage); int makeDirectory(int storageId, in @utf8InCpp String pathUnderStorage); /** * Recursively creates a directory under a storage. The target directory is specified by its relative path under the storage. * All the parent directories of the target directory will be created if they do not exist already. */ int makeDirectories(int storageId, in @utf8InCpp String pathUnderStorage); /** /** * Creates a file under a storage, specifying its name, size and metadata. * Creates a file under a storage, specifying its name, size and metadata. */ */ Loading @@ -64,10 +70,12 @@ interface IIncrementalService { int makeFileFromRange(int storageId, in @utf8InCpp String targetPathUnderStorage, in @utf8InCpp String sourcePathUnderStorage, long start, long end); 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. * Creates a hard link between two files in two storage instances. * Both source and destination are specified by relative paths under storage. * Source and dest specified by parent storage IDs and their relative paths under the storage. * The source and dest storage instances should be in the same fs mount. * Note: destStorageId can be the same as sourceStorageId. */ */ int makeLink(int storageId, in @utf8InCpp String sourcePathUnderStorage, in @utf8InCpp String destPathUnderStorage); int makeLink(int sourceStorageId, in @utf8InCpp String sourcePathUnderStorage, int destStorageId, in @utf8InCpp String destPathUnderStorage); /** /** * Deletes a hard link in a storage, specified by the relative path of the link target under storage. * Deletes a hard link in a storage, specified by the relative path of the link target under storage. Loading @@ -85,12 +93,12 @@ interface IIncrementalService { byte[] getFileMetadata(int storageId, in @utf8InCpp String pathUnderStorage); byte[] getFileMetadata(int storageId, in @utf8InCpp String pathUnderStorage); /** /** * Returns the list of file paths under a storage. * Starts loading data for a storage. */ */ @utf8InCpp String[] getFileList(int storageId); boolean startLoading(int storageId); /** /** * Starts loading data for a storage. * Deletes a storage given its ID. Deletes its bind mounts and unmount it. Stop its data loader. */ */ boolean startLoading(int storageId); void deleteStorage(int storageId); } } core/java/android/os/incremental/IncrementalDataLoaderParams.java 0 → 100644 +84 −0 Original line number Original line Diff line number Diff line /* * 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.annotation.NonNull; import android.annotation.Nullable; import android.os.ParcelFileDescriptor; import java.util.Arrays; import java.util.Map; import java.util.stream.Collectors; /** * This class represents the parameters used to configure an Incremental Data Loader. * Hide for now. * @hide */ public class IncrementalDataLoaderParams { @NonNull private final IncrementalDataLoaderParamsParcel mData; public IncrementalDataLoaderParams(@NonNull String url, @NonNull String packageName, @Nullable Map<String, ParcelFileDescriptor> namedFds) { IncrementalDataLoaderParamsParcel data = new IncrementalDataLoaderParamsParcel(); data.staticArgs = url; data.packageName = packageName; if (namedFds == null || namedFds.isEmpty()) { data.dynamicArgs = new NamedParcelFileDescriptor[0]; } else { data.dynamicArgs = new NamedParcelFileDescriptor[namedFds.size()]; int i = 0; for (Map.Entry<String, ParcelFileDescriptor> namedFd : namedFds.entrySet()) { data.dynamicArgs[i] = new NamedParcelFileDescriptor(); data.dynamicArgs[i].name = namedFd.getKey(); data.dynamicArgs[i].fd = namedFd.getValue(); i += 1; } } mData = data; } public IncrementalDataLoaderParams(@NonNull IncrementalDataLoaderParamsParcel data) { mData = data; } /** * @return static server's URL */ public final @NonNull String getStaticArgs() { return mData.staticArgs; } /** * @return data loader's package name */ public final @NonNull String getPackageName() { return mData.packageName; } public final @NonNull IncrementalDataLoaderParamsParcel getData() { return mData; } /** * @return data loader's dynamic arguments such as file descriptors */ public final @NonNull Map<String, ParcelFileDescriptor> getDynamicArgs() { return Arrays.stream(mData.dynamicArgs).collect( Collectors.toMap(p->p.name, p->p.fd)); } } core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,7 @@ import android.os.incremental.NamedParcelFileDescriptor; * @hide * @hide */ */ parcelable IncrementalDataLoaderParamsParcel { parcelable IncrementalDataLoaderParamsParcel { @utf8InCpp String staticUri; @utf8InCpp String packageName; @utf8InCpp String packageName; @utf8InCpp String staticArgs; NamedParcelFileDescriptor[] dynamicArgs; NamedParcelFileDescriptor[] dynamicArgs; } } Loading
Android.bp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -772,7 +772,7 @@ cc_library { filegroup { filegroup { name: "incremental_aidl", name: "incremental_aidl", srcs: [ srcs: [ "core/java/android/os/incremental/IIncrementalService.aidl", "core/java/android/os/incremental/IIncrementalManager.aidl", "core/java/android/os/incremental/IIncrementalServiceProxy.aidl", "core/java/android/os/incremental/IIncrementalServiceProxy.aidl", "core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl", "core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl", "core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl", "core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl", Loading
core/java/android/content/Context.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -3426,6 +3426,7 @@ public abstract class Context { //@hide: SYSTEM_UPDATE_SERVICE, //@hide: SYSTEM_UPDATE_SERVICE, //@hide: TIME_DETECTOR_SERVICE, //@hide: TIME_DETECTOR_SERVICE, PERMISSION_SERVICE, PERMISSION_SERVICE, INCREMENTAL_SERVICE, }) }) @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) public @interface ServiceName {} public @interface ServiceName {} Loading Loading @@ -4958,6 +4959,13 @@ public abstract class Context { @SystemApi @SystemApi public static final String APP_INTEGRITY_SERVICE = "app_integrity"; public static final String APP_INTEGRITY_SERVICE = "app_integrity"; /** * Use with {@link #getSystemService(String)} to retrieve an * {@link android.os.incremental.IncrementalManager}. * @hide */ public static final String INCREMENTAL_SERVICE = "incremental"; /** /** * Determine whether the given permission is allowed for a particular * Determine whether the given permission is allowed for a particular * process and user ID running in the system. * process and user ID running in the system. Loading
core/java/android/os/incremental/IIncrementalService.aidl→core/java/android/os/incremental/IIncrementalManager.aidl +16 −8 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ package android.os.incremental; import android.os.incremental.IncrementalDataLoaderParamsParcel; import android.os.incremental.IncrementalDataLoaderParamsParcel; /** @hide */ /** @hide */ interface IIncrementalService { interface IIncrementalManager { /** /** * A set of flags for the |createMode| parameters when creating a new Incremental storage. * A set of flags for the |createMode| parameters when creating a new Incremental storage. */ */ Loading Loading @@ -52,6 +52,12 @@ interface IIncrementalService { */ */ int makeDirectory(int storageId, in @utf8InCpp String pathUnderStorage); int makeDirectory(int storageId, in @utf8InCpp String pathUnderStorage); /** * Recursively creates a directory under a storage. The target directory is specified by its relative path under the storage. * All the parent directories of the target directory will be created if they do not exist already. */ int makeDirectories(int storageId, in @utf8InCpp String pathUnderStorage); /** /** * Creates a file under a storage, specifying its name, size and metadata. * Creates a file under a storage, specifying its name, size and metadata. */ */ Loading @@ -64,10 +70,12 @@ interface IIncrementalService { int makeFileFromRange(int storageId, in @utf8InCpp String targetPathUnderStorage, in @utf8InCpp String sourcePathUnderStorage, long start, long end); 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. * Creates a hard link between two files in two storage instances. * Both source and destination are specified by relative paths under storage. * Source and dest specified by parent storage IDs and their relative paths under the storage. * The source and dest storage instances should be in the same fs mount. * Note: destStorageId can be the same as sourceStorageId. */ */ int makeLink(int storageId, in @utf8InCpp String sourcePathUnderStorage, in @utf8InCpp String destPathUnderStorage); int makeLink(int sourceStorageId, in @utf8InCpp String sourcePathUnderStorage, int destStorageId, in @utf8InCpp String destPathUnderStorage); /** /** * Deletes a hard link in a storage, specified by the relative path of the link target under storage. * Deletes a hard link in a storage, specified by the relative path of the link target under storage. Loading @@ -85,12 +93,12 @@ interface IIncrementalService { byte[] getFileMetadata(int storageId, in @utf8InCpp String pathUnderStorage); byte[] getFileMetadata(int storageId, in @utf8InCpp String pathUnderStorage); /** /** * Returns the list of file paths under a storage. * Starts loading data for a storage. */ */ @utf8InCpp String[] getFileList(int storageId); boolean startLoading(int storageId); /** /** * Starts loading data for a storage. * Deletes a storage given its ID. Deletes its bind mounts and unmount it. Stop its data loader. */ */ boolean startLoading(int storageId); void deleteStorage(int storageId); } }
core/java/android/os/incremental/IncrementalDataLoaderParams.java 0 → 100644 +84 −0 Original line number Original line Diff line number Diff line /* * 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.annotation.NonNull; import android.annotation.Nullable; import android.os.ParcelFileDescriptor; import java.util.Arrays; import java.util.Map; import java.util.stream.Collectors; /** * This class represents the parameters used to configure an Incremental Data Loader. * Hide for now. * @hide */ public class IncrementalDataLoaderParams { @NonNull private final IncrementalDataLoaderParamsParcel mData; public IncrementalDataLoaderParams(@NonNull String url, @NonNull String packageName, @Nullable Map<String, ParcelFileDescriptor> namedFds) { IncrementalDataLoaderParamsParcel data = new IncrementalDataLoaderParamsParcel(); data.staticArgs = url; data.packageName = packageName; if (namedFds == null || namedFds.isEmpty()) { data.dynamicArgs = new NamedParcelFileDescriptor[0]; } else { data.dynamicArgs = new NamedParcelFileDescriptor[namedFds.size()]; int i = 0; for (Map.Entry<String, ParcelFileDescriptor> namedFd : namedFds.entrySet()) { data.dynamicArgs[i] = new NamedParcelFileDescriptor(); data.dynamicArgs[i].name = namedFd.getKey(); data.dynamicArgs[i].fd = namedFd.getValue(); i += 1; } } mData = data; } public IncrementalDataLoaderParams(@NonNull IncrementalDataLoaderParamsParcel data) { mData = data; } /** * @return static server's URL */ public final @NonNull String getStaticArgs() { return mData.staticArgs; } /** * @return data loader's package name */ public final @NonNull String getPackageName() { return mData.packageName; } public final @NonNull IncrementalDataLoaderParamsParcel getData() { return mData; } /** * @return data loader's dynamic arguments such as file descriptors */ public final @NonNull Map<String, ParcelFileDescriptor> getDynamicArgs() { return Arrays.stream(mData.dynamicArgs).collect( Collectors.toMap(p->p.name, p->p.fd)); } }
core/java/android/os/incremental/IncrementalDataLoaderParamsParcel.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,7 @@ import android.os.incremental.NamedParcelFileDescriptor; * @hide * @hide */ */ parcelable IncrementalDataLoaderParamsParcel { parcelable IncrementalDataLoaderParamsParcel { @utf8InCpp String staticUri; @utf8InCpp String packageName; @utf8InCpp String packageName; @utf8InCpp String staticArgs; NamedParcelFileDescriptor[] dynamicArgs; NamedParcelFileDescriptor[] dynamicArgs; } }