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

Commit fd5e65c7 authored by Arthur Ishiguro's avatar Arthur Ishiguro Committed by Matthew Sedam
Browse files

Adds a HAL API to get the list of preloaded nanoapp

Bug: 258074235
Test: make android.hardware.contexthub-update-api
Test: atest VtsAidlHalContextHubTargetTest
Change-Id: Ifdb849d3ccb6a9303c6f561e941c5be9aa13661f
parent 422030d2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@
    </hal>
    <hal format="aidl" optional="true">
        <name>android.hardware.contexthub</name>
        <version>2</version>
        <interface>
            <name>IContextHub</name>
            <instance>default</instance>
+1 −0
Original line number Diff line number Diff line
@@ -45,5 +45,6 @@ interface IContextHub {
  void sendMessageToHub(in int contextHubId, in android.hardware.contexthub.ContextHubMessage message);
  void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo);
  void onHostEndpointDisconnected(char hostEndpointId);
  long[] getPreloadedNanoappIds();
  const int EX_CONTEXT_HUB_UNSPECIFIED = -1;
}
+9 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.hardware.contexthub.ContextHubMessage;
import android.hardware.contexthub.HostEndpointInfo;
import android.hardware.contexthub.IContextHubCallback;
import android.hardware.contexthub.NanoappBinary;
import android.hardware.contexthub.NanoappInfo;
import android.hardware.contexthub.Setting;

@VintfStability
@@ -194,6 +195,14 @@ interface IContextHub {
     */
    void onHostEndpointDisconnected(char hostEndpointId);

    /**
     * Provides the list of preloaded nanoapp IDs on the system. The output of this API must
     * not change.
     *
     * @return The list of preloaded nanoapp IDs
     */
    long[] getPreloadedNanoappIds();

    /**
     * Error codes that are used as service specific errors with the AIDL return
     * value EX_SERVICE_SPECIFIC.
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ cc_library_static {
    shared_libs: [
        "libbase",
        "libbinder_ndk",
        "android.hardware.contexthub-V1-ndk",
        "android.hardware.contexthub-V2-ndk",
    ],
    export_include_dirs: ["include"],
    srcs: [
@@ -50,7 +50,7 @@ cc_binary {
    shared_libs: [
        "libbase",
        "libbinder_ndk",
        "android.hardware.contexthub-V1-ndk",
        "android.hardware.contexthub-V2-ndk",
    ],
    static_libs: [
        "libcontexthubexampleimpl",
+11 −0
Original line number Diff line number Diff line
@@ -76,6 +76,17 @@ ScopedAStatus ContextHub::queryNanoapps(int32_t in_contextHubId) {
    }
}

ScopedAStatus ContextHub::getPreloadedNanoappIds(std::vector<int64_t>* out_preloadedNanoappIds) {
    if (out_preloadedNanoappIds == nullptr) {
        return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
    }

    for (uint64_t i = 0; i < 10; ++i) {
        out_preloadedNanoappIds->push_back(i);
    }
    return ndk::ScopedAStatus::ok();
}

ScopedAStatus ContextHub::registerCallback(int32_t in_contextHubId,
                                           const std::shared_ptr<IContextHubCallback>& in_cb) {
    if (in_contextHubId == kMockHubId) {
Loading