Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bb7528f authored by Ebru Kurnaz's avatar Ebru Kurnaz
Browse files

Add flag check before calling the wm api to set the ratio.

Test: atest DisplayDensityUtilsTest
Flag: com.android.window.flags.enable_persisting_display_size_for_connected_displays
Bug: 407753744
Change-Id: I42857f891f444abf90b8f1a9c1bd377ee0217efb
parent 01c534a5
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settingslib.display;

import static android.window.DesktopExperienceFlags.ENABLE_PERSISTING_DISPLAY_SIZE_FOR_CONNECTED_DISPLAYS;

import android.content.Context;
import android.content.res.Resources;
import android.hardware.display.DisplayManager;
@@ -417,7 +419,8 @@ public class DisplayDensityUtils {
                    final IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
                    // Only set the ratio for external displays as Settings uses
                    // ScreenResolutionFragment to handle density update for internal display.
                    if (info.type == Display.TYPE_EXTERNAL) {
                    if (ENABLE_PERSISTING_DISPLAY_SIZE_FOR_CONNECTED_DISPLAYS.isTrue()
                            && info.type == Display.TYPE_EXTERNAL) {
                        wm.setForcedDisplayDensityRatio(displayId,
                                mFloatValues[index] / mDefaultDensity, userId);
                    } else {