diff options
author | Christopher Wiley <wiley@google.com> | 2016-04-13 12:21:35 -0700 |
---|---|---|
committer | Christopher Wiley <wiley@google.com> | 2016-04-26 16:09:57 +0000 |
commit | ebffc4c034597531a955805eabecf3d6a2f34f82 (patch) | |
tree | 93a655d4fed18fe3e5cc9554eef1dccc63e02f85 | |
parent | 22879aab255d55b5b07a5467d8ea48c01c5f7a7a (diff) | |
download | peripheralmanager-ebffc4c034597531a955805eabecf3d6a2f34f82.tar.gz |
Replace ScopedFd with unique_fd
aidl-cpp will generate code using unique_fd in the near future.
While here, also make the binder intermediates library depend on
libbinder in order to obtain proper header include paths.
Bug: 27804373
Change-Id: Ia36dba111f3ff824d34612dedcb202612ed4ba35
Test: Compiles with accompanying changes.
-rw-r--r-- | client/gpio_impl.cc | 3 | ||||
-rw-r--r-- | daemon/gpio_driver.h | 4 | ||||
-rw-r--r-- | daemon/gpio_driver_mock.h | 2 | ||||
-rw-r--r-- | daemon/gpio_driver_sysfs.cc | 2 | ||||
-rw-r--r-- | daemon/gpio_driver_sysfs.h | 2 | ||||
-rw-r--r-- | daemon/gpio_manager.h | 2 | ||||
-rw-r--r-- | daemon/peripheral_manager_client.cc | 5 | ||||
-rw-r--r-- | daemon/peripheral_manager_client.h | 2 | ||||
-rw-r--r-- | ipc/Android.mk | 2 |
9 files changed, 14 insertions, 10 deletions
diff --git a/client/gpio_impl.cc b/client/gpio_impl.cc index cf57613..dfe5f83 100644 --- a/client/gpio_impl.cc +++ b/client/gpio_impl.cc @@ -16,6 +16,7 @@ #include "gpio_impl.h" +#include <android-base/unique_fd.h> #include <binder/Status.h> #include "peripheralmanager/constants.h" @@ -105,7 +106,7 @@ int GpioImpl::GetValue(int* value) { } int GpioImpl::GetPollingFd(int* fd) { - ScopedFd scoped_fd; + android::base::unique_fd scoped_fd; Status ret = client_->GetGpioPollingFd(name_, &scoped_fd); if (ret.isOk()) { uint8_t buf[2]; diff --git a/daemon/gpio_driver.h b/daemon/gpio_driver.h index f157ffc..20dcbb1 100644 --- a/daemon/gpio_driver.h +++ b/daemon/gpio_driver.h @@ -22,8 +22,8 @@ #include <memory> #include <string> +#include <android-base/unique_fd.h> #include <base/macros.h> -#include <nativehelper/ScopedFd.h> #include <peripheralmanager/constants.h> namespace android { @@ -43,7 +43,7 @@ class GpioDriverInterface { virtual bool SetActiveType(GpioActiveType type) = 0; virtual bool SetDirection(GpioDirection direction) = 0; virtual bool SetEdgeType(GpioEdgeType type) = 0; - virtual bool GetPollingFd(ScopedFd* fd) = 0; + virtual bool GetPollingFd(::android::base::unique_fd* fd) = 0; }; // The following is driver boilerplate. diff --git a/daemon/gpio_driver_mock.h b/daemon/gpio_driver_mock.h index 0025325..4c52f4c 100644 --- a/daemon/gpio_driver_mock.h +++ b/daemon/gpio_driver_mock.h @@ -40,7 +40,7 @@ class GpioDriverMock : public GpioDriverInterface { bool SetActiveType(GpioActiveType type) { return true; }; bool SetDirection(GpioDirection direction) { return true; }; bool SetEdgeType(GpioEdgeType type) { return true; }; - bool GetPollingFd(ScopedFd* fd) { return true; }; + bool GetPollingFd(::android::base::unique_fd* fd) { return true; }; private: DISALLOW_COPY_AND_ASSIGN(GpioDriverMock); diff --git a/daemon/gpio_driver_sysfs.cc b/daemon/gpio_driver_sysfs.cc index 683cb94..f1b75b0 100644 --- a/daemon/gpio_driver_sysfs.cc +++ b/daemon/gpio_driver_sysfs.cc @@ -145,7 +145,7 @@ bool GpioDriverSysfs::SetEdgeType(GpioEdgeType type) { return false; } -bool GpioDriverSysfs::GetPollingFd(ScopedFd* fd) { +bool GpioDriverSysfs::GetPollingFd(::android::base::unique_fd* fd) { int f = openat(fd_, kValue, O_RDWR); if (f < 0) return false; diff --git a/daemon/gpio_driver_sysfs.h b/daemon/gpio_driver_sysfs.h index 1fbe2d1..21e33af 100644 --- a/daemon/gpio_driver_sysfs.h +++ b/daemon/gpio_driver_sysfs.h @@ -40,7 +40,7 @@ class GpioDriverSysfs : public GpioDriverInterface { bool SetActiveType(GpioActiveType type) override; bool SetDirection(GpioDirection direction) override; bool SetEdgeType(GpioEdgeType type) override; - bool GetPollingFd(ScopedFd* fd) override; + bool GetPollingFd(::android::base::unique_fd* fd) override; private: bool Enable(); diff --git a/daemon/gpio_manager.h b/daemon/gpio_manager.h index a72431a..c691f26 100644 --- a/daemon/gpio_manager.h +++ b/daemon/gpio_manager.h @@ -74,7 +74,7 @@ class GpioPin { return pin_->driver_->SetEdgeType(type); } - bool GetPollingFd(ScopedFd* fd) { + bool GetPollingFd(::android::base::unique_fd* fd) { return pin_->driver_->GetPollingFd(fd); } diff --git a/daemon/peripheral_manager_client.cc b/daemon/peripheral_manager_client.cc index b862dba..bd05537 100644 --- a/daemon/peripheral_manager_client.cc +++ b/daemon/peripheral_manager_client.cc @@ -101,8 +101,9 @@ Status PeripheralManagerClient::GetGpioValue(const std::string& name, return Status::fromServiceSpecificError(EREMOTEIO); } -Status PeripheralManagerClient::GetGpioPollingFd(const std::string& name, - ScopedFd* fd) { +Status PeripheralManagerClient::GetGpioPollingFd( + const std::string& name, + ::android::base::unique_fd* fd) { if (!gpios_.count(name)) return Status::fromServiceSpecificError(EPERM); diff --git a/daemon/peripheral_manager_client.h b/daemon/peripheral_manager_client.h index bbf2954..4db211d 100644 --- a/daemon/peripheral_manager_client.h +++ b/daemon/peripheral_manager_client.h @@ -59,7 +59,7 @@ class PeripheralManagerClient : public BnPeripheralManagerClient { virtual Status GetGpioValue(const std::string& name, bool* value) override; virtual Status GetGpioPollingFd(const std::string& name, - ScopedFd* fd) override; + ::android::base::unique_fd* fd) override; // Spi functions. virtual Status ListSpiBuses(std::vector<std::string>* buses) override; diff --git a/ipc/Android.mk b/ipc/Android.mk index a393289..1d132fe 100644 --- a/ipc/Android.mk +++ b/ipc/Android.mk @@ -26,6 +26,8 @@ LOCAL_SRC_FILES := \ android/os/IPeripheralManagerClient.aidl \ android/os/IPeripheralManager.aidl \ +LOCAL_SHARED_LIBRARIES := libbinder + LOCAL_AIDL_INCLUDES := $(LOCAL_PATH) include $(BUILD_STATIC_LIBRARY) |