@@ -215,6 +215,7 @@ public final class ViewRootImpl extends Handler implements ViewParent,
215215 boolean mLastWasImTarget ;
216216
217217 boolean mWindowAttributesChanged = false ;
218+ int mWindowAttributesChangesFlag = 0 ;
218219
219220 // These can be accessed by any thread, must be protected with a lock.
220221 // Surface can never be reassigned or cleared (use Surface.clear()).
@@ -439,6 +440,7 @@ public void setView(View view, WindowManager.LayoutParams attrs, View panelParen
439440
440441 mSoftInputMode = attrs .softInputMode ;
441442 mWindowAttributesChanged = true ;
443+ mWindowAttributesChangesFlag = WindowManager .LayoutParams .EVERYTHING_CHANGED ;
442444 mAttachInfo .mRootView = view ;
443445 mAttachInfo .mScalingRequired = mTranslator != null ;
444446 mAttachInfo .mApplicationScale =
@@ -640,7 +642,7 @@ void setLayoutParams(WindowManager.LayoutParams attrs, boolean newView) {
640642 // preserve compatible window flag if exists.
641643 int compatibleWindowFlag =
642644 mWindowAttributes .flags & WindowManager .LayoutParams .FLAG_COMPATIBLE_WINDOW ;
643- mWindowAttributes .copyFrom (attrs );
645+ mWindowAttributesChangesFlag = mWindowAttributes .copyFrom (attrs );
644646 mWindowAttributes .flags |= compatibleWindowFlag ;
645647
646648 if (newView ) {
@@ -844,14 +846,17 @@ private void performTraversals() {
844846 || mNewSurfaceNeeded ;
845847
846848 WindowManager .LayoutParams params = null ;
849+ int windowAttributesChanges = 0 ;
847850 if (mWindowAttributesChanged ) {
848851 mWindowAttributesChanged = false ;
849852 surfaceChanged = true ;
850853 params = lp ;
854+ windowAttributesChanges = mWindowAttributesChangesFlag ;
851855 }
852856 CompatibilityInfo compatibilityInfo = mCompatibilityInfo .get ();
853857 if (compatibilityInfo .supportsScreen () == mLastInCompatMode ) {
854858 params = lp ;
859+ windowAttributesChanges |= WindowManager .LayoutParams .BUFFER_CHANGED ;
855860 fullRedrawNeeded = true ;
856861 mLayoutRequested = true ;
857862 if (mLastInCompatMode ) {
@@ -862,6 +867,9 @@ private void performTraversals() {
862867 mLastInCompatMode = true ;
863868 }
864869 }
870+
871+ mWindowAttributesChangesFlag = 0 ;
872+
865873 Rect frame = mWinFrame ;
866874 if (mFirst ) {
867875 fullRedrawNeeded = true ;
@@ -1041,6 +1049,7 @@ private void performTraversals() {
10411049 || attachInfo .mSystemUiVisibility != oldVis
10421050 || attachInfo .mHasSystemUiListeners ) {
10431051 params = lp ;
1052+ windowAttributesChanges |= WindowManager .LayoutParams .BUFFER_CHANGED ;
10441053 }
10451054 }
10461055
@@ -1066,6 +1075,7 @@ private void performTraversals() {
10661075 ~WindowManager .LayoutParams .SOFT_INPUT_MASK_ADJUST ) |
10671076 resizeMode ;
10681077 params = lp ;
1078+ windowAttributesChanges |= WindowManager .LayoutParams .BUFFER_CHANGED ;
10691079 }
10701080 }
10711081 }
@@ -1362,7 +1372,8 @@ private void performTraversals() {
13621372 }
13631373 }
13641374
1365- if (hwInitialized || ((windowShouldResize || params != null ) &&
1375+ if (hwInitialized || ((windowShouldResize || (params != null &&
1376+ (windowAttributesChanges & WindowManager .LayoutParams .BUFFER_CHANGED ) != 0 )) &&
13661377 mAttachInfo .mHardwareRenderer != null &&
13671378 mAttachInfo .mHardwareRenderer .isEnabled ())) {
13681379 mAttachInfo .mHardwareRenderer .setup (mWidth , mHeight );
@@ -1637,6 +1648,7 @@ public void requestTransparentRegion(View child) {
16371648 // Need to make sure we re-evaluate the window attributes next
16381649 // time around, to ensure the window has the correct format.
16391650 mWindowAttributesChanged = true ;
1651+ mWindowAttributesChangesFlag = 0 ;
16401652 requestLayout ();
16411653 }
16421654 }
0 commit comments