diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 6a4b633df6a24..f292d25c15fe2 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -438,8 +438,9 @@ static jobject nativeGetDisplayedContentSamplingAttributes(JNIEnv* env, jclass c static jboolean nativeSetDisplayedContentSamplingEnabled(JNIEnv* env, jclass clazz, jobject tokenObj, jboolean enable, jint componentMask, jint maxFrames) { sp token(ibinderForJavaObject(env, tokenObj)); - return SurfaceComposerClient::setDisplayContentSamplingEnabled( + status_t rc = SurfaceComposerClient::setDisplayContentSamplingEnabled( token, enable, componentMask, maxFrames); + return rc == OK; } static jobject nativeGetDisplayedContentSample(JNIEnv* env, jclass clazz, jobject tokenObj, diff --git a/services/tests/servicestests/src/com/android/server/display/DisplayManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/display/DisplayManagerServiceTest.java index abf90402250cb..4742a73b17a89 100644 --- a/services/tests/servicestests/src/com/android/server/display/DisplayManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/display/DisplayManagerServiceTest.java @@ -389,7 +389,7 @@ public class DisplayManagerServiceTest { if (attr == null) return; //sampling not supported on device, skip remainder of test. boolean enabled = displayManager.setDisplayedContentSamplingEnabledInternal(0, true, 0, 0); - assertTrue(!enabled); + assertTrue(enabled); displayManager.setDisplayedContentSamplingEnabledInternal(0, false, 0, 0); DisplayedContentSample sample = displayManager.getDisplayedContentSampleInternal(0, 0, 0);