diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 6 | ||||
| -rw-r--r-- | libs/gui/tests/Android.mk | 10 | ||||
| -rw-r--r-- | libs/utils/Threads.cpp | 35 |
3 files changed, 42 insertions, 9 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 3b0ffea0ff..00a4bf63ca 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -102,7 +102,7 @@ class Composer : public Singleton<Composer> public: status_t setPosition(const sp<SurfaceComposerClient>& client, SurfaceID id, - int32_t x, int32_t y); + float x, float y); status_t setSize(const sp<SurfaceComposerClient>& client, SurfaceID id, uint32_t w, uint32_t h); status_t setLayer(const sp<SurfaceComposerClient>& client, SurfaceID id, @@ -161,7 +161,7 @@ layer_state_t* Composer::getLayerStateLocked( } status_t Composer::setPosition(const sp<SurfaceComposerClient>& client, - SurfaceID id, int32_t x, int32_t y) { + SurfaceID id, float x, float y) { Mutex::Autolock _l(mLock); layer_state_t* s = getLayerStateLocked(client, id); if (!s) @@ -372,7 +372,7 @@ status_t SurfaceComposerClient::setFreezeTint(SurfaceID id, uint32_t tint) { return getComposer().setFreezeTint(this, id, tint); } -status_t SurfaceComposerClient::setPosition(SurfaceID id, int32_t x, int32_t y) { +status_t SurfaceComposerClient::setPosition(SurfaceID id, float x, float y) { return getComposer().setPosition(this, id, x, y); } diff --git a/libs/gui/tests/Android.mk b/libs/gui/tests/Android.mk index 0308af3abf..55ac1330e9 100644 --- a/libs/gui/tests/Android.mk +++ b/libs/gui/tests/Android.mk @@ -1,4 +1,4 @@ -# Build the unit tests. +# Build the unit tests, LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) @@ -22,17 +22,15 @@ LOCAL_SHARED_LIBRARIES := \ libui \ libutils \ -LOCAL_STATIC_LIBRARIES := \ - libgtest \ - libgtest_main \ - LOCAL_C_INCLUDES := \ bionic \ bionic/libstdc++/include \ external/gtest/include \ external/stlport/stlport \ -include $(BUILD_EXECUTABLE) +# Build the binary to $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE) +# to integrate with auto-test framework. +include $(BUILD_NATIVE_TEST) # Include subdirectory makefiles # ============================================================ diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp index d18c0a2f5a..02c380b0e5 100644 --- a/libs/utils/Threads.cpp +++ b/libs/utils/Threads.cpp @@ -368,6 +368,41 @@ int androidSetThreadPriority(pid_t tid, int pri) return rc; } +int androidGetThreadSchedulingGroup(pid_t tid) +{ + int ret = ANDROID_TGROUP_DEFAULT; + +#if defined(HAVE_PTHREADS) + // convention is to not call get/set_sched_policy methods if disabled by property + pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup); + if (gDoSchedulingGroup) { + SchedPolicy policy; + // get_sched_policy does not support tid == 0 + if (tid == 0) { + tid = androidGetTid(); + } + if (get_sched_policy(tid, &policy) < 0) { + ret = INVALID_OPERATION; + } else { + switch (policy) { + case SP_BACKGROUND: + ret = ANDROID_TGROUP_BG_NONINTERACT; + break; + case SP_FOREGROUND: + ret = ANDROID_TGROUP_FG_BOOST; + break; + default: + // should not happen, as enum SchedPolicy does not have any other values + ret = INVALID_OPERATION; + break; + } + } + } +#endif + + return ret; +} + namespace android { /* |