From 134ad6ef3f9cb62f8c98f2f494836d73e4a9f700 Mon Sep 17 00:00:00 2001 From: Michael Kwan Date: Fri, 10 Feb 2017 18:38:34 -0800 Subject: Only modify window layout params when necessary. Cancelling swipe-to-dismiss will trigger a check to ensure the window is reset to its original state. Ensure that the reset is actually required before setting the new layout attributes. Bug: 34816397 Change-Id: Idf26ce7c8b63dc44a76effefcb32eb8d8665f605 --- core/java/com/android/internal/policy/PhoneWindow.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 920a6cb0f84c..3b280ad20d41 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -3016,10 +3016,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { @Override public void onSwipeCancelled(SwipeDismissLayout layout) { WindowManager.LayoutParams newParams = getAttributes(); - newParams.x = 0; - newParams.alpha = 1; - setAttributes(newParams); - setFlags(FLAG_FULLSCREEN, FLAG_FULLSCREEN | FLAG_LAYOUT_NO_LIMITS); + // Swipe changes only affect the x-translation and alpha, check to see if + // those values have changed first before resetting them. + if (newParams.x != 0 || newParams.alpha != 1) { + newParams.x = 0; + newParams.alpha = 1; + setAttributes(newParams); + setFlags(FLAG_FULLSCREEN, FLAG_FULLSCREEN | FLAG_LAYOUT_NO_LIMITS); + } } }); } -- cgit v1.2.3-59-g8ed1b