Loading bluetooth/1.0/default/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ cc_library_shared { "vendor_interface.cc", ], shared_libs: [ "android.frameworks.schedulerservice@1.0", "android.hardware.bluetooth@1.0", "libbase", "libcutils", Loading @@ -48,6 +49,7 @@ cc_library_static { ], export_include_dirs: ["."], shared_libs: [ "android.frameworks.schedulerservice@1.0", "liblog", ], } Loading Loading @@ -84,9 +86,11 @@ cc_test { "test", ], shared_libs: [ "android.frameworks.schedulerservice@1.0", "libbase", "libhidlbase", "liblog", "libutils", ], static_libs: [ "android.hardware.bluetooth-async", Loading bluetooth/1.0/default/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -35,5 +35,6 @@ LOCAL_SHARED_LIBRARIES += \ libhidlbase \ libhidltransport \ android.hardware.bluetooth@1.0 \ android.frameworks.schedulerservice@1.0\ include $(BUILD_EXECUTABLE) bluetooth/1.0/default/async_fd_watcher.cc +22 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ // limitations under the License. // #define LOG_TAG "android.hardware.bluetooth@1.0-impl" #include "async_fd_watcher.h" #include <algorithm> Loading @@ -22,13 +24,18 @@ #include <map> #include <mutex> #include <thread> #include <utils/Log.h> #include <vector> #include "fcntl.h" #include "sys/select.h" #include "unistd.h" #include <android/frameworks/schedulerservice/1.0/ISchedulingPolicyService.h> static const int INVALID_FD = -1; static const int BT_RT_PRIORITY = 1; namespace android { namespace hardware { namespace bluetooth { Loading Loading @@ -112,6 +119,21 @@ int AsyncFdWatcher::notifyThread() { } void AsyncFdWatcher::ThreadRoutine() { using ::android::frameworks::schedulerservice::V1_0::ISchedulingPolicyService; using ::android::hardware::Return; sp<ISchedulingPolicyService> manager = ISchedulingPolicyService::getService(); if (manager == nullptr) { ALOGE("%s: Couldn't get scheduler manager to set SCHED_FIFO.", __func__); } else { Return<bool> ret = manager->requestPriority(getpid(), gettid(), BT_RT_PRIORITY); if (!ret.isOk() || !ret) { ALOGE("%s unable to set SCHED_FIFO for pid %d, tid %d", __func__, getpid(), gettid()); } } while (running_) { fd_set read_fds; FD_ZERO(&read_fds); Loading Loading
bluetooth/1.0/default/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ cc_library_shared { "vendor_interface.cc", ], shared_libs: [ "android.frameworks.schedulerservice@1.0", "android.hardware.bluetooth@1.0", "libbase", "libcutils", Loading @@ -48,6 +49,7 @@ cc_library_static { ], export_include_dirs: ["."], shared_libs: [ "android.frameworks.schedulerservice@1.0", "liblog", ], } Loading Loading @@ -84,9 +86,11 @@ cc_test { "test", ], shared_libs: [ "android.frameworks.schedulerservice@1.0", "libbase", "libhidlbase", "liblog", "libutils", ], static_libs: [ "android.hardware.bluetooth-async", Loading
bluetooth/1.0/default/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -35,5 +35,6 @@ LOCAL_SHARED_LIBRARIES += \ libhidlbase \ libhidltransport \ android.hardware.bluetooth@1.0 \ android.frameworks.schedulerservice@1.0\ include $(BUILD_EXECUTABLE)
bluetooth/1.0/default/async_fd_watcher.cc +22 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ // limitations under the License. // #define LOG_TAG "android.hardware.bluetooth@1.0-impl" #include "async_fd_watcher.h" #include <algorithm> Loading @@ -22,13 +24,18 @@ #include <map> #include <mutex> #include <thread> #include <utils/Log.h> #include <vector> #include "fcntl.h" #include "sys/select.h" #include "unistd.h" #include <android/frameworks/schedulerservice/1.0/ISchedulingPolicyService.h> static const int INVALID_FD = -1; static const int BT_RT_PRIORITY = 1; namespace android { namespace hardware { namespace bluetooth { Loading Loading @@ -112,6 +119,21 @@ int AsyncFdWatcher::notifyThread() { } void AsyncFdWatcher::ThreadRoutine() { using ::android::frameworks::schedulerservice::V1_0::ISchedulingPolicyService; using ::android::hardware::Return; sp<ISchedulingPolicyService> manager = ISchedulingPolicyService::getService(); if (manager == nullptr) { ALOGE("%s: Couldn't get scheduler manager to set SCHED_FIFO.", __func__); } else { Return<bool> ret = manager->requestPriority(getpid(), gettid(), BT_RT_PRIORITY); if (!ret.isOk() || !ret) { ALOGE("%s unable to set SCHED_FIFO for pid %d, tid %d", __func__, getpid(), gettid()); } } while (running_) { fd_set read_fds; FD_ZERO(&read_fds); Loading