summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Olivier Gaillard <gaillard@google.com> 2018-12-11 23:09:05 +0000
committer Olivier Gaillard <gaillard@google.com> 2018-12-13 13:40:27 +0000
commita16b83c2db2a0ff76a2d313d84c3875c07317d30 (patch)
treed2e14e7d11e97d80b90617444e554c95abf9572a
parent02e7db9b6adfb83b714cd11c22f54c1eec9c084d (diff)
Fix x86 bug with restoreCallingWorkSource
Test: atest BinderWorkSourceTest Change-Id: Ia26f5a0164957fee22e66b7aaef83c84c9f56c70
-rw-r--r--core/jni/android_util_Binder.cpp2
-rw-r--r--core/tests/coretests/src/android/os/BinderWorkSourceTest.java2
2 files changed, 3 insertions, 1 deletions
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 4f8bbc1396c8..3329e2047085 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -919,7 +919,7 @@ static jlong android_os_Binder_clearCallingWorkSource()
return IPCThreadState::self()->clearCallingWorkSource();
}
-static void android_os_Binder_restoreCallingWorkSource(long token)
+static void android_os_Binder_restoreCallingWorkSource(jlong token)
{
IPCThreadState::self()->restoreCallingWorkSource(token);
}
diff --git a/core/tests/coretests/src/android/os/BinderWorkSourceTest.java b/core/tests/coretests/src/android/os/BinderWorkSourceTest.java
index d1dbd3ccba33..ef14b00f9775 100644
--- a/core/tests/coretests/src/android/os/BinderWorkSourceTest.java
+++ b/core/tests/coretests/src/android/os/BinderWorkSourceTest.java
@@ -125,8 +125,10 @@ public class BinderWorkSourceTest {
Binder.setCallingWorkSourceUid(UID);
long token = Binder.clearCallingWorkSource();
Binder.restoreCallingWorkSource(token);
+ assertEquals(UID, Binder.getCallingWorkSourceUid());
assertEquals(UID, mService.getIncomingWorkSourceUid());
+ // Still the same after the binder transaction.
assertEquals(UID, Binder.getCallingWorkSourceUid());
}