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