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

Commit b5068b3e authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Reduce dependency of real device for wm unit test" into udc-dev am:...

Merge "Reduce dependency of real device for wm unit test" into udc-dev am: daf02895 am: 9e73cda2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23532378



Change-Id: Ic958ecc33550cb7efe14bd9f279346b63e9da133
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 620f397c 9e73cda2
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1996,7 +1996,8 @@ public class ActivityRecordTests extends WindowTestsBase {


        assertTrue(activity.isSnapshotCompatible(snapshot));
        assertTrue(activity.isSnapshotCompatible(snapshot));


        setRotatedScreenOrientationSilently(activity);
        doReturn(task.getWindowConfiguration().getRotation() + 1).when(mDisplayContent)
                .rotationForActivityInDifferentOrientation(activity);


        assertFalse(activity.isSnapshotCompatible(snapshot));
        assertFalse(activity.isSnapshotCompatible(snapshot));
    }
    }
+0 −8
Original line number Original line Diff line number Diff line
@@ -4655,14 +4655,6 @@ public class SizeCompatTests extends WindowTestsBase {
        return c;
        return c;
    }
    }


    private static void resizeDisplay(DisplayContent displayContent, int width, int height) {
        displayContent.updateBaseDisplayMetrics(width, height, displayContent.mBaseDisplayDensity,
                displayContent.mBaseDisplayPhysicalXDpi, displayContent.mBaseDisplayPhysicalYDpi);
        final Configuration c = new Configuration();
        displayContent.computeScreenConfiguration(c);
        displayContent.onRequestedOverrideConfigurationChanged(c);
    }

    private static void setNeverConstrainDisplayApisFlag(@Nullable String value,
    private static void setNeverConstrainDisplayApisFlag(@Nullable String value,
            boolean makeDefault) {
            boolean makeDefault) {
        DeviceConfig.setProperty(NAMESPACE_CONSTRAIN_DISPLAY_APIS,
        DeviceConfig.setProperty(NAMESPACE_CONSTRAIN_DISPLAY_APIS,
+4 −0
Original line number Original line Diff line number Diff line
@@ -127,6 +127,10 @@ public class WallpaperControllerTests extends WindowTestsBase {
    public void testWallpaperSizeWithFixedTransform() {
    public void testWallpaperSizeWithFixedTransform() {
        // No wallpaper
        // No wallpaper
        final DisplayContent dc = mDisplayContent;
        final DisplayContent dc = mDisplayContent;
        if (dc.mBaseDisplayHeight == dc.mBaseDisplayWidth) {
            // Make sure the size is different when changing orientation.
            resizeDisplay(dc, 500, 1000);
        }


        // No wallpaper WSA Surface
        // No wallpaper WSA Surface
        final WindowState wallpaperWindow = createWallpaperWindow(dc);
        final WindowState wallpaperWindow = createWallpaperWindow(dc);
+9 −0
Original line number Original line Diff line number Diff line
@@ -71,6 +71,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.graphics.Insets;
import android.graphics.Insets;
import android.graphics.Rect;
import android.graphics.Rect;
import android.hardware.HardwareBuffer;
import android.hardware.HardwareBuffer;
@@ -946,6 +947,14 @@ class WindowTestsBase extends SystemServiceTestsBase {
        dc.setRotationAnimation(null);
        dc.setRotationAnimation(null);
    }
    }


    static void resizeDisplay(DisplayContent displayContent, int width, int height) {
        displayContent.updateBaseDisplayMetrics(width, height, displayContent.mBaseDisplayDensity,
                displayContent.mBaseDisplayPhysicalXDpi, displayContent.mBaseDisplayPhysicalYDpi);
        final Configuration c = new Configuration();
        displayContent.computeScreenConfiguration(c);
        displayContent.onRequestedOverrideConfigurationChanged(c);
    }

    // The window definition for UseTestDisplay#addWindows. The test can declare to add only
    // The window definition for UseTestDisplay#addWindows. The test can declare to add only
    // necessary windows, that avoids adding unnecessary overhead of unused windows.
    // necessary windows, that avoids adding unnecessary overhead of unused windows.
    static final int W_NOTIFICATION_SHADE = TYPE_NOTIFICATION_SHADE;
    static final int W_NOTIFICATION_SHADE = TYPE_NOTIFICATION_SHADE;