1 /*
2  * Copyright (C) 2015 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.windowanimationjank;
18 
19 import androidx.test.jank.JankTestBase;
20 import androidx.test.uiautomator.UiDevice;
21 
22 /**
23  * This adds additional system level jank monitor and its result is merged with primary monitor
24  * used in test.
25  */
26 public abstract class WindowAnimationJankTestBase extends JankTestBase {
27     private static final String TAG = "WindowAnimationJankTestBase";
28 
WindowAnimationJankTestBase()29     protected WindowAnimationJankTestBase() {
30     }
31 
32     @Override
setUp()33     protected void setUp() throws Exception {
34         super.setUp();
35 
36         // fix device orientation
37         getUiDevice().setOrientationNatural();
38 
39         // Start from the home screen
40         getUiDevice().pressHome();
41         getUiDevice().waitForIdle();
42     }
43 
44     @Override
tearDown()45     protected void tearDown() throws Exception {
46         getUiDevice().unfreezeRotation();
47         super.tearDown();
48     }
49 
getUiDevice()50     protected UiDevice getUiDevice() {
51         return UiDevice.getInstance(getInstrumentation());
52     }
53 }
54