From 2dfcf5ce2e96073d6cb875d048684e0a074ce2b6 Mon Sep 17 00:00:00 2001 From: Filip Gruszczynski Date: Tue, 13 Oct 2015 18:00:29 -0700 Subject: [PATCH] Keep freeform window surface translucent during resize. Freeform window surfaces are translucent because most of the time they have shadows. During a resize we stop displaying the shadow, which might change the surface opacity from translucent to opaque. This change only happens if the activity gets recreated during the resize, as this triggers recalculation of the necessary opacity. If configuration change happens the relayout will now contain new, opaque pixel format and cause the recreation. The second blink will happen after we finish resizing, as the surface needs to become translucent again. Bug: 24668341 Change-Id: I450323276c49f176f0f6dfb3b21a5f6d742a8418 --- core/java/com/android/internal/policy/PhoneWindow.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index ab372d30e2719..75ad916ab9b39 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -3705,13 +3705,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } /** - * Returns true if the Window is free floating and has a shadow. Note that non overlapping - * windows do not have a shadow since it could not be seen anyways (a small screen / tablet + * Returns true if the Window is free floating and has a shadow (although at some times + * it might not be displaying it, e.g. during a resize). Note that non overlapping windows + * do not have a shadow since it could not be seen anyways (a small screen / tablet * "tiles" the windows side by side but does not overlap them). * @return Returns true when the window has a shadow created by the non client decor. **/ private boolean windowHasShadow() { - return windowHasNonClientDecor() && getElevation() > 0; + return windowHasNonClientDecor() && nonClientDecorHasShadow(mWindow.mWorkspaceId); } void setWindow(PhoneWindow phoneWindow) { @@ -5417,7 +5418,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { * @param workspaceId The Id of the workspace which contains this window. * @Return Returns true if the window should show a shadow. **/ - private boolean nonClientDecorHasShadow(int workspaceId) { + private static boolean nonClientDecorHasShadow(int workspaceId) { return workspaceId == FREEFORM_WORKSPACE_STACK_ID; }