diff --git a/core/tests/coretests/Android.mk b/core/tests/coretests/Android.mk
index c067b8008a3e6..245c67cf40021 100644
--- a/core/tests/coretests/Android.mk
+++ b/core/tests/coretests/Android.mk
@@ -7,9 +7,9 @@ LOCAL_MODULE_TAGS := tests
# Include all test java files.
LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
+ $(call all-Iaidl-files-under, src) \
$(call all-java-files-under, DisabledTestApp/src) \
- $(call all-java-files-under, EnabledTestApp/src) \
- src/android/os/IAidlTest.aidl
+ $(call all-java-files-under, EnabledTestApp/src)
LOCAL_STATIC_JAVA_LIBRARIES += android-common
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml
index 30855d17ffe3a..a77717fde8a64 100644
--- a/core/tests/coretests/AndroidManifest.xml
+++ b/core/tests/coretests/AndroidManifest.xml
@@ -1179,8 +1179,11 @@
-
+ android:process=":messengerService" />
+
+
+
@@ -1198,13 +1201,6 @@
android:authorities="android.app.SuggestionProvider">
-
-
-
-
= -20; prio--) {
+ Process.setThreadPriority(prio);
+
+ // Local
+ assertEquals(prio, Process.getThreadPriority(Process.myTid()));
+ assertEquals(expectedSchedulerGroup(prio), getSchedulerGroup());
+
+ // Remote
+ assertEquals(prio, mService.getThreadPriority());
+ assertEquals(expectedSchedulerGroup(prio), mService.getThreadSchedulerGroup());
+ }
+ }
+
+ public void testCallBackFromServiceWithPriority() throws Exception {
+ for (int prio = -20; prio <= 19; prio++) {
+ final int expected = prio;
+ mService.setPriorityAndCallBack(prio, new ServiceStub() {
+ public void callBack(IBinderThreadPriorityService cb) {
+ assertEquals(expected, Process.getThreadPriority(Process.myTid()));
+ assertEquals(expectedSchedulerGroup(expected), getSchedulerGroup());
+ }
+ });
+
+ assertEquals(mSavedPriority, Process.getThreadPriority(Process.myTid()));
+
+ // BROKEN -- see bug 2665954 -- scheduler group doesn't get reset
+ // properly after a back-call with a different priority.
+ // assertEquals(expectedSchedulerGroup(mSavedPriority), getSchedulerGroup());
+ }
+ }
+}
diff --git a/core/tests/coretests/src/android/os/IBinderThreadPriorityService.aidl b/core/tests/coretests/src/android/os/IBinderThreadPriorityService.aidl
new file mode 100644
index 0000000000000..b30f04c8e2879
--- /dev/null
+++ b/core/tests/coretests/src/android/os/IBinderThreadPriorityService.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2010 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.os;
+
+interface IBinderThreadPriorityService {
+ int getThreadPriority();
+ String getThreadSchedulerGroup();
+ void callBack(IBinderThreadPriorityService recurse);
+ void setPriorityAndCallBack(int priority, IBinderThreadPriorityService recurse);
+}