From 4bb17ec37babef0b468b02fc57ba1329883e8b48 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 17 May 2018 19:08:21 +0200 Subject: [PATCH] WM: Perform layout based on the requested flags When the global system ui visibility changes, this clears certain sysui flags from windows. However, if we then use this value to perform layout, we might lay out the window in a way the app did not expect and that is not stable during transitions in and out of full screen. To fix this, always use the sysUiFl that the app provided in its window attributes, instead of using the window state's changing state. Change-Id: I5f9b3ed37be84553e9e2d912a102675beb6fc11a Fixes: 76084813 Test: Open Video in browser, enter full screen, play, press home. Verify transition into PiP is smooth. --- .../java/com/android/server/policy/PhoneWindowManager.java | 2 +- .../core/java/com/android/server/policy/PolicyControl.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 16440c8189592..fefec862cf19d 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -5078,7 +5078,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final int fl = PolicyControl.getWindowFlags(win, attrs); final int pfl = attrs.privateFlags; final int sim = attrs.softInputMode; - final int requestedSysUiFl = PolicyControl.getSystemUiVisibility(win, null); + final int requestedSysUiFl = PolicyControl.getSystemUiVisibility(null, attrs); final int sysUiFl = requestedSysUiFl | getImpliedSysUiFlagsForLayout(attrs); final Rect pf = mTmpParentFrame; diff --git a/services/core/java/com/android/server/policy/PolicyControl.java b/services/core/java/com/android/server/policy/PolicyControl.java index 3f26d867b6a05..48e72bc5036de 100644 --- a/services/core/java/com/android/server/policy/PolicyControl.java +++ b/services/core/java/com/android/server/policy/PolicyControl.java @@ -65,7 +65,8 @@ public class PolicyControl { public static int getSystemUiVisibility(WindowState win, LayoutParams attrs) { attrs = attrs != null ? attrs : win.getAttrs(); - int vis = win != null ? win.getSystemUiVisibility() : attrs.systemUiVisibility; + int vis = win != null ? win.getSystemUiVisibility() + : (attrs.systemUiVisibility | attrs.subtreeSystemUiVisibility); if (sImmersiveStatusFilter != null && sImmersiveStatusFilter.matches(attrs)) { vis |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN