diff options
author | Tri Vo <trong@google.com> | 2019-02-08 15:33:18 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-02-08 15:33:18 -0800 |
commit | 5b8024f3a484203650c3065e68391a6b26a265ab (patch) | |
tree | a6de32c09aa4203a5f196fc8f536c9bdb712ecf1 | |
parent | 1603bce403566fe7555b1a3c30ea53036b94ec41 (diff) | |
parent | 0d7dfbd354921a8c38ddc736fd598bb95cbb8d37 (diff) | |
download | ashmemd-5b8024f3a484203650c3065e68391a6b26a265ab.tar.gz |
ashmemd: avoid sleep cycle on non-VNDK devices. am: 8411a3b016
am: 0d7dfbd354
Change-Id: I9e14052779e1a5ca04f2a612994440f114b9c484
-rw-r--r-- | ashmemd_client.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ashmemd_client.cpp b/ashmemd_client.cpp index 1984358..3380209 100644 --- a/ashmemd_client.cpp +++ b/ashmemd_client.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <android-base/logging.h> #include <android/ashmemd/IAshmemDeviceService.h> #include <binder/IServiceManager.h> @@ -28,17 +29,23 @@ namespace ashmemd { sp<IAshmemDeviceService> getAshmemService() { sp<IServiceManager> sm = android::defaultServiceManager(); - sp<IBinder> binder = sm->getService(String16("ashmem_device_service")); + sp<IBinder> binder = sm->checkService(String16("ashmem_device_service")); return interface_cast<IAshmemDeviceService>(binder); } extern "C" int openAshmemdFd() { static sp<IAshmemDeviceService> ashmemService = getAshmemService(); - if (!ashmemService) return -1; + if (!ashmemService) { + LOG(ERROR) << "Failed to get IAshmemDeviceService."; + return -1; + } ParcelFileDescriptor fd; auto status = ashmemService->open(&fd); - if (!status.isOk()) return -1; + if (!status.isOk()) { + LOG(ERROR) << "Failed IAshmemDeviceService::open()"; + return -1; + } // unique_fd is the underlying type of ParcelFileDescriptor, i.e. fd is // closed when it falls out of scope, so we make a dup. |