Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5c894f7 authored by Songchun Fan's avatar Songchun Fan
Browse files

[incremental] Java service and shell command handler

Renaming:

IIncrementalManager.aidl -> IIncrementalManagerNative.aidl
IIncrementalServiceProxy.aidl -> IIncrementalManager.aidl

Adding implementation of IIncrementalManager.aidl. Also adding
implementation of the shell command handler.

Test: $adb abb incremental help

Change-Id: Ia18fde097f6170f4774552428a2927186ede8389
parent 6cde9d9a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -804,8 +804,8 @@ cc_library {
filegroup {
filegroup {
    name: "incremental_aidl",
    name: "incremental_aidl",
    srcs: [
    srcs: [
        "core/java/android/os/incremental/IIncrementalManagerNative.aidl",
        "core/java/android/os/incremental/IIncrementalManager.aidl",
        "core/java/android/os/incremental/IIncrementalManager.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",
        "core/java/android/os/incremental/NamedParcelFileDescriptor.aidl",
        "core/java/android/os/incremental/NamedParcelFileDescriptor.aidl",
+1 −1
Original line number Original line Diff line number Diff line
@@ -4980,7 +4980,7 @@ public abstract class Context {
     * {@link android.os.incremental.IncrementalManager}.
     * {@link android.os.incremental.IncrementalManager}.
     * @hide
     * @hide
     */
     */
    public static final String INCREMENTAL_SERVICE = "incremental";
    public static final String INCREMENTAL_SERVICE = "incremental_service";


    /**
    /**
     * Determine whether the given permission is allowed for a particular
     * Determine whether the given permission is allowed for a particular
+15 −82
Original line number Original line Diff line number Diff line
@@ -16,89 +16,22 @@


package android.os.incremental;
package android.os.incremental;


import android.os.incremental.IncrementalFileSystemControlParcel;
import android.os.incremental.IncrementalDataLoaderParamsParcel;
import android.os.incremental.IncrementalDataLoaderParamsParcel;

import android.content.pm.IDataLoaderStatusListener;
/** @hide */
interface IIncrementalManager {
    /**
     * 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.
 * 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
 */
 */
    int openStorage(in @utf8InCpp String path);
interface IIncrementalManager {
    int createStorage(in @utf8InCpp String path, in IncrementalDataLoaderParamsParcel params, int createMode);
    boolean prepareDataLoader(int mountId,
    int createLinkedStorage(in @utf8InCpp String path, int otherStorageId, int createMode);
        in IncrementalFileSystemControlParcel control,

        in IncrementalDataLoaderParamsParcel params,
    /**
        in IDataLoaderStatusListener listener);
     * Bind-mounts a path under a storage to a full path. Can be permanent or temporary.
    boolean startDataLoader(int mountId);
     */
    void showHealthBlockedUI(int mountId);
    const int BIND_TEMPORARY = 0;
    void destroyDataLoader(int mountId);
    const int BIND_PERMANENT = 1;
    void newFileForDataLoader(int mountId, long inode, in byte[] metadata);
    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);

    /**
     * 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.
     */
    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 two storage instances.
     * 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 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.
     */
    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);

    /**
     * Starts loading data for a storage.
     */
    boolean startLoading(int storageId);

    /**
     * Deletes a storage given its ID. Deletes its bind mounts and unmount it. Stop its data loader.
     */
    void deleteStorage(int storageId);
}
}
+104 −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.os.incremental.IncrementalDataLoaderParamsParcel;

/** @hide */
interface IIncrementalManagerNative {
    /**
     * 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);

    /**
     * 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.
     */
    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 two storage instances.
     * 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 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.
     */
    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);

    /**
     * Starts loading data for a storage.
     */
    boolean startLoading(int storageId);

    /**
     * Deletes a storage given its ID. Deletes its bind mounts and unmount it. Stop its data loader.
     */
    void deleteStorage(int storageId);
}
+0 −37
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.os.incremental.IncrementalFileSystemControlParcel;
import android.os.incremental.IncrementalDataLoaderParamsParcel;
import android.content.pm.IDataLoaderStatusListener;

/**
 * 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 IDataLoaderStatusListener listener);
    boolean startDataLoader(int mountId);
    void showHealthBlockedUI(int mountId);
    void destroyDataLoader(int mountId);
    void newFileForDataLoader(int mountId, long inode, in byte[] metadata);
}
Loading