1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.server.am; 18 19 import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; 20 import static android.server.am.Components.ANIMATION_TEST_ACTIVITY; 21 import static android.server.am.Components.LAUNCHING_ACTIVITY; 22 import static android.view.Display.DEFAULT_DISPLAY; 23 24 import static org.junit.Assert.assertFalse; 25 import static org.junit.Assert.assertTrue; 26 27 import org.junit.Test; 28 29 /** 30 * Build/Install/Run: 31 * atest CtsActivityManagerDeviceTestCases:AnimationBackgroundTests 32 */ 33 public class AnimationBackgroundTests extends ActivityManagerTestBase { 34 35 @Test 36 public void testAnimationBackground_duringAnimation() throws Exception { 37 launchActivityOnDisplay(LAUNCHING_ACTIVITY, DEFAULT_DISPLAY); 38 getLaunchActivityBuilder() 39 .setTargetActivity(ANIMATION_TEST_ACTIVITY) 40 .setWaitForLaunched(false) 41 .execute(); 42 43 // Make sure we are in the middle of the animation. 44 mAmWmState.waitForWithWmState(state -> state 45 .getStandardStackByWindowingMode(WINDOWING_MODE_FULLSCREEN) 46 .isWindowAnimationBackgroundSurfaceShowing(), 47 "***Waiting for animation background showing"); 48 assertTrue("window animation background needs to be showing", mAmWmState.getWmState() 49 .getStandardStackByWindowingMode(WINDOWING_MODE_FULLSCREEN) 50 .isWindowAnimationBackgroundSurfaceShowing()); 51 } 52 53 @Test 54 public void testAnimationBackground_gone() throws Exception { 55 launchActivityOnDisplay(LAUNCHING_ACTIVITY, DEFAULT_DISPLAY); 56 getLaunchActivityBuilder().setTargetActivity(ANIMATION_TEST_ACTIVITY).execute(); 57 mAmWmState.computeState(ANIMATION_TEST_ACTIVITY); 58 mAmWmState.waitForAppTransitionIdle(); 59 assertFalse("window animation background needs to be gone", mAmWmState.getWmState() 60 .getStandardStackByWindowingMode(WINDOWING_MODE_FULLSCREEN) 61 .isWindowAnimationBackgroundSurfaceShowing()); 62 } 63 } 64