Merge "Remove redundant prefixes from enums in audio common types and effects HAL"
diff --git a/Android.bp b/Android.bp
index 7ba06ad..65febd3 100644
--- a/Android.bp
+++ b/Android.bp
@@ -3,8 +3,13 @@
"audio/common/2.0",
"audio/effect/2.0",
"benchmarks/msgq/1.0",
+ "memtrack/1.0",
+ "memtrack/1.0/default",
"nfc/1.0",
"nfc/1.0/default",
+ "radio/1.0",
+ "power/1.0",
+ "power/1.0/default",
"tests/bar/1.0",
"tests/baz/1.0",
"tests/expression/1.0",
diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp
new file mode 100644
index 0000000..3696aea
--- /dev/null
+++ b/memtrack/1.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.memtrack@1.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.memtrack@1.0",
+ srcs: [
+ "types.hal",
+ "IMemtrack.hal",
+ ],
+ out: [
+ "android/hardware/memtrack/1.0/types.cpp",
+ "android/hardware/memtrack/1.0/MemtrackAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.memtrack@1.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.memtrack@1.0",
+ srcs: [
+ "types.hal",
+ "IMemtrack.hal",
+ ],
+ out: [
+ "android/hardware/memtrack/1.0/types.h",
+ "android/hardware/memtrack/1.0/IMemtrack.h",
+ "android/hardware/memtrack/1.0/IHwMemtrack.h",
+ "android/hardware/memtrack/1.0/BnMemtrack.h",
+ "android/hardware/memtrack/1.0/BpMemtrack.h",
+ "android/hardware/memtrack/1.0/BsMemtrack.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.memtrack@1.0",
+ generated_sources: ["android.hardware.memtrack@1.0_genc++"],
+ generated_headers: ["android.hardware.memtrack@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.memtrack@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/memtrack/1.0/Android.mk b/memtrack/1.0/Android.mk
new file mode 100644
index 0000000..4abe505
--- /dev/null
+++ b/memtrack/1.0/Android.mk
@@ -0,0 +1,204 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.memtrack@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (MemtrackFlag)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackFlag.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::types.MemtrackFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackRecord)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::types.MemtrackRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackStatus)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::types.MemtrackStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackType)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::types.MemtrackType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IMemtrack.hal
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/IMemtrack.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IMemtrack.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::IMemtrack
+
+$(GEN): $(LOCAL_PATH)/IMemtrack.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.memtrack@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (MemtrackFlag)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackFlag.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::types.MemtrackFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackRecord)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::types.MemtrackRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackStatus)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::types.MemtrackStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackType)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::types.MemtrackType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IMemtrack.hal
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/IMemtrack.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IMemtrack.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.memtrack@1.0::IMemtrack
+
+$(GEN): $(LOCAL_PATH)/IMemtrack.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/memtrack/1.0/IMemtrack.hal b/memtrack/1.0/IMemtrack.hal
new file mode 100644
index 0000000..064f2fe
--- /dev/null
+++ b/memtrack/1.0/IMemtrack.hal
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2016 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.memtrack@1.0;
+
+/*
+ * The Memory Tracker HAL is designed to return information about
+ * device-specific memory usage.
+ * The primary goal is to be able to track memory that is not
+ * trackable in any other way, for example texture memory that is allocated by
+ * a process, but not mapped in to that process's address space.
+ * A secondary goal is to be able to categorize memory used by a process into
+ * GL, graphics, etc. All memory sizes must be in real memory usage,
+ * accounting for stride, bit depth, rounding up to page size, etc.
+ *
+ * Constructor for the interface should be used to perform memtrack management
+ * setup actions and is called once before any calls to getMemory().
+ */
+interface IMemtrack {
+ /*
+ * getMemory() populates MemtrackRecord vector with the sizes of memory
+ * plus associated flags for that memory.
+ *
+ * This function must be thread-safe, it may get called from multiple
+ * threads at the same time.
+ *
+ * A process collecting memory statistics will call getMemory for each
+ * combination of pid and memory type. For each memory type that it
+ * recognizes, the HAL must fill out an array of memtrack_record
+ * structures breaking down the statistics of that memory type as much as
+ * possible. For example,
+ * getMemory(<pid>, GL) might return:
+ * { { 4096, ACCOUNTED | PRIVATE | SYSTEM },
+ * { 40960, UNACCOUNTED | PRIVATE | SYSTEM },
+ * { 8192, ACCOUNTED | PRIVATE | DEDICATED },
+ * { 8192, UNACCOUNTED | PRIVATE | DEDICATED } }
+ * If the HAL cannot differentiate between SYSTEM and DEDICATED memory, it
+ * could return:
+ * { { 12288, ACCOUNTED | PRIVATE },
+ * { 49152, UNACCOUNTED | PRIVATE } }
+ *
+ * Memory must not overlap between types. For example, a graphics buffer
+ * that has been mapped into the GPU as a surface must show up when
+ * GRAPHICS is requested and not when GL
+ * is requested.
+ *
+ * @param pid process for which memory infromation is requested
+ * @param type memory type that information is being requested about
+ * @return records vector of MemtrackRecord containing memory information
+ * @return retval SUCCESS on success, TYPE_NOT_FOUND if the type is not
+ * supported.
+ */
+ getMemory(int32_t pid, MemtrackType type)
+ generates (MemtrackStatus retval, vec<MemtrackRecord> records);
+};
diff --git a/memtrack/1.0/default/Android.bp b/memtrack/1.0/default/Android.bp
new file mode 100644
index 0000000..c6ab6b9
--- /dev/null
+++ b/memtrack/1.0/default/Android.bp
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 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.
+
+cc_library_shared {
+ name: "android.hardware.memtrack@1.0-impl",
+ relative_install_path: "hw",
+ srcs: ["Memtrack.cpp"],
+
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libhidl",
+ "libhardware",
+ "libhwbinder",
+ "libutils",
+ "android.hardware.memtrack@1.0",
+ ],
+
+}
+
+cc_binary {
+ relative_install_path: "hw",
+ name: "android.hardware.memtrack@1.0-service",
+ srcs: ["service.cpp"],
+
+ shared_libs: [
+ "liblog",
+ "libbase",
+ "libdl",
+ "libutils",
+ "libhardware",
+ "libhidl",
+ "libhwbinder",
+ "android.hardware.memtrack@1.0",
+ ],
+
+}
diff --git a/memtrack/1.0/default/Memtrack.cpp b/memtrack/1.0/default/Memtrack.cpp
new file mode 100644
index 0000000..b953e7c
--- /dev/null
+++ b/memtrack/1.0/default/Memtrack.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "android.hardware.memtrack@1.0-impl"
+#include <hardware/hardware.h>
+#include <hardware/memtrack.h>
+
+#include "Memtrack.h"
+namespace android {
+namespace hardware {
+namespace memtrack {
+namespace V1_0 {
+namespace implementation {
+
+Memtrack::Memtrack(memtrack_module_t *module) : mModule(module) {
+ if (mModule)
+ mModule->init(mModule);
+}
+
+Memtrack::~Memtrack() {
+ delete(mModule);
+}
+
+Return<void> Memtrack::getMemory(int32_t pid, MemtrackType type,
+ getMemory_cb _hidl_cb) {
+ hidl_vec<MemtrackRecord> records;
+ size_t temp = 0;
+ size_t *size = &temp;
+ int ret = 0;
+
+ if (mModule->getMemory == nullptr)
+ {
+ _hidl_cb(MemtrackStatus::SUCCESS, records);
+ return Void();
+ }
+ ret = mModule->getMemory(mModule, pid, static_cast<memtrack_type>(type),
+ NULL, size);
+ if (ret == 0)
+ {
+ memtrack_record *legacy_records = new memtrack_record[*size];
+ ret = mModule->getMemory(mModule, pid,
+ static_cast<memtrack_type>(type), legacy_records, size);
+ if (ret == 0)
+ {
+ records.resize(*size);
+ for(size_t i = 0; i < *size; i++)
+ {
+ records[i].sizeInBytes = legacy_records[i].size_in_bytes;
+ records[i].flags = legacy_records[i].flags;
+ }
+ }
+ delete[] legacy_records;
+ }
+ _hidl_cb(MemtrackStatus::SUCCESS, records);
+ return Void();
+}
+
+
+IMemtrack* HIDL_FETCH_IMemtrack(const char* name) {
+ int ret = 0;
+ const hw_module_t* hw_module = NULL;
+ memtrack_module_t *memtrack_module = NULL;
+
+ ret = hw_get_module(name, &hw_module);
+ if (ret == 0 && hw_module->methods->open > 0)
+ {
+ ret = hw_module->methods->open(hw_module, name,
+ reinterpret_cast<hw_device_t**>(&memtrack_module));
+ if (ret == 0)
+ return new Memtrack(memtrack_module);
+ else {
+ ALOGE("Passthrough failed to load legacy HAL.");
+ }
+ }
+ else {
+ ALOGE ("hw_get_module %s failed: %d", name, ret);
+ }
+ return nullptr;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace memtrack
+} // namespace hardware
+} // namespace android
diff --git a/memtrack/1.0/default/Memtrack.h b/memtrack/1.0/default/Memtrack.h
new file mode 100644
index 0000000..86dae72
--- /dev/null
+++ b/memtrack/1.0/default/Memtrack.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2016 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 HIDL_GENERATED_android_hardware_memtrack_V1_0_Memtrack_H_
+#define HIDL_GENERATED_android_hardware_memtrack_V1_0_Memtrack_H_
+
+#include <android/hardware/memtrack/1.0/IMemtrack.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace memtrack {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::memtrack::V1_0::IMemtrack;
+using ::android::hardware::memtrack::V1_0::MemtrackRecord;
+using ::android::hardware::memtrack::V1_0::MemtrackStatus;
+using ::android::hardware::memtrack::V1_0::MemtrackType;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Memtrack : public IMemtrack {
+ Memtrack(memtrack_module_t* module);
+ ~Memtrack();
+ Return<void> getMemory(int32_t pid, MemtrackType type, getMemory_cb _hidl_cb) override;
+
+ private:
+ memtrack_module_t* mModule;
+};
+
+extern "C" IMemtrack* HIDL_FETCH_IMemtrack(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace memtrack
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_memtrack_V1_0_Memtrack_H_
diff --git a/memtrack/1.0/default/service.cpp b/memtrack/1.0/default/service.cpp
new file mode 100644
index 0000000..63ac695
--- /dev/null
+++ b/memtrack/1.0/default/service.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "android.hardware.memtrack@1.0-service"
+#include <utils/Log.h>
+
+#include <iostream>
+#include <unistd.h>
+
+#include <android/hardware/memtrack/1.0/IMemtrack.h>
+
+#include <hidl/IServiceManager.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/Errors.h>
+#include <utils/StrongPointer.h>
+
+using android::sp;
+
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+
+using android::hardware::memtrack::V1_0::IMemtrack;
+
+int main() {
+ const char instance[] = "memtrack";
+ android::sp<IMemtrack> service = IMemtrack::getService(instance, true);
+ if (service.get() == nullptr) {
+ ALOGE("IMemtrack::getService returned NULL, exiting");
+ return -1;
+ }
+ LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
+ service->registerAsService(instance);
+
+ ProcessState::self()->setThreadPoolMaxThreadCount(0);
+ ProcessState::self()->startThreadPool();
+ IPCThreadState::self()->joinThreadPool();
+}
diff --git a/memtrack/1.0/types.hal b/memtrack/1.0/types.hal
new file mode 100644
index 0000000..3d702b3
--- /dev/null
+++ b/memtrack/1.0/types.hal
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2016 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.memtrack@1.0;
+
+/*
+ * SMAPS_ACCOUNTED/SMAPS_UNACCOUNTED
+ * Flags to differentiate memory that can already be accounted for in
+ * /proc/<pid>/smaps,
+ * (Shared_Clean + Shared_Dirty + Private_Clean + Private_Dirty = Size).
+ * In general, memory mapped in to a userspace process is accounted unless
+ * it was mapped with remap_pfn_range.
+ * Exactly one of these must be set.
+ *
+ * SHARED/SHARED_PSS/PRIVATE
+ * Flags to differentiate memory shared across multiple processes vs. memory
+ * used by a single process.
+ * If SHARED_PSS flags is used, the memory must be divided by the number of
+ * processes holding reference to it (shared / num_processes).
+ * Only zero or one of these may be set in a record.
+ * If none are set, record is assumed to count shared + private memory.
+ *
+ * SYSTEM/DEDICATED
+ * Flags to differentiate memory taken from the kernel's allocation pool vs.
+ * memory that is dedicated to non-kernel allocations, for example a carveout
+ * or separate video memory. Only zero or one of these may be set in a record.
+ * If none are set, record is assumed to count system + dedicated memory.
+ *
+ * NONSECURE/SECURE
+ * Flags to differentiate memory accessible by the CPU in non-secure mode vs.
+ * memory that is protected. Only zero or one of these may be set in a record.
+ * If none are set, record is assumed to count secure + nonsecure memory.
+ */
+enum MemtrackFlag : uint32_t {
+ SMAPS_ACCOUNTED = 1 << 1,
+ SMAPS_UNACCOUNTED = 1 << 2,
+ SHARED = 1 << 3,
+ SHARED_PSS = 1 << 4,
+ PRIVATE = 1 << 5,
+ SYSTEM = 1 << 6,
+ DEDICATED = 1 << 7,
+ NONSECURE = 1 << 8,
+ SECURE = 1 << 9,
+};
+
+/* Tags which define the usage of the memory buffers. */
+enum MemtrackType : uint32_t {
+ OTHER = 0,
+ GL = 1,
+ GRAPHICS = 2,
+ MULTIMEDIA = 3,
+ CAMERA = 4,
+ NUM_TYPES,
+};
+
+enum MemtrackStatus : uint32_t {
+ SUCCESS = 0,
+ MEMORY_TRACKING_NOT_SUPPORTED = 1,
+ TYPE_NOT_SUPPORTED = 2,
+};
+
+/* A vector of MemtrackRecord is returned by the function getMemory().
+ * Each record consists of the size of the memory used by the process and
+ * flags indicate the all the MemtrackFlag that are valid for this record.
+ * see getMemory() comments for further details.
+ */
+struct MemtrackRecord {
+ uint64_t sizeInBytes;
+ /*
+ * This is the bitfield for the MemtrackFlag indicating all the flags that
+ * are valid for this record.
+ */
+ uint32_t flags;
+};
diff --git a/nfc/1.0/vts/Android.mk b/nfc/1.0/vts/Android.mk
new file mode 100644
index 0000000..15084fc
--- /dev/null
+++ b/nfc/1.0/vts/Android.mk
@@ -0,0 +1,79 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# build profiler for Nfc.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_profiler_hidl_nfc@1.0
+
+LOCAL_SRC_FILES := \
+ Nfc.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES += \
+ test/vts/drivers/libprofiling \
+
+LOCAL_VTS_MODE := PROFILER
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.nfc@1.0 \
+ libbase \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_multidevice_proto \
+ libvts_profiling \
+ libutils \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+include $(BUILD_SHARED_LIBRARY)
+
+# build profiler for NfcClientCallback.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_profiler_hidl_nfc_client_callback_@1.0
+
+LOCAL_SRC_FILES := \
+ NfcClientCallback.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES += \
+ test/vts/drivers/libprofiling \
+
+LOCAL_VTS_MODE := PROFILER
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.nfc@1.0 \
+ libbase \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_multidevice_proto \
+ libvts_profiling \
+ libutils \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/nfc/1.0/vts/Nfc.vts b/nfc/1.0/vts/Nfc.vts
new file mode 100644
index 0000000..8b3330f
--- /dev/null
+++ b/nfc/1.0/vts/Nfc.vts
@@ -0,0 +1,83 @@
+component_class: HAL_HIDL
+component_type: NFC
+component_type_version: 1.0
+component_name: "INfc"
+
+package: "android.hardware.nfc"
+
+import: "android.hardware.nfc@1.0::INfcClientCallback"
+import: "android.hardware.nfc@1.0::types"
+
+interface: {
+ api: {
+ name: "open"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_HIDL_CALLBACK
+ predefined_type: "INfcClientCallback"
+ is_callback: true
+ }
+ }
+
+ api: {
+ name: "write"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_STRUCT
+ predefined_type: "nfc_data_t"
+ }
+ }
+
+ api: {
+ name: "core_initialized"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_SCALAR
+ scalar_type: "uint8_t"
+ }
+ }
+ }
+
+ api: {
+ name: "pre_discover"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+
+ api: {
+ name: "close"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+
+ api: {
+ name: "control_granted"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+
+ api: {
+ name: "power_cycle"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+}
diff --git a/nfc/1.0/vts/NfcClientCallback.vts b/nfc/1.0/vts/NfcClientCallback.vts
new file mode 100644
index 0000000..aab8c27
--- /dev/null
+++ b/nfc/1.0/vts/NfcClientCallback.vts
@@ -0,0 +1,31 @@
+component_class: HAL_HIDL
+component_type: NFC
+component_type_version: 1.0
+component_name: "INfcClientCallback"
+
+package: "android.hardware.nfc"
+
+import: "android.hardware.nfc@1.0::types"
+
+interface: {
+ api: {
+ name: "sendEvent"
+ arg: {
+ type: TYPE_ENUM
+ predefined_type: "nfc_event_t"
+ }
+ arg: {
+ type: TYPE_ENUM
+ predefined_type: "nfc_status_t"
+ }
+ }
+
+ api: {
+ name: "sendData"
+ arg: {
+ type: TYPE_STRUCT
+ predefined_type: "nfc_data_t"
+ is_const: true
+ }
+ }
+}
diff --git a/nfc/1.0/vts/types.vts b/nfc/1.0/vts/types.vts
new file mode 100644
index 0000000..fb1d414
--- /dev/null
+++ b/nfc/1.0/vts/types.vts
@@ -0,0 +1,87 @@
+component_class: HAL_HIDL
+component_type: NFC
+component_type_version: 1.0
+component_name: "types"
+
+package: "android.hardware.nfc"
+
+
+attribute: {
+ name: "nfc_event_t"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "HAL_NFC_OPEN_CPLT_EVT"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "HAL_NFC_CLOSE_CPLT_EVT"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "HAL_NFC_POST_INIT_CPLT_EVT"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "HAL_NFC_PRE_DISCOVER_CPLT_EVT"
+ scalar_value: {
+ uint32_t: 3
+ }
+ enumerator: "HAL_NFC_REQUEST_CONTROL_EVT"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "HAL_NFC_RELEASE_CONTROL_EVT"
+ scalar_value: {
+ uint32_t: 5
+ }
+ enumerator: "HAL_NFC_ERROR_EVT"
+ scalar_value: {
+ uint32_t: 6
+ }
+ }
+}
+
+attribute: {
+ name: "nfc_status_t"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "HAL_NFC_STATUS_OK"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "HAL_NFC_STATUS_FAILED"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "HAL_NFC_STATUS_ERR_TRANSPORT"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "HAL_NFC_STATUS_ERR_CMD_TIMEOUT"
+ scalar_value: {
+ uint32_t: 3
+ }
+ enumerator: "HAL_NFC_STATUS_REFUSED"
+ scalar_value: {
+ uint32_t: 4
+ }
+ }
+}
+
+attribute: {
+ name: "nfc_data_t"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "data"
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_SCALAR
+ scalar_type: "uint8_t"
+ }
+ }
+}
+
diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp
new file mode 100644
index 0000000..9b4d81e
--- /dev/null
+++ b/power/1.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.power@1.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.power@1.0",
+ srcs: [
+ "types.hal",
+ "IPower.hal",
+ ],
+ out: [
+ "android/hardware/power/1.0/types.cpp",
+ "android/hardware/power/1.0/PowerAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.power@1.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.power@1.0",
+ srcs: [
+ "types.hal",
+ "IPower.hal",
+ ],
+ out: [
+ "android/hardware/power/1.0/types.h",
+ "android/hardware/power/1.0/IPower.h",
+ "android/hardware/power/1.0/IHwPower.h",
+ "android/hardware/power/1.0/BnPower.h",
+ "android/hardware/power/1.0/BpPower.h",
+ "android/hardware/power/1.0/BsPower.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.power@1.0",
+ generated_sources: ["android.hardware.power@1.0_genc++"],
+ generated_headers: ["android.hardware.power@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.power@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/power/1.0/Android.mk b/power/1.0/Android.mk
new file mode 100644
index 0000000..5f1260b
--- /dev/null
+++ b/power/1.0/Android.mk
@@ -0,0 +1,238 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.power@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (Feature)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/Feature.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.Feature
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerHint)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerHint.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.PowerHint
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerStatePlatformSleepState)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerStatePlatformSleepState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.PowerStatePlatformSleepState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerStateVoter)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerStateVoter.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.PowerStateVoter
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Status)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/Status.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IPower.hal
+#
+GEN := $(intermediates)/android/hardware/power/1.0/IPower.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IPower.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::IPower
+
+$(GEN): $(LOCAL_PATH)/IPower.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.power@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (Feature)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/Feature.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.Feature
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerHint)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerHint.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.PowerHint
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerStatePlatformSleepState)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerStatePlatformSleepState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.PowerStatePlatformSleepState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerStateVoter)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerStateVoter.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.PowerStateVoter
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Status)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/Status.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IPower.hal
+#
+GEN := $(intermediates)/android/hardware/power/1.0/IPower.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IPower.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.power@1.0::IPower
+
+$(GEN): $(LOCAL_PATH)/IPower.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/power/1.0/IPower.hal b/power/1.0/IPower.hal
new file mode 100644
index 0000000..6cba42a
--- /dev/null
+++ b/power/1.0/IPower.hal
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2016 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.power@1.0;
+
+/*
+ * Constructor for the interface performs power management setup actions at
+ * runtime startup, such as to set default cpufreq parameters.
+ */
+interface IPower {
+ /*
+ * setInteractive() performs power management actions upon the
+ * system entering interactive state (that is, the system is awake
+ * and ready for interaction, often with UI devices such as
+ * display and touchscreen enabled) or non-interactive state (the
+ * system appears asleep, display usually turned off). The
+ * non-interactive state may be entered after a period of
+ * inactivity in order to conserve battery power during
+ * such inactive periods.
+ *
+ * Typical actions are to turn on or off devices and adjust
+ * cpufreq parameters. This function may also call the
+ * appropriate interfaces to allow the kernel to suspend the
+ * system to low-power sleep state when entering non-interactive
+ * state, and to disallow low-power suspend when the system is in
+ * interactive state. When low-power suspend state is allowed, the
+ * kernel may suspend the system whenever no wakelocks are held.
+ *
+ * For example,
+ * This function can be called to enter non-interactive state after
+ * turning off the screen (if present) and called to enter
+ * interactive state prior to turning on the screen.
+ *
+ * @param interactive is true when the system is transitioning to an
+ * interactive state and false when transitioning to a
+ * non-interactive state.
+ */
+ setInteractive(bool interactive);
+
+ /*
+ * powerHint() is called to pass hints on power requirements which
+ * may result in adjustment of power/performance parameters of the
+ * cpufreq governor and other controls.
+ *
+ * A particular platform may choose to ignore any hint.
+ *
+ * @param hint PowerHint which is passed
+ * @param data contains additional information about the hint
+ * and is described along with the comments for each of the hints.
+ */
+ powerHint(PowerHint hint, int32_t data);
+
+ /*
+ * setFeature() is called to turn on or off a particular feature
+ * depending on the state parameter.
+ *
+ * @param feature Feature which needs to be set
+ * @param activate true/false to enable/disable the feature
+ */
+ setFeature(Feature feature, bool activate);
+
+ /*
+ * Platform-level sleep state stats:
+ * Report cumulative info on the statistics on platform-level sleep states
+ * since boot.
+ *
+ * Higher the index in the returned <states> vector deeper the state is
+ * i.e. lesser steady-state power is consumed by the platform to be
+ * resident in that state.
+ *
+ * @return states of power states the device supports
+ * @return retval SUCCESS on success or FILESYSTEM_ERROR on filesystem
+ * nodes access error.
+ */
+ getPlatformLowPowerStats()
+ generates (vec<PowerStatePlatformSleepState> states, Status retval);
+};
diff --git a/power/1.0/default/Android.bp b/power/1.0/default/Android.bp
new file mode 100644
index 0000000..4c31c6f
--- /dev/null
+++ b/power/1.0/default/Android.bp
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 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.
+
+cc_library_shared {
+ name: "android.hardware.power@1.0-impl",
+ relative_install_path: "hw",
+ srcs: ["Power.cpp"],
+
+ shared_libs: [
+ "liblog",
+ "libhardware",
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "android.hardware.power@1.0",
+ ],
+
+}
+
+cc_binary {
+ relative_install_path: "hw",
+ name: "android.hardware.power@1.0-service",
+ srcs: ["service.cpp"],
+
+ shared_libs: [
+ "liblog",
+ "libdl",
+ "libutils",
+ "libhardware",
+ "libhidl",
+ "libhwbinder",
+ "android.hardware.power@1.0",
+ ],
+
+}
diff --git a/power/1.0/default/Power.cpp b/power/1.0/default/Power.cpp
new file mode 100644
index 0000000..5d0593b
--- /dev/null
+++ b/power/1.0/default/Power.cpp
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "android.hardware.power@1.0-impl"
+#include <hardware/hardware.h>
+#include <hardware/power.h>
+#include "Power.h"
+
+namespace android {
+namespace hardware {
+namespace power {
+namespace V1_0 {
+namespace implementation {
+
+Power::Power(power_module_t *module) : mModule(module) {
+ if (mModule)
+ mModule->init(mModule);
+}
+
+Power::~Power() {
+ delete(mModule);
+}
+
+// Methods from ::android::hardware::power::V1_0::IPower follow.
+Return<void> Power::setInteractive(bool interactive) {
+ if (mModule->setInteractive > 0)
+ mModule->setInteractive(mModule, interactive ? 1 : 0);
+ return Void();
+}
+
+Return<void> Power::powerHint(PowerHint hint, int32_t data) {
+ int32_t param = data;
+ if (mModule->powerHint > 0)
+ mModule->powerHint(mModule, static_cast<power_hint_t>(hint), ¶m);
+ return Void();
+}
+
+Return<void> Power::setFeature(Feature feature, bool activate) {
+ if (mModule->setFeature > 0)
+ mModule->setFeature(mModule, static_cast<feature_t>(feature),
+ activate ? 1 : 0);
+ return Void();
+}
+
+Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
+ hidl_vec<PowerStatePlatformSleepState> states;
+ ssize_t number_platform_modes;
+ size_t *voters = nullptr;
+ power_state_platform_sleep_state_t *legacy_states = nullptr;
+ int ret;
+
+ if (mModule->get_number_of_platform_modes == nullptr ||
+ mModule->get_voter_list == nullptr ||
+ mModule->get_platform_low_power_stats == nullptr)
+ {
+ _hidl_cb(states, Status::SUCCESS);
+ return Void();
+ }
+
+ number_platform_modes = mModule->get_number_of_platform_modes(mModule);
+ if (number_platform_modes > 0)
+ {
+ voters = new size_t [number_platform_modes];
+ if (voters == nullptr)
+ goto done;
+
+ ret = mModule->get_voter_list(mModule, voters);
+ if (ret != 0)
+ goto done;
+
+ legacy_states = new power_state_platform_sleep_state_t [number_platform_modes];
+ if (legacy_states == nullptr)
+ goto done;
+
+ for (int i = 0; i < number_platform_modes; i++)
+ {
+ legacy_states[i].voters = nullptr;
+ legacy_states[i].voters = new power_state_voter_t [voters[i]];
+ if (legacy_states[i].voters == nullptr)
+ goto done;
+ }
+
+ ret = mModule->get_platform_low_power_stats(mModule, legacy_states);
+ if (ret != 0)
+ goto done;
+
+ states.resize(number_platform_modes);
+ for (int i = 0; i < number_platform_modes; i++)
+ {
+ power_state_platform_sleep_state_t& legacy_state = legacy_states[i];
+ PowerStatePlatformSleepState& state = states[i];
+ state.name = legacy_state.name;
+ state.residencyInMsecSinceBoot = legacy_state.residency_in_msec_since_boot;
+ state.totalTransitions = legacy_state.total_transitions;
+ state.supportedOnlyInSuspend = legacy_state.supported_only_in_suspend;
+ state.voters.resize(voters[i]);
+ for(size_t j = 0; j < voters[i]; j++)
+ {
+ state.voters[j].name = legacy_state.voters[j].name;
+ state.voters[j].totalTimeInMsecVotedForSinceBoot = legacy_state.voters[j].total_time_in_msec_voted_for_since_boot;
+ state.voters[j].totalNumberOfTimesVotedSinceBoot = legacy_state.voters[j].total_number_of_times_voted_since_boot;
+ }
+ }
+ }
+done:
+ if (legacy_states)
+ {
+ for (int i = 0; i < number_platform_modes; i++)
+ {
+ if(legacy_states[i].voters)
+ delete(legacy_states[i].voters);
+ }
+ }
+ delete[] legacy_states;
+ delete[] voters;
+ _hidl_cb(states, Status::SUCCESS);
+ return Void();
+}
+
+IPower* HIDL_FETCH_IPower(const char* name) {
+ int ret = 0;
+ const hw_module_t* hw_module = NULL;
+ power_module_t *power_module;
+ ret = hw_get_module(name, &hw_module);
+ if (ret == 0 && hw_module->methods->open > 0) {
+ ret = hw_module->methods->open(hw_module, name,
+ reinterpret_cast<hw_device_t**>(&power_module));
+ if (ret == 0) {
+ return new Power(power_module);
+ }
+ else {
+ ALOGE("Passthrough failed to load legacy HAL.");
+ return nullptr;
+ }
+ }
+ else {
+ ALOGE ("hw_get_module %s failed: %d", name, ret);
+ return nullptr;
+ }
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace power
+} // namespace hardware
+} // namespace android
diff --git a/power/1.0/default/Power.h b/power/1.0/default/Power.h
new file mode 100644
index 0000000..a0495be
--- /dev/null
+++ b/power/1.0/default/Power.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2016 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 HIDL_GENERATED_android_hardware_power_V1_0_Power_H_
+#define HIDL_GENERATED_android_hardware_power_V1_0_Power_H_
+
+#include <android/hardware/power/1.0/IPower.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace power {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::power::V1_0::Feature;
+using ::android::hardware::power::V1_0::IPower;
+using ::android::hardware::power::V1_0::PowerHint;
+using ::android::hardware::power::V1_0::PowerStatePlatformSleepState;
+using ::android::hardware::power::V1_0::Status;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Power : public IPower {
+ Power(power_module_t* module);
+ ~Power();
+ Return<void> setInteractive(bool interactive) override;
+ Return<void> powerHint(PowerHint hint, int32_t data) override;
+ Return<void> setFeature(Feature feature, bool activate) override;
+ Return<void> getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override;
+
+ private:
+ power_module_t* mModule;
+};
+
+extern "C" IPower* HIDL_FETCH_IPower(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace power
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_power_V1_0_Power_H_
diff --git a/power/1.0/default/service.cpp b/power/1.0/default/service.cpp
new file mode 100644
index 0000000..bad1adf
--- /dev/null
+++ b/power/1.0/default/service.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "android.hardware.power@1.0-service"
+#include <utils/Log.h>
+
+#include <iostream>
+#include <unistd.h>
+
+#include <android/hardware/power/1.0/IPower.h>
+
+#include <hidl/IServiceManager.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/Errors.h>
+#include <utils/StrongPointer.h>
+
+using android::sp;
+
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+
+using android::hardware::power::V1_0::IPower;
+
+int main() {
+ const char instance[] = "power";
+ android::sp<IPower> service = IPower::getService(instance, true);
+ if (service.get() == nullptr) {
+ ALOGE("IPower::getService returned NULL, exiting");
+ return -1;
+ }
+ LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
+ service->registerAsService(instance);
+
+ ProcessState::self()->setThreadPoolMaxThreadCount(0);
+ ProcessState::self()->startThreadPool();
+ IPCThreadState::self()->joinThreadPool();
+}
diff --git a/power/1.0/types.hal b/power/1.0/types.hal
new file mode 100644
index 0000000..c27242e
--- /dev/null
+++ b/power/1.0/types.hal
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2016 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.power@1.0;
+
+/* Power hint identifiers passed to powerHint() */
+enum PowerHint : uint32_t {
+ /*
+ * Foreground app has started or stopped requesting a VSYNC pulse
+ * from SurfaceFlinger. If the app has started requesting VSYNC
+ * then CPU and GPU load is expected soon, and it may be appropriate
+ * to raise speeds of CPU, memory bus, etc. The data parameter is
+ * non-zero to indicate VSYNC pulse is now requested, or zero for
+ * VSYNC pulse no longer requested.
+ */
+ VSYNC = 0x00000001,
+
+
+ /*
+ * User is interacting with the device, for example, touchscreen
+ * events are incoming. CPU and GPU load may be expected soon,
+ * and it may be appropriate to raise speeds of CPU, memory bus,
+ * etc. The data parameter is the estimated length of the interaction
+ * in milliseconds, or 0 if unknown.
+ */
+ INTERACTION = 0x00000002,
+
+
+ /* DO NOT USE VIDEO_ENCODE/_DECODE! They will be removed in
+ * KLP.
+ */
+ VIDEO_ENCODE = 0x00000003,
+ VIDEO_DECODE = 0x00000004,
+
+ /*
+ * Low power mode is activated or deactivated. Low power mode
+ * is intended to save battery at the cost of performance. The data
+ * parameter is non-zero when low power mode is activated, and zero
+ * when deactivated.
+ */
+ LOW_POWER = 0x00000005,
+
+ /*
+ * Sustained Performance mode is actived or deactivated. Sustained
+ * performance mode is intended to provide a consistent level of
+ * performance for a prolonged amount of time. The data parameter is
+ * non-zero when sustained performance mode is activated, and zero
+ * when deactivated.
+ */
+ SUSTAINED_PERFORMANCE = 0x00000006,
+
+ /*
+ * VR Mode is activated or deactivated. VR mode is intended to
+ * provide minimum guarantee for performance for the amount of time the
+ * device can sustain it. The data parameter is non-zero when the mode
+ * is activated and zero when deactivated.
+ */
+ VR_MODE = 0x00000007,
+
+ /*
+ * This hint indicates that an application has been launched. Can be used
+ * for device specific optimizations during application launch. The data
+ * parameter is non-zero when the application starts to launch and zero when
+ * it has been launched.
+ */
+ LAUNCH = 0x00000008,
+
+ /*
+ * When device enters some special modes, e.g. theater mode in Android
+ * Wear, there is no touch interaction expected between device and user.
+ * Touch controller could be disabled in those modes to save power.
+ * The data parameter is non-zero when touch could be disabled, and zero
+ * when touch needs to be re-enabled.
+ */
+ DISABLE_TOUCH = 0x00000009
+};
+
+enum Feature : uint32_t {
+ /*
+ * Enabling/Disabling this feature will allow/disallow the system
+ * to wake up by tapping the screen twice.
+ */
+ POWER_FEATURE_DOUBLE_TAP_TO_WAKE = 0x00000001
+};
+
+enum Status : uint32_t {
+ SUCCESS = 0,
+ FILESYSTEM_ERROR = 1
+};
+/*
+ * Platform-level sleep state stats:
+ * PowerStateVoter struct is useful for describing the individual voters
+ * when a Platform-level sleep state is chosen by aggregation of votes from
+ * multiple clients/system conditions.
+ *
+ * This helps in attirbuting what in the device is blocking the device from
+ * entering the lowest Platform-level sleep state.
+ */
+struct PowerStateVoter {
+ /*
+ * Name of the voter.
+ */
+ string name;
+
+ /*
+ * Total time in msec the voter voted for the platform sleep state since
+ * boot.
+ */
+ uint64_t totalTimeInMsecVotedForSinceBoot;
+
+ /*
+ * Number of times the voter voted for the platform sleep state since boot.
+ */
+ uint64_t totalNumberOfTimesVotedSinceBoot;
+};
+
+/*
+ * Platform-level sleep state stats:
+ * PowerStatePlatformSleepState represents the Platform-level sleep state
+ * the device is capable of getting into.
+ *
+ * SoCs usually have more than one Platform-level sleep state.
+ */
+struct PowerStatePlatformSleepState {
+ /*
+ * Platform-level Sleep state name.
+ */
+ string name;
+
+ /*
+ * Time spent in msec at this platform-level sleep state since boot.
+ */
+ uint64_t residencyInMsecSinceBoot;
+
+ /*
+ * Total number of times system entered this state.
+ */
+ uint64_t totalTransitions;
+
+ /*
+ * This platform-level sleep state can only be reached during system suspend
+ */
+ bool supportedOnlyInSuspend;
+
+ /*
+ * voters is useful if the Platform-level sleep state
+ * is chosen by aggregation votes from multiple clients/system conditions.
+ * All the voters have to say yes or all the system conditions need to be
+ * met to enter a platform-level sleep state.
+ *
+ * Vector of size zero implies either the info is not available
+ * or the system does not follow a voting mechanism to choose this
+ * Platform-level sleep state.
+ */
+ vec<PowerStateVoter> voters;
+};
diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp
new file mode 100644
index 0000000..682e12c
--- /dev/null
+++ b/radio/1.0/Android.bp
@@ -0,0 +1,54 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.radio@1.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.radio@1.0",
+ srcs: [
+ "types.hal",
+ "IRadio.hal",
+ "IRadioCallback.hal",
+ ],
+ out: [
+ "android/hardware/radio/1.0/types.cpp",
+ "android/hardware/radio/1.0/RadioAll.cpp",
+ "android/hardware/radio/1.0/RadioCallbackAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.radio@1.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.radio@1.0",
+ srcs: [
+ "types.hal",
+ "IRadio.hal",
+ "IRadioCallback.hal",
+ ],
+ out: [
+ "android/hardware/radio/1.0/types.h",
+ "android/hardware/radio/1.0/IRadio.h",
+ "android/hardware/radio/1.0/IHwRadio.h",
+ "android/hardware/radio/1.0/BnRadio.h",
+ "android/hardware/radio/1.0/BpRadio.h",
+ "android/hardware/radio/1.0/BsRadio.h",
+ "android/hardware/radio/1.0/IRadioCallback.h",
+ "android/hardware/radio/1.0/IHwRadioCallback.h",
+ "android/hardware/radio/1.0/BnRadioCallback.h",
+ "android/hardware/radio/1.0/BpRadioCallback.h",
+ "android/hardware/radio/1.0/BsRadioCallback.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.radio@1.0",
+ generated_sources: ["android.hardware.radio@1.0_genc++"],
+ generated_headers: ["android.hardware.radio@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.radio@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/radio/1.0/Android.mk b/radio/1.0/Android.mk
new file mode 100644
index 0000000..b8365bf
--- /dev/null
+++ b/radio/1.0/Android.mk
@@ -0,0 +1,480 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.radio@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (RadioAppState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioAppState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioAppState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioAppStatus)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioAppStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioAppStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioAppType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioAppType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioAppType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioCardState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioCardState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioCardState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioCardStatus)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioCardStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioCardStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioCdmaSmsConst)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioCdmaSmsConst.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioCdmaSmsConst
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioConst)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioConst.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioConst
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioPersoSubstate)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioPersoSubstate.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioPersoSubstate
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioPinState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioPinState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioPinState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioRestrictedState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioRestrictedState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioRestrictedState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IRadio.hal
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/IRadio.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IRadio.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IRadioCallback.hal
+$(GEN): $(LOCAL_PATH)/IRadioCallback.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::IRadio
+
+$(GEN): $(LOCAL_PATH)/IRadio.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IRadioCallback.hal
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/IRadioCallback.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IRadioCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::IRadioCallback
+
+$(GEN): $(LOCAL_PATH)/IRadioCallback.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.radio@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (RadioAppState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioAppState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioAppState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioAppStatus)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioAppStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioAppStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioAppType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioAppType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioAppType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioCardState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioCardState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioCardState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioCardStatus)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioCardStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioCardStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioCdmaSmsConst)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioCdmaSmsConst.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioCdmaSmsConst
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioConst)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioConst.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioConst
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioPersoSubstate)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioPersoSubstate.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioPersoSubstate
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioPinState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioPinState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioPinState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioRestrictedState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioRestrictedState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioRestrictedState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (RadioState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IRadio.hal
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/IRadio.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IRadio.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IRadioCallback.hal
+$(GEN): $(LOCAL_PATH)/IRadioCallback.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::IRadio
+
+$(GEN): $(LOCAL_PATH)/IRadio.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IRadioCallback.hal
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/IRadioCallback.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IRadioCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::IRadioCallback
+
+$(GEN): $(LOCAL_PATH)/IRadioCallback.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal
new file mode 100644
index 0000000..7725e63
--- /dev/null
+++ b/radio/1.0/IRadio.hal
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2016 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.radio@1.0;
+
+import IRadioCallback;
+
+interface IRadio {
+ /**
+ * Set callback that has response functions for requests
+ *
+ * @param slotId SIM slot id for which the function is called; needed for multi-sim
+ * @param radioCallback Object containing response callbacks
+ */
+ setCallback(int32_t slotId, IRadioCallback radioCallback);
+
+ /**
+ * Requests status of the ICC card
+ *
+ * Response callback is IRadioCallback.responseGetSimStatus()
+ *
+ * Valid errors:
+ * Must never fail for a valid slot id
+ *
+ * @param slotId SIM slot id for which the function is called; needed for multi-sim
+ * @param serial Serial number of request
+ */
+ oneway requestGetSimStatus(int32_t slotId, int32_t serial);
+};
diff --git a/radio/1.0/IRadioCallback.hal b/radio/1.0/IRadioCallback.hal
new file mode 100644
index 0000000..c27d168
--- /dev/null
+++ b/radio/1.0/IRadioCallback.hal
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 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.radio@1.0;
+
+interface IRadioCallback {
+ /**
+ * Response callback for IRadio.requestGetSimStatus()
+ *
+ * @param serial Serial number of request
+ * @param cardStatus ICC card status
+ */
+ responseGetSimStatus(int32_t serial, RadioCardStatus cardStatus);
+
+ // ONLY UNSOLICITED CALLBACKS BELOW
+ /**
+ * Called when radio state changes.
+ *
+ * @param radioState Current radio state
+ */
+ oneway unsolRadioStateChanged(RadioState radioState);
+};
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
new file mode 100644
index 0000000..e5bbe15
--- /dev/null
+++ b/radio/1.0/types.hal
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2016 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.radio@1.0;
+
+enum RadioConst : int32_t {
+ RADIO_VERSION = 12,
+ RADIO_LAST_IMPRECISE_RIL_VERSION = 12,
+ RADIO_VERSION_MIN = 6,
+ RADIO_CDMA_ALPHA_INFO_BUFFER_LENGTH = 64,
+ RADIO_CDMA_NUMBER_INFO_BUFFER_LENGTH = 81,
+ RADIO_MAX_RILDS = 3,
+ RADIO_MAX_SOCKET_NAME_LENGTH = 6,
+ RADIO_MAX_CLIENT_ID_LENGTH = 2,
+ RADIO_MAX_DEBUG_SOCKET_NAME_LENGTH = 12,
+ RADIO_MAX_QEMU_PIPE_NAME_LENGTH = 11,
+ RADIO_MAX_UUID_LENGTH = 64,
+ RADIO_RADIO_CAPABILITY_VERSION = 1,
+ RADIO_CARD_MAX_APPS = 8,
+ RADIO_CDMA_MAX_NUMBER_OF_INFO_RECS = 10,
+ RADIO_SS_INFO_MAX = 4,
+ RADIO_NUM_SERVICE_CLASSES = 7,
+ RADIO_NUM_TX_POWER_LEVELS = 5,
+};
+
+enum RadioCdmaSmsConst : int32_t {
+ ADDRESS_MAX = 36,
+ SUBADDRESS_MAX = 36,
+ BEARER_DATA_MAX = 255,
+ UDH_MAX_SND_SIZE = 128,
+ UDH_EO_DATA_SEGMENT_MAX = 131,
+ MAX_UD_HEADERS = 7,
+ USER_DATA_MAX = 229,
+ UDH_LARGE_PIC_SIZE = 128,
+ UDH_SMALL_PIC_SIZE = 32,
+ UDH_VAR_PIC_SIZE = 134,
+ UDH_ANIM_NUM_BITMAPS = 4,
+ UDH_LARGE_BITMAP_SIZE = 32,
+ UDH_SMALL_BITMAP_SIZE = 8,
+ UDH_OTHER_SIZE = 226,
+ IP_ADDRESS_SIZE = 4,
+};
+
+enum RadioRestrictedState : int32_t {
+ NONE = 0x00,
+ CS_EMERGENCY = 0x01,
+ CS_NORMAL = 0x02,
+ CS_ALL = 0x04,
+ PS_ALL = 0x10,
+};
+
+enum RadioCardState : int32_t {
+ ABSENT = 0,
+ PRESENT = 1,
+ ERROR = 2,
+ /* card is present but not usable due to carrier restrictions.*/
+ RESTRICTED = 3,
+};
+
+enum RadioPinState : int32_t {
+ UNKNOWN = 0,
+ ENABLED_NOT_VERIFIED = 1,
+ ENABLED_VERIFIED = 2,
+ DISABLED = 3,
+ ENABLED_BLOCKED = 4,
+ ENABLED_PERM_BLOCKED = 5,
+};
+
+enum RadioAppType : int32_t {
+ UNKNOWN = 0,
+ SIM = 1,
+ USIM = 2,
+ RUIM = 3,
+ CSIM = 4,
+ ISIM = 5,
+};
+
+enum RadioAppState : int32_t {
+ UNKNOWN = 0,
+ DETECTED = 1,
+ PIN = 2,
+ /* If PIN1 or UPin is required */
+ PUK = 3,
+ /* If PUK1 or Puk for UPin is required */
+ SUBSCRIPTION_PERSO = 4,
+ /* perso_substate should be look at when app_state is assigned to this value */
+ READY = 5,
+};
+
+enum RadioPersoSubstate : int32_t {
+ UNKNOWN = 0,
+ /* initial state */
+ IN_PROGRESS = 1,
+ /* in between each lock transition */
+ READY = 2,
+ /* when either SIM or RUIM Perso is finished since each app can only have 1 active perso
+ involved */
+ SIM_NETWORK = 3,
+ SIM_NETWORK_SUBSET = 4,
+ SIM_CORPORATE = 5,
+ SIM_SERVICE_PROVIDER = 6,
+ SIM_SIM = 7,
+ SIM_NETWORK_PUK = 8,
+ /* The corresponding perso lock is blocked */
+ SIM_NETWORK_SUBSET_PUK = 9,
+ SIM_CORPORATE_PUK = 10,
+ SIM_SERVICE_PROVIDER_PUK = 11,
+ SIM_SIM_PUK = 12,
+ RUIM_NETWORK1 = 13,
+ RUIM_NETWORK2 = 14,
+ RUIM_HRPD = 15,
+ RUIM_CORPORATE = 16,
+ RUIM_SERVICE_PROVIDER = 17,
+ RUIM_RUIM = 18,
+ RUIM_NETWORK1_PUK = 19,
+ /* The corresponding perso lock is blocked */
+ RUIM_NETWORK2_PUK = 20,
+ RUIM_HRPD_PUK = 21,
+ RUIM_CORPORATE_PUK = 22,
+ RUIM_SERVICE_PROVIDER_PUK = 23,
+ RUIM_RUIM_PUK = 24,
+};
+
+enum RadioState : int32_t {
+ OFF = 0,
+ /* Radio explictly powered off (eg CFUN=0) */
+ UNAVAILABLE = 1,
+ /* States 2-9 below are deprecated. Just leaving them here for backward compatibility. */
+ SIM_NOT_READY = 2,
+ /* Radio is on, but the SIM interface is not ready */
+ SIM_LOCKED_OR_ABSENT = 3,
+ /* SIM PIN locked, PUK required, network
+ personalization locked, or SIM absent */
+ SIM_READY = 4,
+ /* Radio is on and SIM interface is available */
+ RUIM_NOT_READY = 5,
+ /* Radio is on, but the RUIM interface is not ready */
+ RUIM_READY = 6,
+ /* Radio is on and the RUIM interface is available */
+ RUIM_LOCKED_OR_ABSENT = 7,
+ /* RUIM PIN locked, PUK required, network
+ personalization locked, or RUIM absent */
+ NV_NOT_READY = 8,
+ /* Radio is on, but the NV interface is not available */
+ NV_READY = 9,
+ /* Radio is on */
+ ON = 10,
+};
+
+struct RadioAppStatus {
+ RadioAppType appType;
+ RadioAppState appState;
+ RadioPersoSubstate persoSubstate;
+ /* applicable only if app_state == SUBSCRIPTION_PERSO */
+ string aidPtr;
+ /* null terminated string, e.g., from 0xA0, 0x00 -> 0x41, 0x30, 0x30, 0x30 */
+ string appLabelPtr;
+ /* null terminated string */
+ int32_t pin1Replaced;
+ /* applicable to USIM, CSIM & ISIM */
+ RadioPinState pin1;
+ RadioPinState pin2;
+};
+
+struct RadioCardStatus {
+ RadioCardState cardState;
+ RadioPinState universalPinState;
+ /* applicable to USIM and CSIM */
+ int32_t gsmUmtsSubscriptionAppIndex;
+ /* value < RADIO_CARD_MAX_APPS, -1 if none */
+ int32_t cdmaSubscriptionAppIndex;
+ /* value < RADIO_CARD_MAX_APPS, -1 if none */
+ int32_t imsSubscriptionAppIndex;
+ /* value < RADIO_CARD_MAX_APPS, -1 if none */
+ int32_t numApplications;
+ /* value <= RADIO_CARD_MAX_APPS */
+ RadioAppStatus[RadioConst:RADIO_CARD_MAX_APPS] applications;
+};
\ No newline at end of file
diff --git a/tests/foo/1.0/IFoo.hal b/tests/foo/1.0/IFoo.hal
index 3d82353..614f1e4 100644
--- a/tests/foo/1.0/IFoo.hal
+++ b/tests/foo/1.0/IFoo.hal
@@ -80,6 +80,7 @@
};
doThis(float param);
+ doThis(uint32_t param);
doThatAndReturnSomething(int64_t param) generates (int32_t result);
doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something);
doSomethingElse(int32_t[15] param) generates (int32_t[32] something);
diff --git a/vibrator/1.0/default/Android.bp b/vibrator/1.0/default/Android.bp
new file mode 100644
index 0000000..6d82a19
--- /dev/null
+++ b/vibrator/1.0/default/Android.bp
@@ -0,0 +1,26 @@
+//
+// Copyright (C) 2016 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.
+cc_library_shared {
+ name: "android.hardware.vibrator@1.0-impl",
+ relative_install_path: "hw",
+ srcs: ["Vibrator.cpp"],
+ shared_libs: [
+ "libhidl",
+ "liblog",
+ "libhwbinder",
+ "libutils",
+ "libhardware",
+ "android.hardware.vibrator@1.0",
+ ],
diff --git a/vibrator/1.0/default/Android.mk b/vibrator/1.0/default/Android.mk
index 3bb6f79..2b168bb 100644
--- a/vibrator/1.0/default/Android.mk
+++ b/vibrator/1.0/default/Android.mk
@@ -17,10 +17,11 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vibrator@1.0-impl
+LOCAL_MODULE := android.hardware.vibrator@1.0-service
+LOCAL_INIT_RC := android.hardware.vibrator@1.0-service.rc
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
- Vibrator.cpp \
+ service.cpp \
LOCAL_SHARED_LIBRARIES := \
libhidl \
@@ -30,4 +31,4 @@
libhardware \
android.hardware.vibrator@1.0
-include $(BUILD_SHARED_LIBRARY)
+include $(BUILD_EXECUTABLE)
diff --git a/vibrator/1.0/default/android.hardware.vibrator@1.0-service.rc b/vibrator/1.0/default/android.hardware.vibrator@1.0-service.rc
new file mode 100644
index 0000000..a7836b3
--- /dev/null
+++ b/vibrator/1.0/default/android.hardware.vibrator@1.0-service.rc
@@ -0,0 +1,4 @@
+service vibrator-1-0 /system/bin/hw/android.hardware.vibrator@1.0-service
+ class hal
+ user system
+ group system readproc
diff --git a/vibrator/1.0/default/service.cpp b/vibrator/1.0/default/service.cpp
new file mode 100644
index 0000000..a4a7132
--- /dev/null
+++ b/vibrator/1.0/default/service.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+#define LOG_TAG "android.hardware.vibrator@1.0-service"
+#include <utils/Log.h>
+
+#include <iostream>
+#include <unistd.h>
+
+#include <android/hardware/vibrator/1.0/IVibrator.h>
+
+#include <hidl/IServiceManager.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/Errors.h>
+#include <utils/StrongPointer.h>
+
+using android::sp;
+
+// libhwbinder:
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+
+// Generated HIDL files
+using android::hardware::vibrator::V1_0::IVibrator;
+
+int main() {
+ ALOGI("Service is starting.");
+ const char instance[] = "vibrator";
+ ALOGI("Retrieving default implementation of instance %s.",
+ instance);
+ android::sp<IVibrator> service = IVibrator::getService(instance, true);
+ if (service.get() == nullptr) {
+ ALOGE("IVibrator::getService returned NULL, exiting");
+ return -1;
+ }
+ ALOGI("Default implementation using %s is %s",
+ instance, (service->isRemote() ? "REMOTE" : "LOCAL"));
+ LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
+ ALOGI("Registering instance %s.", instance);
+ service->registerAsService(instance);
+ ALOGI("Ready.");
+
+ ProcessState::self()->setThreadPoolMaxThreadCount(0);
+ ProcessState::self()->startThreadPool();
+ IPCThreadState::self()->joinThreadPool();
+}
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index 07e17ef..59ad2c5 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -7,16 +7,28 @@
srcs: [
"types.hal",
"IWifi.hal",
+ "IWifiApIface.hal",
"IWifiChip.hal",
"IWifiChipEventCallback.hal",
"IWifiEventCallback.hal",
+ "IWifiIface.hal",
+ "IWifiNanIface.hal",
+ "IWifiP2pIface.hal",
+ "IWifiRttController.hal",
+ "IWifiStaIface.hal",
],
out: [
"android/hardware/wifi/1.0/types.cpp",
"android/hardware/wifi/1.0/WifiAll.cpp",
+ "android/hardware/wifi/1.0/WifiApIfaceAll.cpp",
"android/hardware/wifi/1.0/WifiChipAll.cpp",
"android/hardware/wifi/1.0/WifiChipEventCallbackAll.cpp",
"android/hardware/wifi/1.0/WifiEventCallbackAll.cpp",
+ "android/hardware/wifi/1.0/WifiIfaceAll.cpp",
+ "android/hardware/wifi/1.0/WifiNanIfaceAll.cpp",
+ "android/hardware/wifi/1.0/WifiP2pIfaceAll.cpp",
+ "android/hardware/wifi/1.0/WifiRttControllerAll.cpp",
+ "android/hardware/wifi/1.0/WifiStaIfaceAll.cpp",
],
}
@@ -27,9 +39,15 @@
srcs: [
"types.hal",
"IWifi.hal",
+ "IWifiApIface.hal",
"IWifiChip.hal",
"IWifiChipEventCallback.hal",
"IWifiEventCallback.hal",
+ "IWifiIface.hal",
+ "IWifiNanIface.hal",
+ "IWifiP2pIface.hal",
+ "IWifiRttController.hal",
+ "IWifiStaIface.hal",
],
out: [
"android/hardware/wifi/1.0/types.h",
@@ -38,6 +56,11 @@
"android/hardware/wifi/1.0/BnWifi.h",
"android/hardware/wifi/1.0/BpWifi.h",
"android/hardware/wifi/1.0/BsWifi.h",
+ "android/hardware/wifi/1.0/IWifiApIface.h",
+ "android/hardware/wifi/1.0/IHwWifiApIface.h",
+ "android/hardware/wifi/1.0/BnWifiApIface.h",
+ "android/hardware/wifi/1.0/BpWifiApIface.h",
+ "android/hardware/wifi/1.0/BsWifiApIface.h",
"android/hardware/wifi/1.0/IWifiChip.h",
"android/hardware/wifi/1.0/IHwWifiChip.h",
"android/hardware/wifi/1.0/BnWifiChip.h",
@@ -53,6 +76,31 @@
"android/hardware/wifi/1.0/BnWifiEventCallback.h",
"android/hardware/wifi/1.0/BpWifiEventCallback.h",
"android/hardware/wifi/1.0/BsWifiEventCallback.h",
+ "android/hardware/wifi/1.0/IWifiIface.h",
+ "android/hardware/wifi/1.0/IHwWifiIface.h",
+ "android/hardware/wifi/1.0/BnWifiIface.h",
+ "android/hardware/wifi/1.0/BpWifiIface.h",
+ "android/hardware/wifi/1.0/BsWifiIface.h",
+ "android/hardware/wifi/1.0/IWifiNanIface.h",
+ "android/hardware/wifi/1.0/IHwWifiNanIface.h",
+ "android/hardware/wifi/1.0/BnWifiNanIface.h",
+ "android/hardware/wifi/1.0/BpWifiNanIface.h",
+ "android/hardware/wifi/1.0/BsWifiNanIface.h",
+ "android/hardware/wifi/1.0/IWifiP2pIface.h",
+ "android/hardware/wifi/1.0/IHwWifiP2pIface.h",
+ "android/hardware/wifi/1.0/BnWifiP2pIface.h",
+ "android/hardware/wifi/1.0/BpWifiP2pIface.h",
+ "android/hardware/wifi/1.0/BsWifiP2pIface.h",
+ "android/hardware/wifi/1.0/IWifiRttController.h",
+ "android/hardware/wifi/1.0/IHwWifiRttController.h",
+ "android/hardware/wifi/1.0/BnWifiRttController.h",
+ "android/hardware/wifi/1.0/BpWifiRttController.h",
+ "android/hardware/wifi/1.0/BsWifiRttController.h",
+ "android/hardware/wifi/1.0/IWifiStaIface.h",
+ "android/hardware/wifi/1.0/IHwWifiStaIface.h",
+ "android/hardware/wifi/1.0/BnWifiStaIface.h",
+ "android/hardware/wifi/1.0/BpWifiStaIface.h",
+ "android/hardware/wifi/1.0/BsWifiStaIface.h",
],
}
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index e211ca8..58c487b 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -47,6 +47,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (IfaceType)
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IfaceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::types.IfaceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifi.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifi.java
@@ -57,6 +74,8 @@
$(GEN): $(LOCAL_PATH)/IWifiChip.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
@@ -68,14 +87,45 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build IWifiApIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiApIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiApIface
+
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifiChip.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiChip.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
@@ -125,6 +175,101 @@
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiIface
+
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiNanIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiNanIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiNanIface
+
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiP2pIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiP2pIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiP2pIface
+
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiRttController.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiRttController.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiRttController
+
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiStaIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiStaIface
+
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_JAVA_LIBRARY)
@@ -173,6 +318,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (IfaceType)
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IfaceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::types.IfaceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifi.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifi.java
@@ -183,6 +345,8 @@
$(GEN): $(LOCAL_PATH)/IWifiChip.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
@@ -194,14 +358,45 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build IWifiApIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiApIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiApIface
+
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifiChip.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiChip.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
@@ -251,6 +446,101 @@
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiIface
+
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiNanIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiNanIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiNanIface
+
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiP2pIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiP2pIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiP2pIface
+
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiRttController.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiRttController.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiRttController
+
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiStaIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiStaIface
+
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/wifi/1.0/IWifi.hal b/wifi/1.0/IWifi.hal
index d1311f5..9e09348 100644
--- a/wifi/1.0/IWifi.hal
+++ b/wifi/1.0/IWifi.hal
@@ -70,10 +70,22 @@
@callflow(next={"registerEventCallback", "start", "stop"})
oneway stop();
- // TODO(b/30570663) return vec<IWifiChip> instead
/**
- * Get the configurable chip on the device.
+ * Retrieve the list of all chip Id's on the device.
+ * The corresponding |IWifiChip| object for any chip can be
+ * retrieved using |getChip| method.
+ *
+ * @return chipIds List of all chip Id's on the device.
*/
@callflow(next={"*"})
- getChip() generates (IWifiChip chip);
+ getChipIds() generates (vec<ChipId> chipIds);
+
+ /**
+ * Gets a HIDL interface object for the chip corresponding to the
+ * provided chipId.
+ *
+ * @return chip HIDL interface object representing the chip.
+ */
+ @callflow(next={"*"})
+ getChip(ChipId chipId) generates (IWifiChip chip);
};
diff --git a/wifi/1.0/IWifiApIface.hal b/wifi/1.0/IWifiApIface.hal
new file mode 100644
index 0000000..6bc3580
--- /dev/null
+++ b/wifi/1.0/IWifiApIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 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.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single AP iface.
+ */
+interface IWifiApIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal
index 7a41ddf..cd4b219 100644
--- a/wifi/1.0/IWifiChip.hal
+++ b/wifi/1.0/IWifiChip.hal
@@ -17,6 +17,12 @@
package android.hardware.wifi@1.0;
import IWifiChipEventCallback;
+import IWifiIface;
+import IWifiApIface;
+import IWifiNanIface;
+import IWifiP2pIface;
+import IWifiStaIface;
+import IWifiRttController;
/**
* Interface that represents a chip that must be configured as a single unit.
@@ -24,15 +30,6 @@
* to perform operations like NAN, RTT, etc.
*/
interface IWifiChip {
- enum IfaceType : uint32_t {
- STA, AP, P2P,
- /**
- * NAN control interface. Datapath support may be queried and created
- * through this interface.
- */
- NAN,
- };
-
/**
* Set of interface types with the maximum number of interfaces that can have
* one of the specified type for a given ChipIfaceCombination. See
@@ -122,6 +119,13 @@
};
/**
+ * Get the id assigned to this chip.
+ *
+ * @return id Assigned chip Id.
+ */
+ getId() generates (ChipId id);
+
+ /**
* Requests notifications of significant events on this chip. Multiple calls
* to this will register multiple callbacks each of which will receive all
* events.
@@ -176,4 +180,142 @@
* success, or |IWifiChipEventCallback.onFirmwareDebugDumpFailure| on failure.
*/
oneway requestFirmwareDebugDump();
+
+ /**
+ * Create an AP iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the AP type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createApIface() generates (IWifiApIface iface);
+
+ /**
+ * List all the AP iface names configured on the chip.
+ * The corresponding |IWifiApIface| object for any iface are
+ * retrieved using |getApIface| method.
+ *
+ * @return ifnames List of all AP iface names on the chip.
+ */
+ getApIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the AP Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getApIface(string ifname) generates (IWifiApIface iface);
+
+ /**
+ * Create a NAN iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the NAN type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createNanIface() generates (IWifiNanIface iface);
+
+ /**
+ * List all the NAN iface names configured on the chip.
+ * The corresponding |IWifiNanIface| object for any iface are
+ * retrieved using |getNanIface| method.
+ *
+ * @return ifnames List of all NAN iface names on the chip.
+ */
+ getNanIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the NAN Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getNanIface(string ifname) generates (IWifiNanIface iface);
+
+ /**
+ * Create a P2P iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the P2P type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createP2pIface() generates (IWifiP2pIface iface);
+
+ /**
+ * List all the P2P iface names configured on the chip.
+ * The corresponding |IWifiP2pIface| object for any iface are
+ * retrieved using |getP2pIface| method.
+ *
+ * @return ifnames List of all P2P iface names on the chip.
+ */
+ getP2pIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the P2P Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getP2pIface(string ifname) generates (IWifiP2pIface iface);
+
+ /**
+ * Create an STA iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the STA type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createStaIface() generates (IWifiStaIface iface);
+
+ /**
+ * List all the STA iface names configured on the chip.
+ * The corresponding |IWifiStaIface| object for any iface are
+ * retrieved using |getStaIface| method.
+ *
+ * @return ifnames List of all STA iface names on the chip.
+ */
+ getStaIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the STA Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getStaIface(string ifname) generates (IWifiStaIface iface);
+
+ /**
+ * Create a RTTController instance.
+ *
+ * RTT controller can be either:
+ * a) Bound to a specific iface by passing in the corresponding |IWifiIface|
+ * object in |iface| param, OR
+ * b) Let the implementation decide the iface to use for RTT operations by
+ * passing null in |iface| param.
+ *
+ * @param boundIface HIDL interface object representing the iface if
+ * the responder must be bound to a specific iface, null otherwise.
+ */
+ createRttController(IWifiIface boundIface) generates (IWifiRttController rtt);
};
diff --git a/wifi/1.0/IWifiIface.hal b/wifi/1.0/IWifiIface.hal
new file mode 100644
index 0000000..f4150e7
--- /dev/null
+++ b/wifi/1.0/IWifiIface.hal
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016 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.wifi@1.0;
+
+/**
+ * Interface used to represent a single iface.
+ */
+interface IWifiIface {
+ /**
+ * Get the type of this iface.
+ *
+ * @return type One of the supported iface types.
+ */
+ getType() generates (IfaceType type);
+
+ /**
+ * Get the name of this iface.
+ *
+ * @return name Name of the iface.
+ */
+ getName() generates (string name);
+};
diff --git a/wifi/1.0/IWifiNanIface.hal b/wifi/1.0/IWifiNanIface.hal
new file mode 100644
index 0000000..dade94c
--- /dev/null
+++ b/wifi/1.0/IWifiNanIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 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.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single NAN iface.
+ */
+interface IWifiNanIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiP2pIface.hal b/wifi/1.0/IWifiP2pIface.hal
new file mode 100644
index 0000000..243748f
--- /dev/null
+++ b/wifi/1.0/IWifiP2pIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 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.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single NAN iface.
+ */
+interface IWifiP2pIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiRttController.hal b/wifi/1.0/IWifiRttController.hal
new file mode 100644
index 0000000..d735da7
--- /dev/null
+++ b/wifi/1.0/IWifiRttController.hal
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016 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.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to perform RTT operations.
+ */
+interface IWifiRttController {
+ /**
+ * Get the iface on which the RTT operations will be performed.
+ *
+ * @return boundIface HIDL interface object representing the iface if bound
+ * to a specific iface, null otherwise
+ */
+ getBoundIface() generates (IWifiIface boundIface);
+};
diff --git a/wifi/1.0/IWifiStaIface.hal b/wifi/1.0/IWifiStaIface.hal
new file mode 100644
index 0000000..5234c71
--- /dev/null
+++ b/wifi/1.0/IWifiStaIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 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.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single STA iface.
+ */
+interface IWifiStaIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/default/Android.mk b/wifi/1.0/default/Android.mk
index 07865a5..3fd5fba 100644
--- a/wifi/1.0/default/Android.mk
+++ b/wifi/1.0/default/Android.mk
@@ -19,9 +19,14 @@
LOCAL_CPPFLAGS := -std=c++11 -Wall -Wno-unused-parameter -Werror -Wextra
LOCAL_SRC_FILES := \
failure_reason_util.cpp \
- wifi_chip.cpp \
wifi.cpp \
- wifi_legacy_hal.cpp
+ wifi_ap_iface.cpp \
+ wifi_chip.cpp \
+ wifi_legacy_hal.cpp \
+ wifi_nan_iface.cpp \
+ wifi_p2p_iface.cpp \
+ wifi_rtt_controller.cpp \
+ wifi_sta_iface.cpp
LOCAL_SHARED_LIBRARIES := \
android.hardware.wifi@1.0 \
libbase \
diff --git a/wifi/1.0/default/wifi.cpp b/wifi/1.0/default/wifi.cpp
index d5b69b8..ff2eb4c 100644
--- a/wifi/1.0/default/wifi.cpp
+++ b/wifi/1.0/default/wifi.cpp
@@ -21,6 +21,11 @@
#include "failure_reason_util.h"
#include "wifi_chip.h"
+namespace {
+// Chip ID to use for the only supported chip.
+static constexpr android::hardware::wifi::V1_0::ChipId kChipId = 0;
+} // namespace
+
namespace android {
namespace hardware {
namespace wifi {
@@ -33,7 +38,7 @@
Return<void> Wifi::registerEventCallback(
const sp<IWifiEventCallback>& callback) {
// TODO(b/31632518): remove the callback when the client is destroyed
- callbacks_.insert(callback);
+ callbacks_.emplace_back(callback);
return Void();
}
@@ -67,7 +72,7 @@
}
// Create the chip instance once the HAL is started.
- chip_ = new WifiChip(legacy_hal_);
+ chip_ = new WifiChip(kChipId, legacy_hal_);
run_state_ = RunState::STARTED;
for (const auto& callback : callbacks_) {
callback->onStart();
@@ -108,8 +113,23 @@
return Void();
}
-Return<void> Wifi::getChip(getChip_cb cb) {
- cb(chip_);
+Return<void> Wifi::getChipIds(getChipIds_cb cb) {
+ std::vector<ChipId> chip_ids;
+ if (chip_.get()) {
+ chip_ids.emplace_back(kChipId);
+ }
+ hidl_vec<ChipId> hidl_data;
+ hidl_data.setToExternal(chip_ids.data(), chip_ids.size());
+ cb(hidl_data);
+ return Void();
+}
+
+Return<void> Wifi::getChip(ChipId chip_id, getChip_cb cb) {
+ if (chip_.get() && chip_id == kChipId) {
+ cb(chip_);
+ } else {
+ cb(nullptr);
+ }
return Void();
}
diff --git a/wifi/1.0/default/wifi.h b/wifi/1.0/default/wifi.h
index e6cf1ac..55ba12b 100644
--- a/wifi/1.0/default/wifi.h
+++ b/wifi/1.0/default/wifi.h
@@ -18,7 +18,6 @@
#define WIFI_H_
#include <functional>
-#include <set>
#include <android-base/macros.h>
#include <android/hardware/wifi/1.0/IWifi.h>
@@ -46,7 +45,8 @@
Return<bool> isStarted() override;
Return<void> start() override;
Return<void> stop() override;
- Return<void> getChip(getChip_cb cb) override;
+ Return<void> getChipIds(getChipIds_cb cb) override;
+ Return<void> getChip(ChipId chip_id, getChip_cb cb) override;
private:
enum class RunState { STOPPED, STARTED, STOPPING };
@@ -55,7 +55,7 @@
// and shared with all the child HIDL interface objects.
std::shared_ptr<WifiLegacyHal> legacy_hal_;
RunState run_state_;
- std::set<sp<IWifiEventCallback>> callbacks_;
+ std::vector<sp<IWifiEventCallback>> callbacks_;
sp<WifiChip> chip_;
DISALLOW_COPY_AND_ASSIGN(Wifi);
diff --git a/wifi/1.0/default/wifi_ap_iface.cpp b/wifi/1.0/default/wifi_ap_iface.cpp
new file mode 100644
index 0000000..aded04d
--- /dev/null
+++ b/wifi/1.0/default/wifi_ap_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "wifi_ap_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiApIface::WifiApIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiApIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiApIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiApIface::getType() {
+ return IfaceType::AP;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_ap_iface.h b/wifi/1.0/default/wifi_ap_iface.h
new file mode 100644
index 0000000..b95a3d8
--- /dev/null
+++ b/wifi/1.0/default/wifi_ap_iface.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 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 WIFI_AP_IFACE_H_
+#define WIFI_AP_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiApIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a AP Iface instance.
+ */
+class WifiApIface : public IWifiApIface {
+ public:
+ WifiApIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiApIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_AP_IFACE_H_
diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp
index df321e2..4dd020b 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.0/default/wifi_chip.cpp
@@ -20,31 +20,64 @@
#include "failure_reason_util.h"
+namespace {
+using android::sp;
+using android::hardware::hidl_vec;
+using android::hardware::hidl_string;
+
+hidl_vec<hidl_string> createHidlVecOfIfaceNames(const std::string& ifname) {
+ std::vector<hidl_string> ifnames;
+ if (!ifname.empty()) {
+ hidl_string hidl_ifname;
+ hidl_ifname = ifname.c_str();
+ ifnames.emplace_back(hidl_ifname);
+ }
+ hidl_vec<hidl_string> hidl_ifnames;
+ hidl_ifnames.setToExternal(ifnames.data(), ifnames.size());
+ return hidl_ifnames;
+}
+
+template <typename Iface>
+void invalidateAndClear(sp<Iface>& iface) {
+ if (iface.get()) {
+ iface->invalidate();
+ iface.clear();
+ }
+}
+} // namepsace
+
namespace android {
namespace hardware {
namespace wifi {
namespace V1_0 {
namespace implementation {
-WifiChip::WifiChip(std::weak_ptr<WifiLegacyHal> legacy_hal)
- : legacy_hal_(legacy_hal) {}
+WifiChip::WifiChip(ChipId chip_id,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : chip_id_(chip_id), legacy_hal_(legacy_hal), is_valid_(true) {}
void WifiChip::invalidate() {
+ invalidateAndRemoveAllIfaces();
legacy_hal_.reset();
callbacks_.clear();
+ is_valid_ = false;
+}
+
+Return<ChipId> WifiChip::getId() {
+ return chip_id_;
}
Return<void> WifiChip::registerEventCallback(
const sp<IWifiChipEventCallback>& callback) {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
// TODO(b/31632518): remove the callback when the client is destroyed
- callbacks_.insert(callback);
+ callbacks_.emplace_back(callback);
return Void();
}
Return<void> WifiChip::getAvailableModes(getAvailableModes_cb cb) {
- if (!legacy_hal_.lock()) {
+ if (!is_valid_) {
cb(hidl_vec<ChipMode>());
return Void();
} else {
@@ -54,38 +87,50 @@
}
Return<void> WifiChip::configureChip(uint32_t /*mode_id*/) {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
+
+ invalidateAndRemoveAllIfaces();
// TODO add implementation
return Void();
}
Return<uint32_t> WifiChip::getMode() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return 0;
// TODO add implementation
return 0;
}
Return<void> WifiChip::requestChipDebugInfo() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
IWifiChipEventCallback::ChipDebugInfo result;
std::pair<wifi_error, std::string> ret =
- legacy_hal_.lock()->getWlanDriverVersion();
+ legacy_hal_.lock()->getDriverVersion();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver version: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(
+ ret.first, " failed to get driver version");
+ for (const auto& callback : callbacks_) {
+ callback->onChipDebugInfoFailure(reason);
+ }
return Void();
}
result.driverDescription = ret.second.c_str();
- ret = legacy_hal_.lock()->getWlanFirmwareVersion();
+ ret = legacy_hal_.lock()->getFirmwareVersion();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware version: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(
+ ret.first, " failed to get firmware version");
+ for (const auto& callback : callbacks_) {
+ callback->onChipDebugInfoFailure(reason);
+ }
return Void();
}
result.firmwareDescription = ret.second.c_str();
@@ -97,14 +142,18 @@
}
Return<void> WifiChip::requestDriverDebugDump() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
std::pair<wifi_error, std::vector<char>> ret =
- legacy_hal_.lock()->requestWlanDriverMemoryDump();
+ legacy_hal_.lock()->requestDriverMemoryDump();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver debug dump: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(ret.first, "");
+ for (const auto& callback : callbacks_) {
+ callback->onDriverDebugDumpFailure(reason);
+ }
return Void();
}
@@ -119,14 +168,18 @@
}
Return<void> WifiChip::requestFirmwareDebugDump() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
std::pair<wifi_error, std::vector<char>> ret =
- legacy_hal_.lock()->requestWlanFirmwareMemoryDump();
+ legacy_hal_.lock()->requestFirmwareMemoryDump();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware debug dump: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(ret.first, "");
+ for (const auto& callback : callbacks_) {
+ callback->onFirmwareDebugDumpFailure(reason);
+ }
return Void();
}
@@ -140,6 +193,203 @@
return Void();
}
+Return<void> WifiChip::createApIface(createApIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getApIfaceName();
+ ap_iface_ = new WifiApIface(ifname, legacy_hal_);
+ cb(ap_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getApIfaceNames(getApIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (ap_iface_.get()) {
+ ifname = legacy_hal_.lock()->getApIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getApIface(const hidl_string& ifname, getApIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (ap_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getApIfaceName())) {
+ cb(ap_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createNanIface(createNanIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getNanIfaceName();
+ nan_iface_ = new WifiNanIface(ifname, legacy_hal_);
+ cb(nan_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getNanIfaceNames(getNanIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (nan_iface_.get()) {
+ ifname = legacy_hal_.lock()->getNanIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getNanIface(const hidl_string& ifname,
+ getNanIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (nan_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getNanIfaceName())) {
+ cb(nan_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createP2pIface(createP2pIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getP2pIfaceName();
+ p2p_iface_ = new WifiP2pIface(ifname, legacy_hal_);
+ cb(p2p_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getP2pIfaceNames(getP2pIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (p2p_iface_.get()) {
+ ifname = legacy_hal_.lock()->getP2pIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getP2pIface(const hidl_string& ifname,
+ getP2pIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (p2p_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getP2pIfaceName())) {
+ cb(p2p_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createStaIface(createStaIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getStaIfaceName();
+ sta_iface_ = new WifiStaIface(ifname, legacy_hal_);
+ cb(sta_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getStaIfaceNames(getStaIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (sta_iface_.get()) {
+ ifname = legacy_hal_.lock()->getStaIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getStaIface(const hidl_string& ifname,
+ getStaIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (sta_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getStaIfaceName())) {
+ cb(sta_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createRttController(const sp<IWifiIface>& bound_iface,
+ createRttController_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ sp<WifiRttController> rtt = new WifiRttController(bound_iface, legacy_hal_);
+ rtt_controllers_.emplace_back(rtt);
+ cb(rtt);
+ return Void();
+}
+
+void WifiChip::invalidateAndRemoveAllIfaces() {
+ invalidateAndClear(ap_iface_);
+ invalidateAndClear(nan_iface_);
+ invalidateAndClear(p2p_iface_);
+ invalidateAndClear(sta_iface_);
+ // Since all the ifaces are invalid now, all RTT controller objects
+ // using those ifaces also need to be invalidated.
+ for (const auto& rtt : rtt_controllers_) {
+ rtt->invalidate();
+ }
+ rtt_controllers_.clear();
+}
+
} // namespace implementation
} // namespace V1_0
} // namespace wifi
diff --git a/wifi/1.0/default/wifi_chip.h b/wifi/1.0/default/wifi_chip.h
index 95fabe4..94ffa63 100644
--- a/wifi/1.0/default/wifi_chip.h
+++ b/wifi/1.0/default/wifi_chip.h
@@ -17,12 +17,17 @@
#ifndef WIFI_CHIP_H_
#define WIFI_CHIP_H_
-#include <set>
+#include <map>
#include <android-base/macros.h>
#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include "wifi_ap_iface.h"
#include "wifi_legacy_hal.h"
+#include "wifi_nan_iface.h"
+#include "wifi_p2p_iface.h"
+#include "wifi_rtt_controller.h"
+#include "wifi_sta_iface.h"
namespace android {
namespace hardware {
@@ -37,11 +42,24 @@
*/
class WifiChip : public IWifiChip {
public:
- WifiChip(std::weak_ptr<WifiLegacyHal> legacy_hal);
- // Invalidate this instance once the HAL is stopped.
+ WifiChip(ChipId chip_id, const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // HIDL does not provide a built-in mechanism to let the server invalidate
+ // a HIDL interface object after creation. If any client process holds onto
+ // a reference to the object in their context, any method calls on that
+ // reference will continue to be directed to the server.
+ //
+ // However Wifi HAL needs to control the lifetime of these objects. So, add
+ // a public |invalidate| method to |WifiChip| and it's child objects. This
+ // will be used to mark an object invalid when either:
+ // a) Wifi HAL is stopped, or
+ // b) Wifi Chip is reconfigured.
+ //
+ // All HIDL method implementations should check if the object is still marked
+ // valid before processing them.
void invalidate();
// HIDL methods exposed.
+ Return<ChipId> getId() override;
Return<void> registerEventCallback(
const sp<IWifiChipEventCallback>& callback) override;
Return<void> getAvailableModes(getAvailableModes_cb cb) override;
@@ -50,10 +68,36 @@
Return<void> requestChipDebugInfo() override;
Return<void> requestDriverDebugDump() override;
Return<void> requestFirmwareDebugDump() override;
+ Return<void> createApIface(createApIface_cb cb) override;
+ Return<void> getApIfaceNames(getApIfaceNames_cb cb) override;
+ Return<void> getApIface(const hidl_string& ifname, getApIface_cb cb) override;
+ Return<void> createNanIface(createNanIface_cb cb) override;
+ Return<void> getNanIfaceNames(getNanIfaceNames_cb cb) override;
+ Return<void> getNanIface(const hidl_string& ifname,
+ getNanIface_cb cb) override;
+ Return<void> createP2pIface(createP2pIface_cb cb) override;
+ Return<void> getP2pIfaceNames(getP2pIfaceNames_cb cb) override;
+ Return<void> getP2pIface(const hidl_string& ifname,
+ getP2pIface_cb cb) override;
+ Return<void> createStaIface(createStaIface_cb cb) override;
+ Return<void> getStaIfaceNames(getStaIfaceNames_cb cb) override;
+ Return<void> getStaIface(const hidl_string& ifname,
+ getStaIface_cb cb) override;
+ Return<void> createRttController(const sp<IWifiIface>& bound_iface,
+ createRttController_cb cb) override;
private:
+ void invalidateAndRemoveAllIfaces();
+
+ ChipId chip_id_;
std::weak_ptr<WifiLegacyHal> legacy_hal_;
- std::set<sp<IWifiChipEventCallback>> callbacks_;
+ std::vector<sp<IWifiChipEventCallback>> callbacks_;
+ sp<WifiApIface> ap_iface_;
+ sp<WifiNanIface> nan_iface_;
+ sp<WifiP2pIface> p2p_iface_;
+ sp<WifiStaIface> sta_iface_;
+ std::vector<sp<WifiRttController>> rtt_controllers_;
+ bool is_valid_;
DISALLOW_COPY_AND_ASSIGN(WifiChip);
};
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index a6df996..553a058 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -25,12 +25,6 @@
#include <wifi_system/interface_tool.h>
namespace {
-std::string getWlanInterfaceName() {
- char buffer[PROPERTY_VALUE_MAX];
- property_get("wifi.interface", buffer, "wlan0");
- return buffer;
-}
-
// Legacy HAL functions accept "C" style function pointers, so use global
// functions to pass to the legacy HAL function and store the corresponding
// std::function methods to be invoked.
@@ -120,7 +114,31 @@
return WIFI_SUCCESS;
}
-std::pair<wifi_error, std::string> WifiLegacyHal::getWlanDriverVersion() {
+std::string WifiLegacyHal::getApIfaceName() {
+ // Fake name. This interface does not exist in legacy HAL
+ // API's.
+ return "ap0";
+}
+
+std::string WifiLegacyHal::getNanIfaceName() {
+ // Fake name. This interface does not exist in legacy HAL
+ // API's.
+ return "nan0";
+}
+
+std::string WifiLegacyHal::getP2pIfaceName() {
+ std::array<char, PROPERTY_VALUE_MAX> buffer;
+ property_get("wifi.direct.interface", buffer.data(), "p2p0");
+ return buffer.data();
+}
+
+std::string WifiLegacyHal::getStaIfaceName() {
+ std::array<char, PROPERTY_VALUE_MAX> buffer;
+ property_get("wifi.interface", buffer.data(), "wlan0");
+ return buffer.data();
+}
+
+std::pair<wifi_error, std::string> WifiLegacyHal::getDriverVersion() {
std::array<char, kMaxVersionStringLength> buffer;
buffer.fill(0);
wifi_error status = global_func_table_.wifi_get_driver_version(
@@ -128,7 +146,7 @@
return std::make_pair(status, buffer.data());
}
-std::pair<wifi_error, std::string> WifiLegacyHal::getWlanFirmwareVersion() {
+std::pair<wifi_error, std::string> WifiLegacyHal::getFirmwareVersion() {
std::array<char, kMaxVersionStringLength> buffer;
buffer.fill(0);
wifi_error status = global_func_table_.wifi_get_firmware_version(
@@ -137,7 +155,7 @@
}
std::pair<wifi_error, std::vector<char>>
-WifiLegacyHal::requestWlanDriverMemoryDump() {
+WifiLegacyHal::requestDriverMemoryDump() {
std::vector<char> driver_dump;
on_driver_memory_dump_internal_callback = [&driver_dump](char* buffer,
int buffer_size) {
@@ -150,7 +168,7 @@
}
std::pair<wifi_error, std::vector<char>>
-WifiLegacyHal::requestWlanFirmwareMemoryDump() {
+WifiLegacyHal::requestFirmwareMemoryDump() {
std::vector<char> firmware_dump;
on_firmware_memory_dump_internal_callback = [&firmware_dump](
char* buffer, int buffer_size) {
@@ -163,8 +181,7 @@
}
wifi_error WifiLegacyHal::retrieveWlanInterfaceHandle() {
- const std::string& ifname_to_find = getWlanInterfaceName();
-
+ const std::string& ifname_to_find = getStaIfaceName();
wifi_interface_handle* iface_handles = nullptr;
int num_iface_handles = 0;
wifi_error status = global_func_table_.wifi_get_ifaces(
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h
index f691b9b..3585975 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.0/default/wifi_legacy_hal.h
@@ -35,15 +35,21 @@
class WifiLegacyHal {
public:
WifiLegacyHal();
+ // Names to use for the different types of iface.
+ std::string getApIfaceName();
+ std::string getNanIfaceName();
+ std::string getP2pIfaceName();
+ std::string getStaIfaceName();
+
// Initialize the legacy HAL and start the event looper thread.
wifi_error start();
// Deinitialize the legacy HAL and stop the event looper thread.
wifi_error stop(const std::function<void()>& on_complete_callback);
// Wrappers for all the functions in the legacy HAL function table.
- std::pair<wifi_error, std::string> getWlanDriverVersion();
- std::pair<wifi_error, std::string> getWlanFirmwareVersion();
- std::pair<wifi_error, std::vector<char>> requestWlanDriverMemoryDump();
- std::pair<wifi_error, std::vector<char>> requestWlanFirmwareMemoryDump();
+ std::pair<wifi_error, std::string> getDriverVersion();
+ std::pair<wifi_error, std::string> getFirmwareVersion();
+ std::pair<wifi_error, std::vector<char>> requestDriverMemoryDump();
+ std::pair<wifi_error, std::vector<char>> requestFirmwareMemoryDump();
private:
static const uint32_t kMaxVersionStringLength;
diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.0/default/wifi_nan_iface.cpp
new file mode 100644
index 0000000..3c7ae4b
--- /dev/null
+++ b/wifi/1.0/default/wifi_nan_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "wifi_nan_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiNanIface::WifiNanIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiNanIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiNanIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiNanIface::getType() {
+ return IfaceType::NAN;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_nan_iface.h b/wifi/1.0/default/wifi_nan_iface.h
new file mode 100644
index 0000000..93e2e77
--- /dev/null
+++ b/wifi/1.0/default/wifi_nan_iface.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 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 WIFI_NAN_IFACE_H_
+#define WIFI_NAN_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiNanIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a NAN Iface instance.
+ */
+class WifiNanIface : public IWifiNanIface {
+ public:
+ WifiNanIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiNanIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_NAN_IFACE_H_
diff --git a/wifi/1.0/default/wifi_p2p_iface.cpp b/wifi/1.0/default/wifi_p2p_iface.cpp
new file mode 100644
index 0000000..349a158
--- /dev/null
+++ b/wifi/1.0/default/wifi_p2p_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "wifi_p2p_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiP2pIface::WifiP2pIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiP2pIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiP2pIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiP2pIface::getType() {
+ return IfaceType::P2P;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_p2p_iface.h b/wifi/1.0/default/wifi_p2p_iface.h
new file mode 100644
index 0000000..d70415d
--- /dev/null
+++ b/wifi/1.0/default/wifi_p2p_iface.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 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 WIFI_P2P_IFACE_H_
+#define WIFI_P2P_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiP2pIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a P2P Iface instance.
+ */
+class WifiP2pIface : public IWifiP2pIface {
+ public:
+ WifiP2pIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiP2pIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_P2P_IFACE_H_
diff --git a/wifi/1.0/default/wifi_rtt_controller.cpp b/wifi/1.0/default/wifi_rtt_controller.cpp
new file mode 100644
index 0000000..e2df1a8
--- /dev/null
+++ b/wifi/1.0/default/wifi_rtt_controller.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "wifi_rtt_controller.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiRttController::WifiRttController(
+ const sp<IWifiIface>& bound_iface,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiRttController::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiRttController::getBoundIface(getBoundIface_cb cb) {
+ cb(bound_iface_);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_rtt_controller.h b/wifi/1.0/default/wifi_rtt_controller.h
new file mode 100644
index 0000000..8d78b93
--- /dev/null
+++ b/wifi/1.0/default/wifi_rtt_controller.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 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 WIFI_RTT_CONTROLLER_H_
+#define WIFI_RTT_CONTROLLER_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiIface.h>
+#include <android/hardware/wifi/1.0/IWifiRttController.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control all RTT operations.
+ */
+class WifiRttController : public IWifiRttController {
+ public:
+ WifiRttController(const sp<IWifiIface>& bound_iface,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getBoundIface(getBoundIface_cb cb) override;
+
+ private:
+ sp<IWifiIface> bound_iface_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiRttController);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_RTT_CONTROLLER_H_
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.0/default/wifi_sta_iface.cpp
new file mode 100644
index 0000000..225cec4
--- /dev/null
+++ b/wifi/1.0/default/wifi_sta_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "wifi_sta_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiStaIface::WifiStaIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiStaIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiStaIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiStaIface::getType() {
+ return IfaceType::STA;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_sta_iface.h b/wifi/1.0/default/wifi_sta_iface.h
new file mode 100644
index 0000000..fc5efec
--- /dev/null
+++ b/wifi/1.0/default/wifi_sta_iface.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 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 WIFI_STA_IFACE_H_
+#define WIFI_STA_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiStaIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a STA Iface instance.
+ */
+class WifiStaIface : public IWifiStaIface {
+ public:
+ WifiStaIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiStaIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_STA_IFACE_H_
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 49849ea..d9abaef 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -16,6 +16,9 @@
package android.hardware.wifi@1.0;
+/**
+ * List of failure reasons returned.
+ */
enum CommandFailureReason : uint32_t {
UNKNOWN,
DUPLICATE_COMMAND_ID,
@@ -41,6 +44,25 @@
};
/**
+ * List of Iface types supported.
+ */
+enum IfaceType : uint32_t {
+ STA,
+ AP,
+ P2P,
+ /**
+ * NAN control interface. Datapath support may be queried and created
+ * through this interface.
+ */
+ NAN,
+};
+
+/**
+ * An identifier assigned to every chip on the device.
+ */
+typedef uint32_t ChipId;
+
+/**
* An identifier for a mode that the chip can be put in.
*/
typedef uint32_t ChipModeId;