Merge "Added support for global action APIs and fixed WaitForIdle" into jb-mr2-dev
diff --git a/uiautomator_test_libraries/src/com/android/uiautomator/platform/JankTestBase.java b/uiautomator_test_libraries/src/com/android/uiautomator/platform/JankTestBase.java
index bac710e..6662f80 100644
--- a/uiautomator_test_libraries/src/com/android/uiautomator/platform/JankTestBase.java
+++ b/uiautomator_test_libraries/src/com/android/uiautomator/platform/JankTestBase.java
@@ -43,7 +43,7 @@
* All jank test needs to extend JankTestBase
*/
public class JankTestBase extends UiAutomatorTestCase {
- private final static String TAG = JankTestBase.class.getSimpleName();
+ private static final String TAG = JankTestBase.class.getSimpleName();
protected UiDevice mDevice;
protected TestWatchers mTestWatchers = null;
@@ -58,22 +58,22 @@
protected Thread mThread = null;
// holds all params for the derived tests
- private final static String PROPERTY_FILE_NAME = "UiJankinessTests.conf";
- private final static String PARAM_CONFIG = "conf";
- private final static String LOCAL_TMP_DIR = "/data/local/tmp/";
+ private static final String PROPERTY_FILE_NAME = "UiJankinessTests.conf";
+ private static final String PARAM_CONFIG = "conf";
+ private static final String LOCAL_TMP_DIR = "/data/local/tmp/";
// File that hold the test results
private static String OUTPUT_FILE_NAME = LOCAL_TMP_DIR + "UiJankinessTestsOutput.txt";
// File that hold test status, e.g successful test iterations
private static String STATUS_FILE_NAME = LOCAL_TMP_DIR + "UiJankinessTestsStatus.txt";
- private final static String RAW_DATA_DIR = LOCAL_TMP_DIR + "UiJankinessRawData";
+ private static final String RAW_DATA_DIR = LOCAL_TMP_DIR + "UiJankinessRawData";
private static int SUCCESS_THRESHOLD = 80;
private static boolean DEBUG = false;
/* default animation time is set to 2 seconds */
- protected final static long DEFAULT_ANIMATION_TIME = 2 * 1000;
+ protected static final long DEFAULT_ANIMATION_TIME = 2 * 1000;
/* default swipe steps for fling animation */
- protected final static int DEFAULT_FLING_STEPS = 8;
+ protected static final int DEFAULT_FLING_STEPS = 8;
/* Array to record jankiness data in each test iteration */
private int[] jankinessArray;
@@ -82,13 +82,13 @@
/* Array to save max accumulated frame number in each test iteration */
private int[] maxDeltaVsyncArray;
/* Default file to store the systrace */
- private final static File SYSTRACE_DIR = new File(LOCAL_TMP_DIR, "systrace");
+ private static final File SYSTRACE_DIR = new File(LOCAL_TMP_DIR, "systrace");
/* Default trace file name */
- private final static String TRACE_FILE_NAME = "trace.txt";
+ private static final String TRACE_FILE_NAME = "trace.txt";
/* Default tracing time is 5 seconds */
- private final static int DEFAULT_TRACE_TIME = 5; // 5 seconds
+ private static final int DEFAULT_TRACE_TIME = 5; // 5 seconds
// Command to dump compressed trace data
- private final static String ATRACE_COMMAND = "atrace -z -t %d gfx input view sched freq";
+ private static final String ATRACE_COMMAND = "atrace -z -t %d gfx input view sched freq";
/**
* Thread to capture systrace log from the test
@@ -276,6 +276,15 @@
}
/**
+ * Verify the test result by comparing data sample size with expected value
+ * @param expectedDataSize the expected data size
+ */
+ protected boolean validateResults(int expectedDataSize) {
+ int receivedDataSize = SurfaceFlingerHelper.getDataSampleSize();
+ return ((expectedDataSize > 0) && (receivedDataSize >= expectedDataSize));
+ }
+
+ /**
* Process the raw data, calculate jankiness, frame rate and max accumulated frames number
* @param testCaseName
* @param iteration
diff --git a/uiautomator_test_libraries/src/com/android/uiautomator/platform/SurfaceFlingerHelper.java b/uiautomator_test_libraries/src/com/android/uiautomator/platform/SurfaceFlingerHelper.java
index fe69ea9..748b433 100644
--- a/uiautomator_test_libraries/src/com/android/uiautomator/platform/SurfaceFlingerHelper.java
+++ b/uiautomator_test_libraries/src/com/android/uiautomator/platform/SurfaceFlingerHelper.java
@@ -39,11 +39,11 @@
private static int BUFFER_NUMBER = 3;
private static String CLEAR_BUFFER_CMD = "dumpsys SurfaceFlinger --latency-clear";
private static String FRAME_LATENCY_CMD = "dumpsys SurfaceFlinger --latency";
- private final static String RAW_DATA_DIR = "UiJankinessRawData";
- private final static String LOCAL_TMP_DIR = "/data/local/tmp/";
+ private static final String RAW_DATA_DIR = "UiJankinessRawData";
+ private static final String LOCAL_TMP_DIR = "/data/local/tmp/";
/* If the latency between two frames is greater than this number, it it treated as a pause
* not a jankiness */
- private final static int PAUSE_LATENCY = 20;
+ private static final int PAUSE_LATENCY = 20;
/* An array list which includes the raw buffer information from frame latency tool */
private static List<List<String>> mFrameBufferData = new ArrayList<List<String>>(BUFFER_SIZE);
@@ -67,7 +67,7 @@
private static double[] mNormalizedDelta2Vsync = new double[BUFFER_SIZE];
private static int[] mRoundNormalizedDelta2Vsync = new int[BUFFER_SIZE];
// Symbol of unfinished frame time */
- public final static String PENDING_FENCE_TIME = new Long(Long.MAX_VALUE).toString();
+ public static final String PENDING_FENCE_TIME = new Long(Long.MAX_VALUE).toString();
/**
* Run clear buffer command and clear the saved frame buffer results
@@ -205,6 +205,10 @@
return true;
}
+ public static int getDataSampleSize() {
+ return mFrameLatencySampleSize;
+ }
+
public static long getRefreshPeriod() {
if (mRefreshPeriod < 0) {
// Haven't dump the frame latency yet