Snap for 7943131 from f1f87d6a4f222fe0166f3420e7dfa61f012859a2 to s-keystone-qcom-release
Change-Id: Ibe3648c7a38ac1446f45638a7efe730d556e6afa
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index ce8cd52..b7d174f 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -701,10 +701,15 @@
}
bool Layer::isScreenshot() const {
- return ((getName().find("ScreenshotSurface") != std::string::npos) ||
- (getName().find("RotationLayer") != std::string::npos) ||
- (getName().find("BackColorSurface") != std::string::npos));
+ return (isScreenshotName(getName()));
}
+
+bool Layer::isScreenshotName(std::string layer_name) {
+ return ((layer_name.find("ScreenshotSurface") != std::string::npos) ||
+ (layer_name.find("RotationLayer") != std::string::npos) ||
+ (layer_name.find("BackColorSurface") != std::string::npos));
+}
+
// ----------------------------------------------------------------------------
// transaction
// ----------------------------------------------------------------------------
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 652b1a6..1e89f99 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -672,6 +672,7 @@
bool isSecureCamera() const;
bool isSecureDisplay() const;
bool isScreenshot() const;
+ static bool isScreenshotName(std::string layer_name);
/*
* isHiddenByPolicy - true if this layer has been forced invisible.
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index e565dec..47ae4de 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2905,13 +2905,17 @@
if (!IsDisplayExternalOrVirtual(displayDevice)) {
continue;
}
- uint32_t hwcDisplayId;
- getHwcDisplayId(displayDevice, &hwcDisplayId);
+ uint32_t hwcDisplayId = 0;
+ if (!getHwcDisplayId(displayDevice, &hwcDisplayId)) {
+ ALOGW("Rot-anim failed to get HWC DisplayID for display '%s'.",
+ displayDevice->getDebugName().c_str());
+ continue;
+ }
if (mDisplayConfigIntf && (hasScreenshot != mHasScreenshot)) {
mDisplayConfigIntf->SetDisplayAnimating(hwcDisplayId, hasScreenshot);
- mHasScreenshot = hasScreenshot;
}
}
+ mHasScreenshot = hasScreenshot;
#endif
}
@@ -5402,6 +5406,35 @@
"Expected only one of parentLayer or parentHandle to be non-null. "
"Programmer error?");
+#ifdef QTI_DISPLAY_CONFIG_ENABLED
+ // Flag rotation animation as early as possible.
+ if (Layer::isScreenshotName(std::string(name))) {
+ // Rotation animation present.
+ bool signal_refresh = true;
+ Mutex::Autolock lock(mStateLock); // Needed for mDisplays and signalRefresh().
+ for (const auto& [token, displayDevice] : mDisplays) {
+ if (!IsDisplayExternalOrVirtual(displayDevice)) {
+ continue;
+ }
+ uint32_t hwcDisplayId = 0;
+ if (mDisplayConfigIntf && (true != mHasScreenshot)) {
+ if (!getHwcDisplayId(displayDevice, &hwcDisplayId)) {
+ ALOGW("Rot-anim failed to get HWC DisplayID for display '%s'.",
+ displayDevice->getDebugName().c_str());
+ continue;
+ }
+ mDisplayConfigIntf->SetDisplayAnimating(hwcDisplayId, true);
+ if (signal_refresh) {
+ // Request composition cycle once.
+ signalRefresh();
+ }
+ signal_refresh = false;
+ }
+ }
+ mHasScreenshot = true;
+ }
+#endif
+
status_t result = NO_ERROR;
sp<Layer> layer;