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

Commit 56682c2b authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Move PhoneWindowManager tests to WmTests

Bug: 113800711
Test: Pass all PhoneWindowManager presubmit tests in WmTests
  $ tradefed.sh run commandAndExit WmTests \
      --include-filter com.android.server.policy. \
      --include-annotation android.platform.test.annotations.Presubmit \
      --exclude-annotation androidx.test.filters.FlakyTest
Change-Id: I806acaa9c62af4849bb5872f5821ee69600412a5
parent e06dc3b8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
    <uses-permission android:name="android.permission.MANAGE_USERS" />
    <uses-permission android:name="android.permission.STORAGE_INTERNAL" />
    <uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" />
    <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />

    <application android:testOnly="true">
        <activity android:name="com.android.server.am.TaskStackChangedListenerTest$ActivityA" />
+0 −46
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.policy;

import android.platform.test.annotations.Presubmit;

import org.junit.Test;

import androidx.test.filters.FlakyTest;

/**
 * Dummy test for com.android.server.policy.
 * TODO(b/113800711): Remove this class once the actual tests are moved from servicestests.
 */
public class DummyPolicyTests {

    @Presubmit
    @Test
    public void preSubmitTest() {}

    @FlakyTest
    @Presubmit
    @Test
    public void flakyPreSubmitTest() {}

    @Test
    public void postSubmitTest() {}

    @FlakyTest
    @Test
    public void flakyPostSubmitTest() {}
}
+4 −6
Original line number Diff line number Diff line
@@ -16,17 +16,13 @@

package com.android.server.policy;

import android.annotation.Nullable;
import android.graphics.Point;
import android.graphics.Rect;
import android.util.proto.ProtoOutputStream;
import android.view.Display;
import android.view.DisplayCutout;
import android.view.IApplicationToken;
import android.view.WindowManager;

import com.android.server.wm.WindowFrames;
import com.android.server.wm.utils.WmDisplayCutout;

public class FakeWindowState implements WindowManagerPolicy.WindowState {

@@ -243,7 +239,9 @@ public class FakeWindowState implements WindowManagerPolicy.WindowState {
    }

    @Override
    public boolean canReceiveKeys() { return false; }
    public boolean canReceiveKeys() {
        return false;
    }

    @Override
    public void writeIdentifierToProto(ProtoOutputStream proto, long fieldId) {
+13 −12
Original line number Diff line number Diff line
@@ -29,15 +29,16 @@ import android.view.Display;
import android.view.DisplayInfo;

import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
/**
 * Build/Install/Run:
 *  atest WmTests:PhoneWindowManagerInsetsTest
 */
@SmallTest
@Presubmit
public class PhoneWindowManagerInsetsTest extends PhoneWindowManagerTestBase {
@@ -52,7 +53,7 @@ public class PhoneWindowManagerInsetsTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void portrait() throws Exception {
    public void portrait() {
        DisplayInfo di = displayInfoForRotation(ROTATION_0, false /* withCutout */);

        verifyStableInsets(di, 0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT);
@@ -61,7 +62,7 @@ public class PhoneWindowManagerInsetsTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void portrait_withCutout() throws Exception {
    public void portrait_withCutout() {
        DisplayInfo di = displayInfoForRotation(ROTATION_0, true /* withCutout */);

        verifyStableInsets(di, 0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT);
@@ -70,7 +71,7 @@ public class PhoneWindowManagerInsetsTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void landscape() throws Exception {
    public void landscape() {
        DisplayInfo di = displayInfoForRotation(ROTATION_90, false /* withCutout */);

        verifyStableInsets(di, 0, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
@@ -79,7 +80,7 @@ public class PhoneWindowManagerInsetsTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void landscape_withCutout() throws Exception {
    public void landscape_withCutout() {
        DisplayInfo di = displayInfoForRotation(ROTATION_90, true /* withCutout */);

        verifyStableInsets(di, DISPLAY_CUTOUT_HEIGHT, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
@@ -88,7 +89,7 @@ public class PhoneWindowManagerInsetsTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void seascape() throws Exception {
    public void seascape() {
        DisplayInfo di = displayInfoForRotation(ROTATION_270, false /* withCutout */);

        verifyStableInsets(di, NAV_BAR_HEIGHT, STATUS_BAR_HEIGHT, 0, 0);
@@ -97,7 +98,7 @@ public class PhoneWindowManagerInsetsTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void seascape_withCutout() throws Exception {
    public void seascape_withCutout() {
        DisplayInfo di = displayInfoForRotation(ROTATION_270, true /* withCutout */);

        verifyStableInsets(di, NAV_BAR_HEIGHT, STATUS_BAR_HEIGHT, DISPLAY_CUTOUT_HEIGHT, 0);
@@ -106,7 +107,7 @@ public class PhoneWindowManagerInsetsTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void upsideDown() throws Exception {
    public void upsideDown() {
        DisplayInfo di = displayInfoForRotation(ROTATION_180, false /* withCutout */);

        verifyStableInsets(di, 0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT);
@@ -115,7 +116,7 @@ public class PhoneWindowManagerInsetsTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void upsideDown_withCutout() throws Exception {
    public void upsideDown_withCutout() {
        DisplayInfo di = displayInfoForRotation(ROTATION_180, true /* withCutout */);

        verifyStableInsets(di, 0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT + DISPLAY_CUTOUT_HEIGHT);
+8 −7
Original line number Diff line number Diff line
@@ -43,13 +43,14 @@ import android.view.DisplayCutout;
import android.view.WindowManager;

import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
/**
 * Build/Install/Run:
 *  atest WmTests:PhoneWindowManagerLayoutTest
 */
@SmallTest
@Presubmit
public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
@@ -69,7 +70,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void layoutWindowLw_appDrawsBars() throws Exception {
    public void layoutWindowLw_appDrawsBars() {
        mAppWindow.attrs.flags |= FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
        mPolicy.addWindow(mAppWindow);

@@ -84,7 +85,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void layoutWindowLw_appWontDrawBars() throws Exception {
    public void layoutWindowLw_appWontDrawBars() {
        mAppWindow.attrs.flags &= ~FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
        mPolicy.addWindow(mAppWindow);

@@ -99,7 +100,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void layoutWindowLw_appWontDrawBars_forceStatus() throws Exception {
    public void layoutWindowLw_appWontDrawBars_forceStatus() {
        mAppWindow.attrs.flags &= ~FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
        mAppWindow.attrs.privateFlags |= PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
        mPolicy.addWindow(mAppWindow);
Loading