SF: fix binder thread priority
Add setMinSchedulerPolicy to all binder interfaces SF exposes.
It was missing from gui::ISurfaceComposer and
gui::IDisplayEventConnection.
Test: presubmit
Bug: 299378819
Change-Id: Ia0d99efa5a3bc58625c320d4df3c08bb597d2e38
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 12aacad..3f52444 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -113,6 +113,7 @@
#include <vector>
#include <gui/LayerStatePermissions.h>
+#include <gui/SchedulingPolicy.h>
#include <ui/DisplayIdentification.h>
#include "BackgroundExecutor.h"
#include "Client.h"
@@ -6579,6 +6580,7 @@
case GET_ACTIVE_DISPLAY_MODE:
case GET_DISPLAY_COLOR_MODES:
case GET_DISPLAY_MODES:
+ case GET_SCHEDULING_POLICY:
// Calling setTransactionState is safe, because you need to have been
// granted a reference to Client* and Handle* to do anything with it.
case SET_TRANSACTION_STATE: {
@@ -9016,6 +9018,10 @@
const sp<Client> client = sp<Client>::make(mFlinger);
if (client->initCheck() == NO_ERROR) {
*outClient = client;
+ if (flags::misc1()) {
+ const int policy = SCHED_FIFO;
+ client->setMinSchedulerPolicy(policy, sched_get_priority_min(policy));
+ }
return binder::Status::ok();
} else {
*outClient = nullptr;
@@ -9797,6 +9803,10 @@
return binderStatusFromStatusT(status);
}
+binder::Status SurfaceComposerAIDL::getSchedulingPolicy(gui::SchedulingPolicy* outPolicy) {
+ return gui::getSchedulingPolicy(outPolicy);
+}
+
status_t SurfaceComposerAIDL::checkAccessPermission(bool usePermissionCache) {
if (!mFlinger->callingThreadHasUnscopedSurfaceFlingerAccess(usePermissionCache)) {
IPCThreadState* ipc = IPCThreadState::self();