Add health.storage AIDL HAL am: c78079b333

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1548963

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I32bbb760791719f51a4699b5ce889b8cd3ba3d1b
This commit is contained in:
Yifan Hong 2021-01-20 20:00:45 +00:00 committed by Automerger Merge Worker
commit 386da77b01
8 changed files with 232 additions and 0 deletions

View file

@ -266,6 +266,14 @@
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.health.storage</name>
<version>1</version>
<interface>
<name>IStorage</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.identity</name>
<version>1-2</version>

View file

@ -0,0 +1,33 @@
// Copyright (C) 2021 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.
aidl_interface {
name: "android.hardware.health.storage",
vendor_available: true,
srcs: ["android/hardware/health/storage/*.aidl"],
stability: "vintf",
backend: {
cpp: {
enabled: false,
},
java: {
enabled: false,
},
ndk: {
vndk: {
enabled: true,
},
},
},
}

View file

@ -0,0 +1,23 @@
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.health.storage;
@VintfStability
interface IGarbageCollectCallback {
oneway void onFinish(in android.hardware.health.storage.Result result);
}

View file

@ -0,0 +1,23 @@
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.health.storage;
@VintfStability
interface IStorage {
oneway void garbageCollect(in long timeoutSeconds, in android.hardware.health.storage.IGarbageCollectCallback callback);
}

View file

@ -0,0 +1,25 @@
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.health.storage;
@Backing(type="int") @VintfStability
enum Result {
SUCCESS = 0,
IO_ERROR = 1,
UNKNOWN_ERROR = 2,
}

View file

@ -0,0 +1,34 @@
/*
* Copyright (C) 2021 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.hardware.health.storage;
import android.hardware.health.storage.Result;
/**
* Callback interface to IStorage.garbageCollect.
*/
@VintfStability
interface IGarbageCollectCallback {
/**
* When garbage collection has finished, the implementation must
* invoke this function to indicate the result of the garbage collection.
*
* @param out result Execution result. See documentation for Result for
* details.
*/
oneway void onFinish(in Result result);
}

View file

@ -0,0 +1,49 @@
/*
* Copyright (C) 2021 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.hardware.health.storage;
import android.hardware.health.storage.IGarbageCollectCallback;
/**
* IStorage is an interface that provides operations on underlying storage
* devices, including flash memory.
*/
@VintfStability
interface IStorage {
/**
* Start garbage collection on the driver of storage devices.
*
* Garbage collection must be started at regular intervals when it is a good
* time for a longer-running cleanup tasks, roughly daily.
*
* When garbage collection finishes or encounters an error before the
* specified timeout, the implementation must call IGarbageCollect.finish
* immediately with appropriate result.
*
* If garbage collection does not finish within the specified timeout,
* the implementation must stop garbage collection, and must not call
* IGarbageCollect.finish.
*
* @param timeoutSeconds timeout in seconds. The implementation must
* return after the timeout is reached.
*
* @param callback callback interface. Callback must be null if the client
* does not need to receive any callbacks.
*
*/
oneway void garbageCollect(in long timeoutSeconds, in IGarbageCollectCallback callback);
}

View file

@ -0,0 +1,37 @@
/*
* Copyright (C) 2021 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.hardware.health.storage;
/**
* Status values for HAL methods.
*/
@VintfStability
@Backing(type="int")
enum Result {
/**
* Execution of the method is successful.
*/
SUCCESS = 0,
/**
* An IO error is encountered when the HAL communicates with the device.
*/
IO_ERROR,
/**
* An unknown error is encountered.
*/
UNKNOWN_ERROR,
}