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

Commit b6aa0cc6 authored by Andrii Kulian's avatar Andrii Kulian Committed by Android (Google) Code Review
Browse files

Merge "Fix typo that caused excessive display config updates"

parents 9b89a90a d68501e6
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -322,7 +322,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
        if (!configChanged) {
        if (!configChanged) {
            return null;
            return null;
        }
        }
        displayContent.onOverrideConfigurationChanged(currentConfig);
        displayContent.onOverrideConfigurationChanged(newConfiguration);


        if (displayId == DEFAULT_DISPLAY) {
        if (displayId == DEFAULT_DISPLAY) {
            // Override configuration of the default display duplicates global config. In this case
            // Override configuration of the default display duplicates global config. In this case
+29 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.wm;
import org.junit.Test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;


import android.content.res.Configuration;
import android.hardware.display.DisplayManagerGlobal;
import android.hardware.display.DisplayManagerGlobal;
import android.platform.test.annotations.Presubmit;
import android.platform.test.annotations.Presubmit;
import android.support.test.filters.SmallTest;
import android.support.test.filters.SmallTest;
@@ -208,6 +209,10 @@ public class DisplayContentTests extends WindowTestsBase {
        voiceInteractionWindow.removeImmediately();
        voiceInteractionWindow.removeImmediately();
    }
    }


    /**
     * This tests stack movement between displays and proper stack's, task's and app token's display
     * container references updates.
     */
    @Test
    @Test
    public void testMoveStackBetweenDisplays() throws Exception {
    public void testMoveStackBetweenDisplays() throws Exception {
        // Create second display.
        // Create second display.
@@ -238,4 +243,28 @@ public class DisplayContentTests extends WindowTestsBase {
        assertEquals(sDisplayContent, task.getDisplayContent());
        assertEquals(sDisplayContent, task.getDisplayContent());
        assertEquals(sDisplayContent, token.getDisplayContent());
        assertEquals(sDisplayContent, token.getDisplayContent());
    }
    }

    /**
     * This tests override configuration updates for display content.
     */
    @Test
    public void testDisplayOverrideConfigUpdate() throws Exception {
        final int displayId = sDisplayContent.getDisplayId();
        final Configuration currentOverrideConfig = sDisplayContent.getOverrideConfiguration();

        // Create new, slightly changed override configuration and apply it to the display.
        final Configuration newOverrideConfig = new Configuration(currentOverrideConfig);
        newOverrideConfig.densityDpi += 120;
        newOverrideConfig.fontScale += 0.3;

        sWm.setNewDisplayOverrideConfiguration(newOverrideConfig, displayId);

        // Check that override config is applied.
        assertEquals(newOverrideConfig, sDisplayContent.getOverrideConfiguration());

        // Check that global configuration is updated, as we've updated default display's config.
        final Configuration globalConfig = sWm.mRoot.getConfiguration();
        assertEquals(newOverrideConfig.densityDpi, globalConfig.densityDpi);
        assertEquals(newOverrideConfig.fontScale, globalConfig.fontScale, 0.1 /* delta */);
    }
}
}