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