SurfaceFlinger: Dont show Animation on External Display
- With this change the animation effect will not be shown on
external display.
- It will change from portrait to landscape in one shot.
- Primary would still continue the animation effect
- set property sys.disable_ext_animation to disable animation
CRs-fixed: 453747
Conflicts:
services/surfaceflinger/DisplayHardware/HWComposer.cpp
services/surfaceflinger/DisplayHardware/HWComposer.h
Conflicts:
services/surfaceflinger/DisplayHardware/HWComposer.cpp
Change-Id: Ibd94bf166f08eeab1d504afe69230f7c6a617eb6
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f8bf368..cf9845f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1066,6 +1066,26 @@
sp<const DisplayDevice> hw(mDisplays[dpy]);
const int32_t id = hw->getHwcDisplayId();
if (id >= 0) {
+ // Get the layers in the current drawying state
+ const LayerVector& layers(mDrawingState.layersSortedByZ);
+ bool freezeSurfacePresent = false;
+ const size_t layerCount = layers.size();
+ char value[PROPERTY_VALUE_MAX];
+ property_get("sys.disable_ext_animation", value, "0");
+ if(atoi(value)) {
+ for (size_t i = 0 ; i < layerCount ; ++i) {
+ static int screenShotLen = strlen("ScreenshotSurface");
+ const sp<Layer>& layer(layers[i]);
+ if(!strncmp(layer->getName(), "ScreenshotSurface",
+ screenShotLen)) {
+ // Screenshot layer is present, and animation in
+ // progress
+ freezeSurfacePresent = true;
+ break;
+ }
+ }
+ }
+
const Vector< sp<Layer> >& currentLayers(
hw->getVisibleLayersSortedByZ());
const size_t count = currentLayers.size();
@@ -1078,6 +1098,26 @@
*/
const sp<Layer>& layer(currentLayers[i]);
layer->setPerFrameData(hw, *cur);
+ if(freezeSurfacePresent) {
+ // if freezeSurfacePresent, set ANIMATING flag
+ cur->setAnimating(true);
+ } else {
+ const KeyedVector<wp<IBinder>, DisplayDeviceState>&
+ draw(mDrawingState.displays);
+ size_t dc = draw.size();
+ for (size_t i=0 ; i<dc ; i++) {
+ if (draw[i].isMainDisplay()) {
+ HWComposer& hwc(getHwComposer());
+ if (hwc.initCheck() == NO_ERROR)
+ // Pass the current orientation to HWC
+ // which will be used to block animation
+ // on external
+ hwc.eventControl(HWC_DISPLAY_PRIMARY,
+ SurfaceFlinger::EVENT_ORIENTATION,
+ uint32_t(draw[i].orientation));
+ }
+ }
+ }
}
}
}