summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/DumpRenderTree2/assets/run_layout_tests.py8
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java40
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java166
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java6
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java14
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java39
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListPreloaderThread.java10
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/AdbUtils.java67
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/ConnectionHandler.java72
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/Forwarder.java12
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java14
-rw-r--r--tests/HwAccelerationTest/AndroidManifest.xml30
-rw-r--r--tests/HwAccelerationTest/res/drawable/default_wallpaper.jpgbin0 -> 114414 bytes
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/AdvancedBlendActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/AlphaLayersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/AlphaLayersActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsAlphaActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsAlphaActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsRectActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsRectActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/ColorFiltersActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/FramebufferBlendActivity.java111
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/LayersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/LayersActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/LinesActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ListActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/ListActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/MoreShadersActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/NewLayersActivity.java83
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/NinePatchesActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/NinePatchesActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/PathsActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/PathsActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/QuickRejectActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/QuickRejectActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ResizeActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/RotationActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/RotationActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/ShadersActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/SimplePathsActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/SimplePathsActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/StackActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/StackActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/TextGammaActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/Transform3dActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/Transform3dActivity.java)2
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java119
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/XfermodeActivity.java (renamed from tests/HwAccelerationTest/src/com/google/android/test/hwui/XfermodeActivity.java)2
-rw-r--r--tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java15
39 files changed, 600 insertions, 250 deletions
diff --git a/tests/DumpRenderTree2/assets/run_layout_tests.py b/tests/DumpRenderTree2/assets/run_layout_tests.py
index b13d8c9..bd6e457 100755
--- a/tests/DumpRenderTree2/assets/run_layout_tests.py
+++ b/tests/DumpRenderTree2/assets/run_layout_tests.py
@@ -17,7 +17,7 @@ import webbrowser
import tempfile
#TODO: These should not be hardcoded
-RESULTS_ABSOLUTE_PATH = "/sdcard/android/LayoutTests-results/"
+RESULTS_ABSOLUTE_PATH = "/sdcard/layout-test-results/"
DETAILS_HTML = "details.html"
SUMMARY_TXT = "summary.txt"
@@ -44,12 +44,14 @@ def main():
# Download the txt summary to tmp folder
summary_txt_tmp_path = os.path.join(tmpdir, SUMMARY_TXT)
- cmd = "adb pull " + RESULTS_ABSOLUTE_PATH + SUMMARY_TXT + " " + summary_txt_tmp_path
+ cmd = "rm -f " + summary_txt_tmp_path + ";"
+ cmd += "adb pull " + RESULTS_ABSOLUTE_PATH + SUMMARY_TXT + " " + summary_txt_tmp_path
subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
# Download the html summary to tmp folder
details_html_tmp_path = os.path.join(tmpdir, DETAILS_HTML)
- cmd = "adb pull " + RESULTS_ABSOLUTE_PATH + DETAILS_HTML + " " + details_html_tmp_path
+ cmd = "rm -f " + details_html_tmp_path + ";"
+ cmd += "adb pull " + RESULTS_ABSOLUTE_PATH + DETAILS_HTML + " " + details_html_tmp_path
subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
# Print summary to console
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java
index 4ab76e3..9bbf64a 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java
@@ -56,12 +56,7 @@ public class FileFilter {
private final Set<String> mFailList = new HashSet<String>();
private final Set<String> mSlowList = new HashSet<String>();
- private final String mRootDirPath;
-
- public FileFilter(String rootDirPath) {
- /** It may or may not contain a trailing slash */
- this.mRootDirPath = rootDirPath;
-
+ public FileFilter() {
loadTestExpectations();
}
@@ -287,37 +282,6 @@ public class FileFilter {
}
/**
- * Return the path to the file relative to the tests root dir
- *
- * @param filePath
- * @return
- * the path relative to the tests root dir
- */
- public String getRelativePath(String filePath) {
- File rootDir = new File(mRootDirPath);
- return filePath.replaceFirst(rootDir.getPath() + File.separator, "");
- }
-
- /**
- * Return the path to the file relative to the tests root dir
- *
- * @param filePath
- * @return
- * the path relative to the tests root dir
- */
- public String getRelativePath(File file) {
- return getRelativePath(file.getAbsolutePath());
- }
-
- public File getAbsoluteFile(String relativePath) {
- return new File(mRootDirPath, relativePath);
- }
-
- public String getAboslutePath(String relativePath) {
- return getAbsoluteFile(relativePath).getAbsolutePath();
- }
-
- /**
* If the path contains extension (e.g .foo at the end of the file) then it changes
* this (.foo) into newEnding (so it has to contain the dot if we want to preserve it).
*
@@ -336,4 +300,4 @@ public class FileFilter {
return relativePath.substring(0, dotPos) + newEnding;
}
-} \ No newline at end of file
+}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java
index 4202668..4438811 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java
@@ -20,19 +20,35 @@ import android.util.Log;
import com.android.dumprendertree2.forwarder.ForwarderManager;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.PlainSocketFactory;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.util.EntityUtils;
+
import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
import java.net.URL;
-import java.net.URLConnection;
import java.util.LinkedList;
import java.util.List;
@@ -45,6 +61,29 @@ public class FsUtils {
private static final String SCRIPT_URL = ForwarderManager.getHostSchemePort(false) +
"WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php";
+ private static final int HTTP_TIMEOUT_MS = 5000;
+
+ private static HttpClient sHttpClient;
+
+ private static HttpClient getHttpClient() {
+ if (sHttpClient == null) {
+ HttpParams params = new BasicHttpParams();
+
+ SchemeRegistry schemeRegistry = new SchemeRegistry();
+ schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(),
+ ForwarderManager.HTTP_PORT));
+ schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(),
+ ForwarderManager.HTTPS_PORT));
+
+ ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(params,
+ schemeRegistry);
+ sHttpClient = new DefaultHttpClient(connectionManager, params);
+ HttpConnectionParams.setSoTimeout(sHttpClient.getParams(), HTTP_TIMEOUT_MS);
+ HttpConnectionParams.setConnectionTimeout(sHttpClient.getParams(), HTTP_TIMEOUT_MS);
+ }
+ return sHttpClient;
+ }
+
public static void writeDataToStorage(File file, byte[] bytes, boolean append) {
Log.d(LOG_TAG, "writeDataToStorage(): " + file.getAbsolutePath());
try {
@@ -98,32 +137,34 @@ public class FsUtils {
return null;
}
- byte[] bytes = null;
- try {
- InputStream inputStream = null;
- ByteArrayOutputStream outputStream = null;
- try {
- URLConnection urlConnection = url.openConnection();
- inputStream = urlConnection.getInputStream();
- outputStream = new ByteArrayOutputStream();
-
- byte[] buffer = new byte[4096];
- int length;
- while ((length = inputStream.read(buffer)) > 0) {
- outputStream.write(buffer, 0, length);
+ HttpGet httpRequest = new HttpGet(url.toString());
+ ResponseHandler<byte[]> handler = new ResponseHandler<byte[]>() {
+ @Override
+ public byte[] handleResponse(HttpResponse response) throws IOException {
+ if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
+ return null;
}
+ HttpEntity entity = response.getEntity();
+ return (entity == null ? null : EntityUtils.toByteArray(entity));
+ }
+ };
- bytes = outputStream.toByteArray();
- } finally {
- if (inputStream != null) {
- inputStream.close();
- }
- if (outputStream != null) {
- outputStream.close();
+ byte[] bytes = null;
+ try {
+ /**
+ * TODO: Not exactly sure why some requests hang indefinitely, but adding this
+ * timeout (in static getter for http client) in loop helps.
+ */
+ boolean timedOut;
+ do {
+ timedOut = false;
+ try {
+ bytes = getHttpClient().execute(httpRequest, handler);
+ } catch (SocketTimeoutException e) {
+ timedOut = true;
+ Log.w(LOG_TAG, "Expected SocketTimeoutException: " + url, e);
}
- }
- } catch (FileNotFoundException e) {
- Log.w(LOG_TAG, "readDataFromUrl(): File not found: " + e.getMessage());
+ } while (timedOut);
} catch (IOException e) {
Log.e(LOG_TAG, "url=" + url, e);
}
@@ -135,8 +176,6 @@ public class FsUtils {
boolean mode) {
String modeString = (mode ? "folders" : "files");
- List<String> results = new LinkedList<String>();
-
URL url = null;
try {
url = new URL(SCRIPT_URL +
@@ -146,34 +185,67 @@ public class FsUtils {
} catch (MalformedURLException e) {
Log.e(LOG_TAG, "path=" + dirRelativePath + " recurse=" + recurse + " mode=" +
modeString, e);
- return results;
+ return new LinkedList<String>();
}
- try {
- InputStream inputStream = null;
- BufferedReader bufferedReader = null;
- try {
- URLConnection urlConnection = url.openConnection();
- inputStream = urlConnection.getInputStream();
- bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+ HttpGet httpRequest = new HttpGet(url.toString());
+ ResponseHandler<LinkedList<String>> handler = new ResponseHandler<LinkedList<String>>() {
+ @Override
+ public LinkedList<String> handleResponse(HttpResponse response)
+ throws IOException {
+ LinkedList<String> lines = new LinkedList<String>();
- String relativePath;
- while ((relativePath = bufferedReader.readLine()) != null) {
- results.add(relativePath);
+ if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
+ return lines;
}
- } finally {
- if (inputStream != null) {
- inputStream.close();
+ HttpEntity entity = response.getEntity();
+ if (entity == null) {
+ return lines;
}
- if (bufferedReader != null) {
- bufferedReader.close();
+
+ BufferedReader reader =
+ new BufferedReader(new InputStreamReader(entity.getContent()));
+ String line;
+ try {
+ while ((line = reader.readLine()) != null) {
+ lines.add(line);
+ }
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
}
+
+ return lines;
}
+ };
+
+ try {
+ return getHttpClient().execute(httpRequest, handler);
} catch (IOException e) {
- Log.e(LOG_TAG, "path=" + dirRelativePath + " recurse=" + recurse + " mode=" +
- modeString, e);
+ Log.e(LOG_TAG, "url=" + url, e);
}
- return results;
+ return new LinkedList<String>();
+ }
+
+ public static void closeInputStream(InputStream inputStream) {
+ try {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ } catch (IOException e) {
+ Log.e(LOG_TAG, "Couldn't close stream!", e);
+ }
+ }
+
+ public static void closeOutputStream(OutputStream outputStream) {
+ try {
+ if (outputStream != null) {
+ outputStream.close();
+ }
+ } catch (IOException e) {
+ Log.e(LOG_TAG, "Couldn't close stream!", e);
+ }
}
} \ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
index 0bd2302..93bb6a0 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
@@ -73,12 +73,6 @@ public class LayoutTestsExecutor extends Activity {
}
}
- /** TODO: make it a setting */
- static final String TESTS_ROOT_DIR_PATH =
- Environment.getExternalStorageDirectory() +
- File.separator + "android" +
- File.separator + "LayoutTests";
-
private static final String LOG_TAG = "LayoutTestExecutor";
public static final String EXTRA_TESTS_LIST = "TestsList";
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java
index d9da672..9caabdb 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java
@@ -43,16 +43,8 @@ public class ManagerService extends Service {
private static final int CRASH_TIMEOUT_MS = 20 * 1000;
/** TODO: make it a setting */
- static final String TESTS_ROOT_DIR_PATH =
- Environment.getExternalStorageDirectory() +
- File.separator + "android" +
- File.separator + "LayoutTests";
-
- /** TODO: make it a setting */
static final String RESULTS_ROOT_DIR_PATH =
- Environment.getExternalStorageDirectory() +
- File.separator + "android" +
- File.separator + "LayoutTests-results";
+ Environment.getExternalStorageDirectory() + File.separator + "layout-test-results";
/** TODO: Make it a setting */
private static final List<String> EXPECTED_RESULT_LOCATION_RELATIVE_DIR_PREFIXES =
@@ -141,7 +133,7 @@ public class ManagerService extends Service {
public void onCreate() {
super.onCreate();
- mFileFilter = new FileFilter(TESTS_ROOT_DIR_PATH);
+ mFileFilter = new FileFilter();
mSummarizer = new Summarizer(mFileFilter, RESULTS_ROOT_DIR_PATH);
}
@@ -283,4 +275,4 @@ public class ManagerService extends Service {
return mLastExpectedResultPathFetched;
}
-} \ No newline at end of file
+}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java
index 0efb78e..3763bf2 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java
@@ -201,9 +201,7 @@ public class Summarizer {
private FileFilter mFileFilter;
private String mResultsRootDirPath;
-
private String mTestsRelativePath;
-
private Date mDate;
public Summarizer(FileFilter fileFilter, String resultsRootDirPath) {
@@ -243,8 +241,9 @@ public class Summarizer {
}
public void summarize() {
- createHtmlDetails();
- createTxtSummary();
+ String webKitRevision = getWebKitRevision();
+ createHtmlDetails(webKitRevision);
+ createTxtSummary(webKitRevision);
}
public void reset() {
@@ -255,7 +254,7 @@ public class Summarizer {
mDate = new Date();
}
- private void createTxtSummary() {
+ private void createTxtSummary(String webKitRevision) {
StringBuilder txt = new StringBuilder();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
@@ -263,23 +262,20 @@ public class Summarizer {
txt.append("Date: " + dateFormat.format(mDate) + "\n");
txt.append("Build fingerprint: " + Build.FINGERPRINT + "\n");
txt.append("WebKit version: " + getWebKitVersionFromUserAgentString() + "\n");
- txt.append("WebKit revision: " + getWebKitRevision() + "\n");
+ txt.append("WebKit revision: " + webKitRevision + "\n");
- txt.append("TOTAL: " + getTotalTestCount() + "\n");
- if (mCrashedTestsCount > 0) {
- txt.append("CRASHED (total among all tests): " + mCrashedTestsCount + "\n");
- txt.append("-------------");
- }
- txt.append("UNEXPECTED FAILURES: " + mUnexpectedFailures.size() + "\n");
- txt.append("UNEXPECTED PASSES: " + mUnexpectedPasses.size() + "\n");
- txt.append("EXPECTED FAILURES: " + mExpectedFailures.size() + "\n");
- txt.append("EXPECTED PASSES: " + mExpectedPasses.size() + "\n");
+ txt.append("TOTAL: " + getTotalTestCount() + "\n");
+ txt.append("CRASHED (among all tests): " + mCrashedTestsCount + "\n");
+ txt.append("UNEXPECTED FAILURES: " + mUnexpectedFailures.size() + "\n");
+ txt.append("UNEXPECTED PASSES: " + mUnexpectedPasses.size() + "\n");
+ txt.append("EXPECTED FAILURES: " + mExpectedFailures.size() + "\n");
+ txt.append("EXPECTED PASSES: " + mExpectedPasses.size() + "\n");
FsUtils.writeDataToStorage(new File(mResultsRootDirPath, TXT_SUMMARY_RELATIVE_PATH),
txt.toString().getBytes(), false);
}
- private void createHtmlDetails() {
+ private void createHtmlDetails(String webKitRevision) {
StringBuilder html = new StringBuilder();
html.append("<html><head>");
@@ -287,7 +283,7 @@ public class Summarizer {
html.append(SCRIPT);
html.append("</head><body>");
- createTopSummaryTable(html);
+ createTopSummaryTable(webKitRevision, html);
createResultsListWithDiff(html, "Unexpected failures", mUnexpectedFailures);
@@ -340,22 +336,21 @@ public class Summarizer {
return "unknown";
}
- private void createTopSummaryTable(StringBuilder html) {
+ private void createTopSummaryTable(String webKitRevision, StringBuilder html) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
html.append("<h1>" + mTestsRelativePath + "</h1>");
html.append("<h3>" + "Date: " + dateFormat.format(new Date()) + "</h3>");
html.append("<h3>" + "Build fingerprint: " + Build.FINGERPRINT + "</h3>");
html.append("<h3>" + "WebKit version: " + getWebKitVersionFromUserAgentString() + "</h3>");
- String webkitRevision = getWebKitRevision();
html.append("<h3>" + "WebKit revision: ");
- html.append("<a href=\"http://trac.webkit.org/browser/trunk?rev=" + webkitRevision +
- "\" target=\"_blank\"><span class=\"path\">" + webkitRevision + "</span></a>");
+ html.append("<a href=\"http://trac.webkit.org/browser/trunk?rev=" + webKitRevision +
+ "\" target=\"_blank\"><span class=\"path\">" + webKitRevision + "</span></a>");
html.append("</h3>");
html.append("<table class=\"summary\">");
createSummaryTableRow(html, "TOTAL", getTotalTestCount());
- createSummaryTableRow(html, "CRASHED", mCrashedTestsCount);
+ createSummaryTableRow(html, "CRASHED (among all tests)", mCrashedTestsCount);
createSummaryTableRow(html, "UNEXPECTED FAILURES", mUnexpectedFailures.size());
createSummaryTableRow(html, "UNEXPECTED PASSES", mUnexpectedPasses.size());
createSummaryTableRow(html, "EXPECTED FAILURES", mExpectedFailures.size());
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListPreloaderThread.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListPreloaderThread.java
index c714ec4..e0f1450 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListPreloaderThread.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListPreloaderThread.java
@@ -29,12 +29,6 @@ public class TestsListPreloaderThread extends Thread {
private static final String LOG_TAG = "TestsListPreloaderThread";
- /** TODO: make it a setting */
- private static final String TESTS_ROOT_DIR_PATH =
- Environment.getExternalStorageDirectory() +
- File.separator + "android" +
- File.separator + "LayoutTests";
-
/** A list containing relative paths of tests to run */
private ArrayList<String> mTestsList = new ArrayList<String>();
@@ -55,7 +49,7 @@ public class TestsListPreloaderThread extends Thread {
* @param doneMsg
*/
public TestsListPreloaderThread(String path, Message doneMsg) {
- mFileFilter = new FileFilter(TESTS_ROOT_DIR_PATH);
+ mFileFilter = new FileFilter();
mRelativePath = path;
mDoneMsg = doneMsg;
}
@@ -112,4 +106,4 @@ public class TestsListPreloaderThread extends Thread {
}
}
}
-} \ No newline at end of file
+}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/AdbUtils.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/AdbUtils.java
index d165a1a..086ff59 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/AdbUtils.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/AdbUtils.java
@@ -36,52 +36,45 @@ public class AdbUtils {
private static final int ADB_RESPONSE_SIZE = 4;
/**
- * Send an ADB command using existing socket connection
+ * Creates a new socket that can be configured to serve as a transparent proxy to a
+ * remote machine. This can be achieved by calling configureSocket()
*
- * The streams provided must be from a socket connected to adb already
+ * @return a socket that can be configured to link to remote machine
+ */
+ public static Socket createSocket() {
+ Socket socket = null;
+ try {
+ socket = new Socket(ADB_HOST, ADB_PORT);
+ } catch (IOException e) {
+ Log.e(LOG_TAG, "Creation failed.", e);
+ }
+ return socket;
+ }
+
+ /**
+ * Configures the connection to serve as a transparent proxy to a remote machine.
+ * The given streams must belong to a socket created by createSocket().
*
- * @param is input stream of the socket connection
- * @param os output stream of the socket
- * @param cmd the adb command to send
- * @return if adb gave a success response
+ * @param inputStream inputStream of the socket we want to configure
+ * @param outputStream outputStream of the socket we want to configure
+ * @param remoteAddress address of the remote machine (as you would type in a browser
+ * in a machine that the device is connected to via adb)
+ * @param remotePort port on which to connect
+ * @return if the configuration suceeded
* @throws IOException
*/
- private static boolean sendAdbCmd(InputStream is, OutputStream os, String cmd)
- throws IOException {
- byte[] buf = new byte[ADB_RESPONSE_SIZE];
-
+ public static boolean configureConnection(InputStream inputStream, OutputStream outputStream,
+ String remoteAddress, int remotePort) throws IOException {
+ String cmd = "tcp:" + remotePort + ":" + remoteAddress;
cmd = String.format("%04X", cmd.length()) + cmd;
- os.write(cmd.getBytes());
- int read = is.read(buf);
+
+ byte[] buf = new byte[ADB_RESPONSE_SIZE];
+ outputStream.write(cmd.getBytes());
+ int read = inputStream.read(buf);
if (read != ADB_RESPONSE_SIZE || !ADB_OK.equals(new String(buf))) {
Log.w(LOG_TAG, "adb cmd faild.");
return false;
}
return true;
}
-
- /**
- * Get a tcp socket connection to specified IP address and port proxied by adb
- *
- * The proxying is transparent, e.g. if a socket is returned, then it can be written to and
- * read from as if it is directly connected to the target
- *
- * @param remoteAddress IP address of the host to connect to
- * @param remotePort port of the host to connect to
- * @return a valid Socket instance if successful, null otherwise
- */
- public static Socket getSocketToRemoteMachine(String remoteAddress, int remotePort) {
- try {
- Socket socket = new Socket(ADB_HOST, ADB_PORT);
- String cmd = "tcp:" + remotePort + ":" + remoteAddress;
- if (!sendAdbCmd(socket.getInputStream(), socket.getOutputStream(), cmd)) {
- socket.close();
- return null;
- }
- return socket;
- } catch (IOException ioe) {
- Log.w(LOG_TAG, "error creating adb socket", ioe);
- return null;
- }
- }
} \ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/ConnectionHandler.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/ConnectionHandler.java
index 5e9f24e..4f01dae 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/ConnectionHandler.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/ConnectionHandler.java
@@ -18,6 +18,8 @@ package com.android.dumprendertree2.forwarder;
import android.util.Log;
+import com.android.dumprendertree2.FsUtils;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -38,36 +40,25 @@ public class ConnectionHandler {
private class SocketPipeThread extends Thread {
- private Socket mInSocket, mOutSocket;
+ private InputStream mInputStream;
+ private OutputStream mOutputStream;
- public SocketPipeThread(Socket inSocket, Socket outSocket) {
- mInSocket = inSocket;
- mOutSocket = outSocket;
+ public SocketPipeThread(InputStream inputStream, OutputStream outputStream) {
+ mInputStream = inputStream;
+ mOutputStream = outputStream;
+ setName("SocketPipeThread: " + getName());
}
@Override
public void run() {
- InputStream is;
- OutputStream os;
- try {
- synchronized (this) {
- is = mInSocket.getInputStream();
- os = mOutSocket.getOutputStream();
- }
- } catch (IOException e) {
- Log.w(LOG_TAG, this.toString(), e);
- finish();
- return;
- }
-
byte[] buffer = new byte[4096];
int length;
while (true) {
try {
- if ((length = is.read(buffer)) <= 0) {
+ if ((length = mInputStream.read(buffer)) < 0) {
break;
}
- os.write(buffer, 0, length);
+ mOutputStream.write(buffer, 0, length);
} catch (IOException e) {
/** This exception means one of the streams is closed */
Log.v(LOG_TAG, this.toString(), e);
@@ -75,10 +66,6 @@ public class ConnectionHandler {
}
}
- finish();
- }
-
- private void finish() {
synchronized (mThreadsRunning) {
mThreadsRunning--;
if (mThreadsRunning == 0) {
@@ -90,7 +77,7 @@ public class ConnectionHandler {
@Override
public String toString() {
- return "SocketPipeThread:\n" + mInSocket + "\n=>\n" + mOutSocket;
+ return getName();
}
}
@@ -98,20 +85,51 @@ public class ConnectionHandler {
private Socket mFromSocket, mToSocket;
private SocketPipeThread mFromToPipe, mToFromPipe;
+ private InputStream mFromSocketInputStream, mToSocketInputStream;
+ private OutputStream mFromSocketOutputStream, mToSocketOutputStream;
+
+ private int mPort;
+ private String mRemoteMachineIpAddress;
private OnFinishedCallback mOnFinishedCallback;
- public ConnectionHandler(Socket fromSocket, Socket toSocket) {
+ public ConnectionHandler(String remoteMachineIp, int port, Socket fromSocket, Socket toSocket) {
+ mRemoteMachineIpAddress = remoteMachineIp;
+ mPort = port;
+
mFromSocket = fromSocket;
mToSocket = toSocket;
- mFromToPipe = new SocketPipeThread(mFromSocket, mToSocket);
- mToFromPipe = new SocketPipeThread(mToSocket, mFromSocket);
+
+ try {
+ mFromSocketInputStream = mFromSocket.getInputStream();
+ mToSocketInputStream = mToSocket.getInputStream();
+ mFromSocketOutputStream = mFromSocket.getOutputStream();
+ mToSocketOutputStream = mToSocket.getOutputStream();
+ if (!AdbUtils.configureConnection(mToSocketInputStream, mToSocketOutputStream,
+ mRemoteMachineIpAddress, mPort)) {
+ throw new IOException("Configuring socket failed!");
+ }
+ } catch (IOException e) {
+ Log.e(LOG_TAG, "Unable to start ConnectionHandler", e);
+ closeStreams();
+ return;
+ }
+
+ mFromToPipe = new SocketPipeThread(mFromSocketInputStream, mToSocketOutputStream);
+ mToFromPipe = new SocketPipeThread(mToSocketInputStream, mFromSocketOutputStream);
}
public void registerOnConnectionHandlerFinishedCallback(OnFinishedCallback callback) {
mOnFinishedCallback = callback;
}
+ private void closeStreams() {
+ FsUtils.closeInputStream(mFromSocketInputStream);
+ FsUtils.closeInputStream(mToSocketInputStream);
+ FsUtils.closeOutputStream(mFromSocketOutputStream);
+ FsUtils.closeOutputStream(mToSocketOutputStream);
+ }
+
public void start() {
/** We have 2 threads running, one for each pipe, that we start here. */
mThreadsRunning = 2;
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/Forwarder.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/Forwarder.java
index 31cd8ea..b361a89 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/Forwarder.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/Forwarder.java
@@ -60,19 +60,18 @@ public class Forwarder extends Thread {
@Override
public void run() {
while (true) {
- /** These sockets will be closed when Forwarder.stop() is called */
Socket localSocket;
Socket remoteSocket;
try {
localSocket = mServerSocket.accept();
- remoteSocket = AdbUtils.getSocketToRemoteMachine(mRemoteMachineIpAddress,
- mPort);
} catch (IOException e) {
/** This most likely means that mServerSocket is already closed */
Log.w(LOG_TAG, "mPort=" + mPort, e);
break;
}
+ remoteSocket = AdbUtils.createSocket();
+
if (remoteSocket == null) {
try {
localSocket.close();
@@ -86,7 +85,8 @@ public class Forwarder extends Thread {
}
final ConnectionHandler connectionHandler =
- new ConnectionHandler(localSocket, remoteSocket);
+ new ConnectionHandler(mRemoteMachineIpAddress, mPort, localSocket,
+ remoteSocket);
/**
* We have to close the sockets after the ConnectionHandler finishes, so we
@@ -98,9 +98,7 @@ public class Forwarder extends Thread {
@Override
public void onFinished() {
synchronized (this) {
- if (mConnectionHandlers.remove(connectionHandler)) {
- Log.d(LOG_TAG, "removeConnectionHandler(): removed");
- } else {
+ if (!mConnectionHandlers.remove(connectionHandler)) {
assert false : "removeConnectionHandler(): not in the collection";
}
}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
index b1862ef..35de88a 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
@@ -56,10 +56,6 @@ import java.util.List;
public class DirListActivity extends ListActivity {
private static final String LOG_TAG = "DirListActivity";
- private static final String ROOT_DIR_PATH =
- Environment.getExternalStorageDirectory() +
- File.separator + "android" +
- File.separator + "LayoutTests";
/** TODO: This is just a guess - think of a better way to achieve it */
private static final int MEAN_TITLE_CHAR_SIZE = 13;
@@ -82,13 +78,6 @@ public class DirListActivity extends ListActivity {
private String mCurrentDirPath;
/**
- * TODO: This should not be a constant, but rather be configurable from somewhere.
- */
- private String mRootDirPath = ROOT_DIR_PATH;
-
- private FileFilter mFileFilter;
-
- /**
* A thread responsible for loading the contents of the directory from sd card
* and sending them via Message to main thread that then loads them into
* ListView
@@ -196,7 +185,6 @@ public class DirListActivity extends ListActivity {
ForwarderManager.getForwarderManager().start();
- mFileFilter = new FileFilter(ROOT_DIR_PATH);
mListView = getListView();
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@@ -420,4 +408,4 @@ public class DirListActivity extends ListActivity {
return subDirs.toArray(new ListItem[subDirs.size()]);
}
-} \ No newline at end of file
+}
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml
index db1e5ef..d30a723 100644
--- a/tests/HwAccelerationTest/AndroidManifest.xml
+++ b/tests/HwAccelerationTest/AndroidManifest.xml
@@ -15,7 +15,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.google.android.test.hwui">
+ package="com.android.test.hwui">
<application
android:label="HwUi"
@@ -71,6 +71,15 @@
</activity>
<activity
+ android:name="NewLayersActivity"
+ android:label="_NewLayers">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity
android:name="XfermodeActivity"
android:label="_Xfermodes"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
@@ -164,6 +173,15 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+
+ <activity
+ android:name="TransparentListActivity"
+ android:label="_TransparentList">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
<activity
android:name="MoreShadersActivity"
@@ -230,6 +248,16 @@
</activity>
<activity
+ android:name="FramebufferBlendActivity"
+ android:label="_FramebufferBlend">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+
+ <activity
android:name="StackActivity"
android:label="_Stacks">
<intent-filter>
diff --git a/tests/HwAccelerationTest/res/drawable/default_wallpaper.jpg b/tests/HwAccelerationTest/res/drawable/default_wallpaper.jpg
new file mode 100644
index 0000000..5acad94
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable/default_wallpaper.jpg
Binary files differ
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/AdvancedBlendActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java
index 6c80a6d..5baa20c 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/AdvancedBlendActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/AlphaLayersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/AlphaLayersActivity.java
index 0217a05..1a68a93 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/AlphaLayersActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/AlphaLayersActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java
index cfa8d3c..4054353 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsAlphaActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsAlphaActivity.java
index f6fd8fe..ef49c7f 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsAlphaActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsAlphaActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsRectActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsRectActivity.java
index f8726c2..b192209 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/BitmapsRectActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsRectActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ColorFiltersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersActivity.java
index 49e1eaa..09d63d6 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ColorFiltersActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/FramebufferBlendActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/FramebufferBlendActivity.java
new file mode 100644
index 0000000..1556bae
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/FramebufferBlendActivity.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.android.test.hwui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.LinearGradient;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffXfermode;
+import android.graphics.Shader;
+import android.os.Bundle;
+import android.view.View;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class FramebufferBlendActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(new BlendView(this));
+ }
+
+ static class BlendView extends View {
+ private int mTexWidth;
+ private int mTexHeight;
+ private Paint mPaint;
+ private LinearGradient mHorGradient;
+ private Bitmap mTexture;
+
+ BlendView(Context c) {
+ super(c);
+
+ mTexture = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
+ mTexWidth = mTexture.getWidth();
+ mTexHeight = mTexture.getHeight();
+
+ mHorGradient = new LinearGradient(0.0f, 0.0f, mTexWidth, 0.0f,
+ Color.BLACK, Color.WHITE, Shader.TileMode.CLAMP);
+
+ mPaint = new Paint();
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ canvas.drawRGB(255, 255, 255);
+
+ canvas.save();
+ canvas.translate(40.0f, 40.0f);
+
+ drawBlendedBitmap(canvas, PorterDuff.Mode.DARKEN);
+ drawBlendedBitmap(canvas, PorterDuff.Mode.LIGHTEN);
+ drawBlendedBitmap(canvas, PorterDuff.Mode.MULTIPLY);
+
+ canvas.restore();
+
+ canvas.save();
+ canvas.translate(40.0f + mTexWidth + 40.0f, 40.0f);
+
+ drawBlendedBitmap(canvas, PorterDuff.Mode.SCREEN);
+ drawBlendedBitmap(canvas, PorterDuff.Mode.ADD);
+ drawBlendedBitmapInverse(canvas, PorterDuff.Mode.OVERLAY);
+
+ canvas.restore();
+ }
+
+ private void drawBlendedBitmap(Canvas canvas, PorterDuff.Mode mode) {
+ mPaint.setShader(null);
+ mPaint.setXfermode(null);
+ canvas.drawBitmap(mTexture, 0.0f, 0.0f, mPaint);
+
+ mPaint.setShader(mHorGradient);
+ mPaint.setXfermode(new PorterDuffXfermode(mode));
+ canvas.drawRect(0.0f, 0.0f, mTexWidth, mTexHeight, mPaint);
+
+ canvas.translate(0.0f, 40.0f + mTexHeight);
+ }
+
+ private void drawBlendedBitmapInverse(Canvas canvas, PorterDuff.Mode mode) {
+ mPaint.setXfermode(null);
+ mPaint.setShader(mHorGradient);
+ canvas.drawRect(0.0f, 0.0f, mTexWidth, mTexHeight, mPaint);
+
+ mPaint.setXfermode(new PorterDuffXfermode(mode));
+ mPaint.setShader(null);
+ canvas.drawBitmap(mTexture, 0.0f, 0.0f, mPaint);
+
+ canvas.translate(0.0f, 40.0f + mTexHeight);
+ }
+ }
+}
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/LayersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/LayersActivity.java
index 437cd1c..b705117 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/LayersActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/LayersActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/LinesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java
index c800d42..208dd88 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/LinesActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ListActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ListActivity.java
index 94b936b..8fd4f6b 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ListActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ListActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/MoreShadersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java
index f43eeba..182a474 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/MoreShadersActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/NewLayersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/NewLayersActivity.java
new file mode 100644
index 0000000..5b7753e
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/NewLayersActivity.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.test.hwui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.view.View;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class NewLayersActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(new LayersView(this));
+ }
+
+ static class LayersView extends View {
+ private Paint mLayerPaint;
+ private final Paint mRectPaint;
+
+ LayersView(Context c) {
+ super(c);
+
+ mLayerPaint = new Paint();
+ mRectPaint = new Paint();
+ mRectPaint.setAntiAlias(true);
+ mRectPaint.setTextSize(24.0f);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ canvas.drawRGB(128, 255, 128);
+ canvas.translate(140.0f, 100.0f);
+
+ mLayerPaint.setAlpha(127);
+ int count = canvas.saveLayer(0.0f, 0.0f, 200.0f, 100.0f, mLayerPaint,
+ Canvas.ALL_SAVE_FLAG);
+
+ mRectPaint.setColor(0x7fff0000);
+ canvas.drawRect(-20.0f, -20.0f, 220.0f, 120.0f, mRectPaint);
+
+ mRectPaint.setColor(0xff000000);
+ canvas.drawText("This is a very long string to overlap between layers and framebuffer",
+ -100.0f, 50.0f, mRectPaint);
+
+ canvas.restoreToCount(count);
+
+ canvas.translate(0.0f, 200.0f);
+
+ mLayerPaint.setAlpha(127);
+ count = canvas.saveLayer(0.0f, 0.0f, 200.0f, 100.0f, mLayerPaint,
+ Canvas.HAS_ALPHA_LAYER_SAVE_FLAG);
+
+ mRectPaint.setColor(0x7fff0000);
+ canvas.drawRect(-20.0f, -20.0f, 220.0f, 120.0f, mRectPaint);
+
+ mRectPaint.setColor(0xff000000);
+ canvas.drawText("This is a very long string to overlap between layers and framebuffer",
+ -100.0f, 50.0f, mRectPaint);
+
+ canvas.restoreToCount(count);
+ }
+ }
+}
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/NinePatchesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/NinePatchesActivity.java
index 3268fbf..7410f79 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/NinePatchesActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/NinePatchesActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/PathsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/PathsActivity.java
index 39d9942..8d9bf37 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/PathsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/PathsActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/QuickRejectActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/QuickRejectActivity.java
index 2ba249a..5192bfe 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/QuickRejectActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/QuickRejectActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ResizeActivity.java
index e5771b8..04f9de1 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ResizeActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ResizeActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/RotationActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/RotationActivity.java
index e629cb8..5c309b4 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/RotationActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/RotationActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ShadersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java
index 0cd1426..9c8e7ec 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/ShadersActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/SimplePathsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/SimplePathsActivity.java
index 071a118..c3e18a3 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/SimplePathsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/SimplePathsActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/StackActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/StackActivity.java
index 5c8db6e..5655adf 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/StackActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/StackActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.graphics.drawable.Drawable;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java
index abe9d5e..eb0df51 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextGammaActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java
index 185cfa4..773d390 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextGammaActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/Transform3dActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/Transform3dActivity.java
index 6134cde..6df66e6 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/Transform3dActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/Transform3dActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java
new file mode 100644
index 0000000..f47b00f
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.test.hwui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.util.DisplayMetrics;
+import android.view.ContextMenu;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class TransparentListActivity extends Activity {
+ private static final String[] DATA_LIST = {
+ "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
+ "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina",
+ "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
+ "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium",
+ "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia",
+ "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil",
+ "British Indian Ocean Territory", "British Virgin Islands", "Brunei", "Bulgaria",
+ "Burkina Faso", "Burundi", "Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde",
+ "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
+ "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
+ "Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czech Republic",
+ "Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic",
+ "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea",
+ "Estonia", "Ethiopia", "Faeroe Islands", "Falkland Islands", "Fiji", "Finland",
+ "Former Yugoslav Republic of Macedonia", "France", "French Guiana", "French Polynesia",
+ "French Southern Territories", "Gabon", "Georgia", "Germany", "Ghana", "Gibraltar",
+ "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau",
+ "Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong", "Hungary",
+ "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica",
+ "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos",
+ "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg",
+ "Macau", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands",
+ "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova",
+ "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia",
+ "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand",
+ "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "Northern Marianas",
+ "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru",
+ "Philippines", "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar",
+ "Reunion", "Romania", "Russia", "Rwanda", "Sqo Tome and Principe", "Saint Helena",
+ "Saint Kitts and Nevis", "Saint Lucia", "Saint Pierre and Miquelon",
+ "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Saudi Arabia", "Senegal",
+ "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands",
+ "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Korea",
+ "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden",
+ "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas",
+ "The Gambia", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey",
+ "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda",
+ "Ukraine", "United Arab Emirates", "United Kingdom",
+ "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan",
+ "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Wallis and Futuna", "Western Sahara",
+ "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.default_wallpaper));
+ setContentView(R.layout.list_activity);
+
+ ListAdapter adapter = new SimpleListAdapter(this);
+
+ ListView list = (ListView) findViewById(R.id.list);
+ list.setAdapter(adapter);
+ list.setCacheColorHint(0);
+
+ registerForContextMenu(list);
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ super.onCreateContextMenu(menu, v, menuInfo);
+ menu.setHeaderTitle("Context menu");
+ menu.add("List item 1");
+ menu.add("List item 2");
+ menu.add("List item 3");
+ }
+
+ private static class SimpleListAdapter extends ArrayAdapter<String> {
+ public SimpleListAdapter(Context context) {
+ super(context, android.R.layout.simple_list_item_1, DATA_LIST);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ TextView v = (TextView) super.getView(position, convertView, parent);
+ final Resources r = getContext().getResources();
+ final DisplayMetrics metrics = r.getDisplayMetrics();
+ v.setCompoundDrawablePadding((int) (6 * metrics.density + 0.5f));
+ v.setCompoundDrawablesWithIntrinsicBounds(r.getDrawable(R.drawable.icon),
+ null, null, null);
+ return v;
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/XfermodeActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/XfermodeActivity.java
index 8c81f02..411077f 100644
--- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/XfermodeActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/XfermodeActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.test.hwui;
+package com.android.test.hwui;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java
index b665d2f..e31711e 100644
--- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java
+++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java
@@ -60,20 +60,19 @@ public class StatusBarTest extends TestActivity
}
private Test[] mTests = new Test[] {
- new Test("Hide") {
+ new Test("Hide (FLAG_FULLSCREEN)") {
public void run() {
Window win = getWindow();
- WindowManager.LayoutParams winParams = win.getAttributes();
- winParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
- win.setAttributes(winParams);
+ win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ Log.d(TAG, "flags=" + Integer.toHexString(win.getAttributes().flags));
}
},
- new Test("Show") {
+ new Test("Show (~FLAG_FULLSCREEN)") {
public void run() {
Window win = getWindow();
- WindowManager.LayoutParams winParams = win.getAttributes();
- winParams.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
- win.setAttributes(winParams);
+ win.setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ Log.d(TAG, "flags=" + Integer.toHexString(win.getAttributes().flags));
}
},
new Test("Immersive: Enter") {