Merge tag 'android-6.0.0_r26' into HEAD
Android 6.0.0 release 26
* tag 'android-6.0.0_r26':
Power jank for Systemapp
Disable books jank test as it is nomore a system app
youtube jank test fix
Change-Id: If4ae91ca44771041972a0633505aecc8c9d63558
diff --git a/tests/jank/sysapp/Android.mk b/tests/jank/sysapp/Android.mk
index 2ba588d..b84bc10 100644
--- a/tests/jank/sysapp/Android.mk
+++ b/tests/jank/sysapp/Android.mk
@@ -19,7 +19,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator ub-janktesthelper
+LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator ub-janktesthelper timeresult-helper-lib
LOCAK_SDK_VERSION := current
diff --git a/tests/jank/sysapp/AndroidManifest.xml b/tests/jank/sysapp/AndroidManifest.xml
index c4b2fbc..1f41c84 100644
--- a/tests/jank/sysapp/AndroidManifest.xml
+++ b/tests/jank/sysapp/AndroidManifest.xml
@@ -17,7 +17,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.sysapp.janktests">
- <uses-sdk android:minSdkVersion="23" />
+ <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application>
diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/BooksJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/BooksJankTests.java
index 4406a4c..a97e217 100644
--- a/tests/jank/sysapp/src/com/android/sysapp/janktests/BooksJankTests.java
+++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/BooksJankTests.java
@@ -16,8 +16,13 @@
package com.android.sysapp.janktests;
+import java.io.File;
+import java.io.IOException;
+
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Environment;
import android.os.RemoteException;
import android.os.SystemClock;
import android.support.test.jank.GfxMonitor;
@@ -31,8 +36,8 @@
import android.support.test.uiautomator.Until;
import android.widget.Button;
import android.widget.ProgressBar;
-
import junit.framework.Assert;
+import android.support.test.timeresulthelper.TimeResultLogger;
/**
* Jank test for Books app recommendation page fling
@@ -45,6 +50,10 @@
private static final int EXPECTED_FRAMES = 100;
private static final String PACKAGE_NAME = "com.google.android.apps.books";
private UiDevice mDevice;
+ private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "autotester.log");
+ private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "results.log");
@Override
public void setUp() throws Exception {
@@ -71,17 +80,29 @@
SystemClock.sleep(SHORT_TIMEOUT);
}
- public void launchBooks () throws UiObjectNotFoundException {
+ public void launchBooks () throws UiObjectNotFoundException, IOException {
launchApp(PACKAGE_NAME);
dismissClings();
openMyLibrary();
Assert.assertTrue("Books haven't loaded yet", getNumberOfVisibleBooks() > 3);
+ TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ }
+
+ public void afterTestBooksRecommendationPageFling(Bundle metrics) throws IOException {
+ TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ TimeResultLogger.writeResultToFile(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), RESULTS_FILE, metrics);
+ super.afterTest(metrics);
}
// Measures jank while fling books mylibrary
- @JankTest(beforeTest="launchBooks", expectedFrames=EXPECTED_FRAMES)
+ @JankTest(beforeTest="launchBooks", expectedFrames=EXPECTED_FRAMES,
+ afterTest="afterTestBooksRecommendationPageFling")
@GfxMonitor(processName=PACKAGE_NAME)
- public void testBooksRecommendationPageFling() {
+ // Books is not a system app anymore
+ public void doNotRun_BooksRecommendationPageFling() {
UiObject2 container = mDevice.wait(Until.findObject(
By.res(PACKAGE_NAME, "content_container")), LONG_TIMEOUT);
for (int i = 0; i < INNER_LOOP; i++) {
diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/CalendarJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/CalendarJankTests.java
index 21756b9..253a82a 100644
--- a/tests/jank/sysapp/src/com/android/sysapp/janktests/CalendarJankTests.java
+++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/CalendarJankTests.java
@@ -16,8 +16,13 @@
package com.android.sysapp.janktests;
+import java.io.File;
+import java.io.IOException;
+
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Environment;
import android.os.RemoteException;
import android.os.SystemClock;
import android.support.test.jank.GfxMonitor;
@@ -32,8 +37,8 @@
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
import android.view.View;
-
import junit.framework.Assert;
+import android.support.test.timeresulthelper.TimeResultLogger;
/**
* Jank test for Calendar
@@ -50,6 +55,10 @@
private static final String PACKAGE_NAME = "com.google.android.calendar";
private static final String RES_PACKAGE_NAME = "com.android.calendar";
private UiDevice mDevice;
+ private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "autotester.log");
+ private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "results.log");
private BySelector mCalendarSelector = null;
private Direction mScrollDirection = null;
@@ -82,16 +91,27 @@
SystemClock.sleep(SHORT_TIMEOUT * 10);
}
- public void launchCalendar () throws UiObjectNotFoundException {
+ public void launchCalendar() throws UiObjectNotFoundException, IOException {
launchApp(PACKAGE_NAME);
mDevice.waitForIdle();
dismissCling();
assertNotNull("Calendar can't be found",
mDevice.wait(Until.findObject(mCalendarSelector), LONG_TIMEOUT));
+ TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ }
+
+ public void afterTestCalendarItemsFling(Bundle metrics) throws IOException {
+ TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ TimeResultLogger.writeResultToFile(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), RESULTS_FILE, metrics);
+ super.afterTest(metrics);
}
// Measures jank of flinging calendar items
- @JankTest(beforeTest="launchCalendar", expectedFrames=EXPECTED_FRAMES)
+ @JankTest(beforeTest="launchCalendar", expectedFrames=EXPECTED_FRAMES,
+ afterTest="afterTestCalendarItemsFling")
@GfxMonitor(processName=PACKAGE_NAME)
public void testCalendarItemsFling() {
UiObject2 calendarItems = null;
@@ -104,7 +124,7 @@
private void dismissCling() {
UiObject2 splashScreen = null;
- splashScreen = mDevice.wait(Until.findObject(
+ splashScreen = mDevice.wait(Until.findObject(
By.pkg(PACKAGE_NAME).clazz(View.class).desc("Got it")), LONG_TIMEOUT);
if (splashScreen != null) {
splashScreen.clickAndWait(Until.newWindow(), SHORT_TIMEOUT);
diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/ChromeJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/ChromeJankTests.java
index f70cc0d..3659dda 100644
--- a/tests/jank/sysapp/src/com/android/sysapp/janktests/ChromeJankTests.java
+++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/ChromeJankTests.java
@@ -16,8 +16,13 @@
package com.android.sysapp.janktests;
+import java.io.File;
+import java.io.IOException;
+
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Environment;
import android.os.RemoteException;
import android.os.SystemClock;
import android.support.test.jank.GfxMonitor;
@@ -30,8 +35,8 @@
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
-
import junit.framework.Assert;
+import android.support.test.timeresulthelper.TimeResultLogger;
/**
* Jank test for Chorme apps
@@ -45,6 +50,10 @@
private static final int EXPECTED_FRAMES = 100;
private static final String PACKAGE_NAME = "com.android.chrome";
private UiDevice mDevice;
+ private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "autotester.log");
+ private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "results.log");
@Override
public void setUp() throws Exception {
@@ -71,13 +80,24 @@
SystemClock.sleep(SHORT_TIMEOUT);
}
- public void launchChrome() throws UiObjectNotFoundException{
+ public void launchChrome() throws UiObjectNotFoundException, IOException{
launchApp(PACKAGE_NAME);
getOverflowMenu();
+ TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ }
+
+ public void afterTestChromeOverflowMenuTap(Bundle metrics) throws IOException {
+ TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ TimeResultLogger.writeResultToFile(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), RESULTS_FILE, metrics);
+ super.afterTest(metrics);
}
// Measures jank window render for overflow menu tap
- @JankTest(beforeTest="launchChrome", expectedFrames=EXPECTED_FRAMES)
+ @JankTest(beforeTest="launchChrome", expectedFrames=EXPECTED_FRAMES,
+ afterTest="afterTestChromeOverflowMenuTap")
@GfxMonitor(processName=PACKAGE_NAME)
public void testChromeOverflowMenuTap() {
for (int i = 0; i < INNER_LOOP; i++) {
diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/ContactsJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/ContactsJankTests.java
index c83de69..1d7be9b 100644
--- a/tests/jank/sysapp/src/com/android/sysapp/janktests/ContactsJankTests.java
+++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/ContactsJankTests.java
@@ -16,9 +16,14 @@
package com.android.sysapp.janktests;
+import java.io.File;
+import java.io.IOException;
+
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
+import android.os.Bundle;
+import android.os.Environment;
import android.os.RemoteException;
import android.os.SystemClock;
import android.provider.ContactsContract;
@@ -34,8 +39,8 @@
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
import android.widget.TextView;
-
import junit.framework.Assert;
+import android.support.test.timeresulthelper.TimeResultLogger;
/**
* Jank test for Contacts
@@ -52,6 +57,10 @@
private static final String RES_PACKAGE_NAME = "com.android.contacts";
private static final String PM_PACKAGE_NAME = "com.android.packageinstaller";
private UiDevice mDevice;
+ private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "autotester.log");
+ private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "results.log");
@Override
public void setUp() throws Exception {
@@ -74,7 +83,7 @@
SystemClock.sleep(SHORT_TIMEOUT);
}
- public void launchContacts () throws UiObjectNotFoundException {
+ public void launchContacts () throws UiObjectNotFoundException, IOException {
launchApp(PACKAGE_NAME);
mDevice.waitForIdle();
// To infer that test is ready to be executed
@@ -85,10 +94,21 @@
Cursor cursor = getInstrumentation().getContext().getContentResolver().query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
Assert.assertTrue("There are not enough contacts", cursor.getCount() > MIN_CONTACT_COUNT);
+ TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ }
+
+ public void afterTestAllContactsFling(Bundle metrics) throws IOException {
+ TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ TimeResultLogger.writeResultToFile(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), RESULTS_FILE, metrics);
+ super.afterTest(metrics);
}
// Measures jank while flinging contacts list
- @JankTest(beforeTest="launchContacts", expectedFrames=EXPECTED_FRAMES)
+ @JankTest(beforeTest="launchContacts", expectedFrames=EXPECTED_FRAMES,
+ afterTest="afterTestAllContactsFling")
@GfxMonitor(processName=PACKAGE_NAME)
public void testAllContactsFling() {
UiObject2 contactList = null;
@@ -101,4 +121,4 @@
SystemClock.sleep(100);
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/GMailJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/GMailJankTests.java
index 801ed48..4a5e96c 100644
--- a/tests/jank/sysapp/src/com/android/sysapp/janktests/GMailJankTests.java
+++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/GMailJankTests.java
@@ -16,8 +16,13 @@
package com.android.sysapp.janktests;
+import java.io.File;
+import java.io.IOException;
+
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Environment;
import android.os.RemoteException;
import android.os.SystemClock;
import android.support.test.jank.GfxMonitor;
@@ -32,8 +37,8 @@
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
import android.widget.ImageButton;
-
import junit.framework.Assert;
+import android.support.test.timeresulthelper.TimeResultLogger;
/**
* Jank test for scrolling gmail inbox mails
@@ -48,6 +53,10 @@
private static final String PACKAGE_NAME = "com.google.android.gm";
private static final String RES_PACKAGE_NAME = "android";
private UiDevice mDevice;
+ private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "autotester.log");
+ private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "results.log");
@Override
public void setUp() throws Exception {
@@ -77,16 +86,27 @@
waitForEmailSync();
}
- public void prepGMailInboxFling() throws UiObjectNotFoundException {
+ public void prepGMailInboxFling() throws UiObjectNotFoundException, IOException {
launchGMail();
// Ensure test is ready to be executed
UiObject2 list = mDevice.wait(
Until.findObject(By.res(PACKAGE_NAME, "conversation_list_view")), SHORT_TIMEOUT);
Assert.assertNotNull("Failed to locate 'conversation_list_view'", list);
+ TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ }
+
+ public void afterTestGMailInboxFling(Bundle metrics) throws IOException {
+ TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ TimeResultLogger.writeResultToFile(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), RESULTS_FILE, metrics);
+ super.afterTest(metrics);
}
// Measures jank while scrolling gmail inbox
- @JankTest(beforeTest="prepGMailInboxFling", expectedFrames=EXPECTED_FRAMES)
+ @JankTest(beforeTest="prepGMailInboxFling", expectedFrames=EXPECTED_FRAMES,
+ afterTest="afterTestGMailInboxFling")
@GfxMonitor(processName=PACKAGE_NAME)
public void testGMailInboxFling() {
UiObject2 list = mDevice.wait(
@@ -100,14 +120,25 @@
}
}
- public void prepOpenNavDrawer() throws UiObjectNotFoundException {
+ public void prepOpenNavDrawer() throws UiObjectNotFoundException, IOException {
launchGMail();
// Ensure test is ready to be executed
Assert.assertNotNull("Failed to locate Nav Drawer Openner", openNavigationDrawer());
+ TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ }
+
+ public void afterTestOpenNavDrawer(Bundle metrics) throws IOException {
+ TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ TimeResultLogger.writeResultToFile(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), RESULTS_FILE, metrics);
+ super.afterTest(metrics);
}
// Measures jank while opening Navigation Drawer
- @JankTest(beforeTest="prepOpenNavDrawer", expectedFrames=EXPECTED_FRAMES)
+ @JankTest(beforeTest="prepOpenNavDrawer", expectedFrames=EXPECTED_FRAMES,
+ afterTest="afterTestOpenNavDrawer")
@GfxMonitor(processName=PACKAGE_NAME)
public void testOpenNavDrawer() {
UiObject2 navDrawer = openNavigationDrawer();
@@ -119,7 +150,7 @@
}
}
- public void prepFlingNavDrawer() throws UiObjectNotFoundException{
+ public void prepFlingNavDrawer() throws UiObjectNotFoundException, IOException{
launchGMail();
UiObject2 navDrawer = openNavigationDrawer();
Assert.assertNotNull("Failed to locate Nav Drawer Openner", navDrawer);
@@ -127,10 +158,21 @@
// Ensure test is ready to be executed
UiObject2 container = getNavigationDrawerContainer();
Assert.assertNotNull("Failed to locate Nav drawer container", container);
+ TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ }
+
+ public void afterTestFlingNavDrawer(Bundle metrics) throws IOException {
+ TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ TimeResultLogger.writeResultToFile(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), RESULTS_FILE, metrics);
+ super.afterTest(metrics);
}
// Measures jank while flinging Navigation Drawer
- @JankTest(beforeTest="prepFlingNavDrawer", expectedFrames=EXPECTED_FRAMES)
+ @JankTest(beforeTest="prepFlingNavDrawer", expectedFrames=EXPECTED_FRAMES,
+ afterTest="afterTestFlingNavDrawer")
@GfxMonitor(processName=PACKAGE_NAME)
public void testFlingNavDrawer() {
UiObject2 container = getNavigationDrawerContainer();
@@ -198,4 +240,4 @@
}
return container;
}
-}
\ No newline at end of file
+}
diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/YouTubeJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/YouTubeJankTests.java
index a1a004e..d0614d4 100644
--- a/tests/jank/sysapp/src/com/android/sysapp/janktests/YouTubeJankTests.java
+++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/YouTubeJankTests.java
@@ -16,8 +16,13 @@
package com.android.sysapp.janktests;
+import java.io.File;
+import java.io.IOException;
+
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Environment;
import android.os.RemoteException;
import android.os.SystemClock;
import android.support.test.jank.GfxMonitor;
@@ -30,6 +35,7 @@
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
import junit.framework.Assert;
+import android.support.test.timeresulthelper.TimeResultLogger;
/**
* Jank test for YouTube recommendation window fling 3 times.
@@ -41,6 +47,10 @@
private static final int INNER_LOOP = 5;
private static final int EXPECTED_FRAMES = 100;
private static final String PACKAGE_NAME = "com.google.android.youtube";
+ private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "autotester.log");
+ private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory()
+ .getAbsolutePath(), "results.log");
private UiDevice mDevice;
@@ -69,16 +79,27 @@
SystemClock.sleep(SHORT_TIMEOUT);
}
- public void launchYouTube () throws UiObjectNotFoundException {
+ public void launchYouTube () throws UiObjectNotFoundException, IOException {
launchApp(PACKAGE_NAME);
dismissCling();
UiObject2 uiObject = mDevice.wait(
Until.findObject(By.res(PACKAGE_NAME, "pane_fragment_container")), LONG_TIMEOUT);
Assert.assertNotNull("Recommendation container is null", uiObject);
+ TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ }
+
+ public void afterTestYouTubeRecomendation(Bundle metrics) throws IOException {
+ TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), TIMESTAMP_FILE);
+ TimeResultLogger.writeResultToFile(String.format("%s-%s",
+ getClass().getSimpleName(), getName()), RESULTS_FILE, metrics);
+ super.afterTest(metrics);
}
// Measures jank while fling YouTube recommendation
- @JankTest(beforeTest="launchYouTube", expectedFrames=EXPECTED_FRAMES)
+ @JankTest(beforeTest="launchYouTube", expectedFrames=EXPECTED_FRAMES,
+ afterTest="afterTestYouTubeRecomendation")
@GfxMonitor(processName=PACKAGE_NAME)
public void testYouTubeRecomendationWindowFling() {
UiObject2 uiObject = mDevice.wait(