Ignore the preferredModeId for non-focussed windows

If a window sets preferredModeId, and then enters pip mode. Then if the
mode/refresh-rate/resolution is chosen by user from Settings menu, it doesn't take
effect because of preferredModeId of the pip window.

Bug: 232711732
Test: atest DisplayContentTests
Change-Id: Ief48c38ff9dc85c9033d502cc4006130678ae808
This commit is contained in:
Kriti Dang
2022-08-03 16:50:31 +02:00
parent 016675bcab
commit 3f864738e2

View File

@@ -950,7 +950,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
final int preferredModeId = getDisplayPolicy().getRefreshRatePolicy()
.getPreferredModeId(w);
if (mTmpApplySurfaceChangesTransactionState.preferredModeId == 0
if (w.isFocused() && mTmpApplySurfaceChangesTransactionState.preferredModeId == 0
&& preferredModeId != 0) {
mTmpApplySurfaceChangesTransactionState.preferredModeId = preferredModeId;
}