SF: add a backdoor to introduce a janky frame to HWC
Bug: 346503493
Test: adb shell service call SurfaceFlinger 1046 i32 3Test: adb root && adb shell service call SurfaceFlinger 1046 i32 3
Flag: EXEMPT bugfix
Change-Id: Ic4a837ef06aca40a24db9c1121e19e3e1a1e0d80
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 9854174..f9e5db0 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -6263,7 +6263,7 @@
}
// Numbers from 1000 to 1045 are currently used for backdoors. The code
// in onTransact verifies that the user is root, and has access to use SF.
- if (code >= 1000 && code <= 1045) {
+ if (code >= 1000 && code <= 1046) {
ALOGV("Accessing SurfaceFlinger through backdoor code: %u", code);
return OK;
}
@@ -6796,6 +6796,15 @@
}
return err;
}
+ // Introduce jank to HWC
+ case 1046: {
+ int32_t jankDelayMs = 0;
+ if (data.readInt32(&jankDelayMs) != NO_ERROR) {
+ return BAD_VALUE;
+ }
+ mScheduler->setDebugPresentDelay(TimePoint::fromNs(ms2ns(jankDelayMs)));
+ return NO_ERROR;
+ }
}
}
return err;