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

Commit b52d2c9b authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6976352 from d46bf8ff to sc-release

Change-Id: Ida56e7c32ca77b62f463bcffa99790fc04832736
parents 6a1868f0 d46bf8ff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -417,7 +417,7 @@ const ConfigDeclaration kVehicleProperties[]{
                         .minSampleRate = 1.0f,
                         .maxSampleRate = 2.0f,
                 },
         .initialValue = {.floatValues = {100.0f}}},  // units in meters
         .initialValue = {.floatValues = {50000.0f}}},  // units in meters

        {.config =
                 {
+8 −1
Original line number Diff line number Diff line
@@ -521,7 +521,7 @@
    </hal>
    <hal format="hidl" optional="true">
        <name>android.hardware.usb.gadget</name>
        <version>1.0-1</version>
        <version>1.0-2</version>
        <interface>
            <name>IUsbGadget</name>
            <instance>default</instance>
@@ -534,6 +534,13 @@
            <instance>default</instance>
        </interface>
    </hal>
    <hal format="aidl" optional="true">
        <name>android.hardware.vibrator</name>
        <interface>
            <name>IVibratorManager</name>
            <instance>default</instance>
        </interface>
    </hal>
    <hal format="hidl" optional="true">
        <name>android.hardware.vr</name>
        <version>1.0</version>
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ cc_library_static {
    srcs: ["src/*"],
    local_include_dirs: ["include/nnapi/hal/1.0/"],
    export_include_dirs: ["include"],
    cflags: ["-Wthread-safety"],
    static_libs: [
        "neuralnetworks_types",
        "neuralnetworks_utils_hal_common",
+67 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.
 */

#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_0_UTILS_CALLBACKS_H
#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_0_UTILS_CALLBACKS_H

#include <android/hardware/neuralnetworks/1.0/IExecutionCallback.h>
#include <android/hardware/neuralnetworks/1.0/IPreparedModelCallback.h>
#include <android/hardware/neuralnetworks/1.0/types.h>
#include <nnapi/IPreparedModel.h>
#include <nnapi/Result.h>
#include <nnapi/Types.h>
#include <nnapi/hal/CommonUtils.h>
#include <nnapi/hal/ProtectCallback.h>
#include <nnapi/hal/TransferValue.h>

namespace android::hardware::neuralnetworks::V1_0::utils {

class PreparedModelCallback final : public IPreparedModelCallback,
                                    public hal::utils::IProtectedCallback {
  public:
    using Data = nn::GeneralResult<nn::SharedPreparedModel>;

    Return<void> notify(ErrorStatus status, const sp<IPreparedModel>& preparedModel) override;

    void notifyAsDeadObject() override;

    Data get();

  private:
    void notifyInternal(Data result);

    hal::utils::TransferValue<Data> mData;
};

class ExecutionCallback final : public IExecutionCallback, public hal::utils::IProtectedCallback {
  public:
    using Data = nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>>;

    Return<void> notify(ErrorStatus status) override;

    void notifyAsDeadObject() override;

    Data get();

  private:
    void notifyInternal(Data result);

    hal::utils::TransferValue<Data> mData;
};

}  // namespace android::hardware::neuralnetworks::V1_0::utils

#endif  // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_0_UTILS_CALLBACKS_H
+33 −31
Original line number Diff line number Diff line
@@ -24,42 +24,44 @@

namespace android::nn {

Result<OperandType> convert(const hal::V1_0::OperandType& operandType);
Result<OperationType> convert(const hal::V1_0::OperationType& operationType);
Result<Operand::LifeTime> convert(const hal::V1_0::OperandLifeTime& lifetime);
Result<DeviceStatus> convert(const hal::V1_0::DeviceStatus& deviceStatus);
Result<Capabilities::PerformanceInfo> convert(const hal::V1_0::PerformanceInfo& performanceInfo);
Result<Capabilities> convert(const hal::V1_0::Capabilities& capabilities);
Result<DataLocation> convert(const hal::V1_0::DataLocation& location);
Result<Operand> convert(const hal::V1_0::Operand& operand);
Result<Operation> convert(const hal::V1_0::Operation& operation);
Result<Model::OperandValues> convert(const hardware::hidl_vec<uint8_t>& operandValues);
Result<Memory> convert(const hardware::hidl_memory& memory);
Result<Model> convert(const hal::V1_0::Model& model);
Result<Request::Argument> convert(const hal::V1_0::RequestArgument& requestArgument);
Result<Request> convert(const hal::V1_0::Request& request);
Result<ErrorStatus> convert(const hal::V1_0::ErrorStatus& status);
GeneralResult<OperandType> convert(const hal::V1_0::OperandType& operandType);
GeneralResult<OperationType> convert(const hal::V1_0::OperationType& operationType);
GeneralResult<Operand::LifeTime> convert(const hal::V1_0::OperandLifeTime& lifetime);
GeneralResult<DeviceStatus> convert(const hal::V1_0::DeviceStatus& deviceStatus);
GeneralResult<Capabilities::PerformanceInfo> convert(
        const hal::V1_0::PerformanceInfo& performanceInfo);
GeneralResult<Capabilities> convert(const hal::V1_0::Capabilities& capabilities);
GeneralResult<DataLocation> convert(const hal::V1_0::DataLocation& location);
GeneralResult<Operand> convert(const hal::V1_0::Operand& operand);
GeneralResult<Operation> convert(const hal::V1_0::Operation& operation);
GeneralResult<Model::OperandValues> convert(const hardware::hidl_vec<uint8_t>& operandValues);
GeneralResult<Memory> convert(const hardware::hidl_memory& memory);
GeneralResult<Model> convert(const hal::V1_0::Model& model);
GeneralResult<Request::Argument> convert(const hal::V1_0::RequestArgument& requestArgument);
GeneralResult<Request> convert(const hal::V1_0::Request& request);
GeneralResult<ErrorStatus> convert(const hal::V1_0::ErrorStatus& status);

}  // namespace android::nn

namespace android::hardware::neuralnetworks::V1_0::utils {

nn::Result<OperandType> convert(const nn::OperandType& operandType);
nn::Result<OperationType> convert(const nn::OperationType& operationType);
nn::Result<OperandLifeTime> convert(const nn::Operand::LifeTime& lifetime);
nn::Result<DeviceStatus> convert(const nn::DeviceStatus& deviceStatus);
nn::Result<PerformanceInfo> convert(const nn::Capabilities::PerformanceInfo& performanceInfo);
nn::Result<Capabilities> convert(const nn::Capabilities& capabilities);
nn::Result<DataLocation> convert(const nn::DataLocation& location);
nn::Result<Operand> convert(const nn::Operand& operand);
nn::Result<Operation> convert(const nn::Operation& operation);
nn::Result<hidl_vec<uint8_t>> convert(const nn::Model::OperandValues& operandValues);
nn::Result<hidl_memory> convert(const nn::Memory& memory);
nn::Result<Model> convert(const nn::Model& model);
nn::Result<RequestArgument> convert(const nn::Request::Argument& requestArgument);
nn::Result<hidl_memory> convert(const nn::Request::MemoryPool& memoryPool);
nn::Result<Request> convert(const nn::Request& request);
nn::Result<ErrorStatus> convert(const nn::ErrorStatus& status);
nn::GeneralResult<OperandType> convert(const nn::OperandType& operandType);
nn::GeneralResult<OperationType> convert(const nn::OperationType& operationType);
nn::GeneralResult<OperandLifeTime> convert(const nn::Operand::LifeTime& lifetime);
nn::GeneralResult<DeviceStatus> convert(const nn::DeviceStatus& deviceStatus);
nn::GeneralResult<PerformanceInfo> convert(
        const nn::Capabilities::PerformanceInfo& performanceInfo);
nn::GeneralResult<Capabilities> convert(const nn::Capabilities& capabilities);
nn::GeneralResult<DataLocation> convert(const nn::DataLocation& location);
nn::GeneralResult<Operand> convert(const nn::Operand& operand);
nn::GeneralResult<Operation> convert(const nn::Operation& operation);
nn::GeneralResult<hidl_vec<uint8_t>> convert(const nn::Model::OperandValues& operandValues);
nn::GeneralResult<hidl_memory> convert(const nn::Memory& memory);
nn::GeneralResult<Model> convert(const nn::Model& model);
nn::GeneralResult<RequestArgument> convert(const nn::Request::Argument& requestArgument);
nn::GeneralResult<hidl_memory> convert(const nn::Request::MemoryPool& memoryPool);
nn::GeneralResult<Request> convert(const nn::Request& request);
nn::GeneralResult<ErrorStatus> convert(const nn::ErrorStatus& status);

}  // namespace android::hardware::neuralnetworks::V1_0::utils

Loading