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

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

Snap for 7064178 from f86c2c3c to sc-release

Change-Id: I7fdad6e91a18e24ee0f1a86fb7a168bc9f68d4f7
parents 78c4ffcb f86c2c3c
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -23,10 +23,29 @@ namespace contexthub {
namespace V1_1 {
namespace implementation {

using ::android::hardware::contexthub::V1_0::Result;

Return<void> Contexthub::onSettingChanged(Setting /*setting*/, SettingValue /*newValue*/) {
    return Void();
}

Return<Result> Contexthub::registerCallback(uint32_t hubId, const sp<IContexthubCallback>& cb) {
    if (hubId == kMockHubId) {
        mCallback = cb;
        return Result::OK;
    }
    return Result::BAD_PARAMS;
}

Return<Result> Contexthub::queryApps(uint32_t hubId) {
    if (hubId == kMockHubId && mCallback != nullptr) {
        std::vector<HubAppInfo> nanoapps;
        mCallback->handleAppsInfo(nanoapps);
        return Result::OK;
    }
    return Result::BAD_PARAMS;
}

}  // namespace implementation
}  // namespace V1_1
}  // namespace contexthub
+10 −0
Original line number Diff line number Diff line
@@ -27,9 +27,19 @@ namespace implementation {

class Contexthub
    : public ::android::hardware::contexthub::V1_X::implementation::ContextHub<IContexthub> {
    using Result = ::android::hardware::contexthub::V1_0::Result;

  public:
    // Methods from V1_0::IContexthub
    Return<Result> registerCallback(uint32_t hubId, const sp<IContexthubCallback>& cb) override;

    Return<Result> queryApps(uint32_t hubId) override;

    // Methods from V1_1::IContexthub
    Return<void> onSettingChanged(Setting setting, SettingValue newValue) override;

  private:
    sp<IContexthubCallback> mCallback;
};

}  // namespace implementation
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ hidl_interface {
    srcs: [
        "types.hal",
        "IContexthub.hal",
        "IContexthubCallback.hal",
    ],
    interfaces: [
        "android.hardware.contexthub@1.0",
+30 −0
Original line number Diff line number Diff line
@@ -16,10 +16,40 @@

package android.hardware.contexthub@1.2;

import @1.0::Result;
import @1.1::IContexthub;
import @1.1::SettingValue;
import IContexthubCallback;

interface IContexthub extends @1.1::IContexthub {
    /**
     * Register a callback for the HAL implementation to send asynchronous
     * messages to the service from a context hub. There can be a maximum of
     * one callback registered with the HAL. A call to this function when a
     * callback has already been registered must override the previous
     * registration.
     *
     * @param hubId    identifier for the hub
     * @param callback an implementation of the IContextHubCallbacks
     *
     * @return result OK on success
     *                BAD_VALUE if parameters are not valid
     *
     */
    registerCallback_1_2(uint32_t hubId, IContexthubCallback cb) generates (Result result);

    /**
     * Send a message to a hub
     *
     * @param hubId identifier for hub to send message to
     * @param msg   message to be sent
     *
     * @return result OK if successful, error code otherwise
     *                BAD_VALUE if parameters are not valid
     *                TRANSACTION_FAILED if message send failed
     */
    sendMessageToHub_1_2(uint32_t hubId, ContextHubMsg msg) generates (Result result);

    /**
     * Notification sent by the framework to indicate that the user
     * has changed a setting.
+45 −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.
 */

package android.hardware.contexthub@1.2;

import @1.0::IContexthubCallback;

interface IContexthubCallback extends @1.0::IContexthubCallback {
    /**
     * This callback is passed by the Contexthub service to the HAL
     * implementation to allow the HAL to send asynchronous messages back
     * to the service and registered clients of the ContextHub service.
     *
     * @param msg message that should be delivered to host app clients
     *
     */
    handleClientMsg_1_2(ContextHubMsg msg);

    /**
     * This callback is passed by the Contexthub service to the HAL
     * implementation to allow the HAL to send information about the
     * currently loaded and active nanoapps on the hub.
     *
     * @param appInfo vector of HubAppinfo structure for each nanoApp
     *                on the hub that can be enabled, disabled and
     *                unloaded by the service. Any nanoApps that cannot
     *                be controlled by the service must not be reported.
     *                All nanoApps that can be controlled by the service
     *                must be reported.
     */
    handleAppsInfo_1_2(vec<HubAppInfo> appInfo);
};
Loading