summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2021-04-13 20:40:54 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-04-13 20:40:54 +0000
commitba8e67a377c500dc334cb21c37e3ee210793fcbd (patch)
tree8fda3a02a1f555aa6155e8546a4216fbe513d41b
parentfb44e5fa11a54df69ed2afa9293c9a8bbd52cc7c (diff)
parentfb85366f1ca60b60ad7d2ff310ac061229ab8774 (diff)
Merge "SF: add display id to 1035 backdoor" into sc-dev
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index c6d43c848b..047b2f5437 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -5515,9 +5515,24 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
const int modeId = data.readInt32();
mDebugDisplayModeSetByBackdoor = false;
- const auto displayId = getInternalDisplayId();
+ const auto displayId = [&]() -> std::optional<PhysicalDisplayId> {
+ uint64_t inputDisplayId = 0;
+ if (data.readUint64(&inputDisplayId) == NO_ERROR) {
+ const auto token = getPhysicalDisplayToken(
+ static_cast<PhysicalDisplayId>(inputDisplayId));
+ if (!token) {
+ ALOGE("No display with id: %" PRIu64, inputDisplayId);
+ return std::nullopt;
+ }
+
+ return std::make_optional<PhysicalDisplayId>(inputDisplayId);
+ }
+
+ return getInternalDisplayId();
+ }();
+
if (!displayId) {
- ALOGE("No internal display found.");
+ ALOGE("No display found");
return NO_ERROR;
}
@@ -6230,6 +6245,11 @@ status_t SurfaceFlinger::setDesiredDisplayModeSpecsInternal(
"Can only set override policy on the primary display");
LOG_ALWAYS_FATAL_IF(!policy && !overridePolicy, "Can only clear the override policy");
+ if (mDebugDisplayModeSetByBackdoor) {
+ // ignore this request as mode is overridden by backdoor
+ return NO_ERROR;
+ }
+
if (!display->isPrimary()) {
// TODO(b/144711714): For non-primary displays we should be able to set an active mode
// as well. For now, just call directly to initiateModeChange but ideally
@@ -6256,11 +6276,6 @@ status_t SurfaceFlinger::setDesiredDisplayModeSpecsInternal(
return NO_ERROR;
}
- if (mDebugDisplayModeSetByBackdoor) {
- // ignore this request as mode is overridden by backdoor
- return NO_ERROR;
- }
-
status_t setPolicyResult = overridePolicy
? mRefreshRateConfigs->setOverridePolicy(policy)
: mRefreshRateConfigs->setDisplayManagerPolicy(*policy);