Merge "Ignore touch down events near the edge of the screen for the purposes of pulling down the windowshade."
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 9ac8a4d..8fd8e28 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -41,6 +41,7 @@
 import java.util.Set;
 import java.util.WeakHashMap;
 import java.util.concurrent.locks.ReentrantLock;
+import java.util.regex.Pattern;
 
 /**
  * Exposes methods to manage a SQLite database.
@@ -199,6 +200,10 @@
 
     private static final int SLEEP_AFTER_YIELD_QUANTUM = 1000;
 
+    // The pattern we remove from database filenames before
+    // potentially logging them.
+    private static final Pattern EMAIL_IN_DB_PATTERN = Pattern.compile("[\\w\\.\\-]+@[\\w\\.\\-]+");
+
     private long mLastLockMessageTime = 0L;
 
     // Things related to query logging/sampling for debugging
@@ -222,6 +227,9 @@
     /** The path for the database file */
     private String mPath;
 
+    /** The anonymized path for the database file for logging purposes */
+    private String mPathForLogs = null;  // lazily populated
+
     /** The flags passed to open/create */
     private int mFlags;
 
@@ -1833,7 +1841,32 @@
         if (blockingPackage == null) blockingPackage = "";
 
         EventLog.writeEvent(
-            EVENT_DB_OPERATION, mPath, sql, durationMillis, blockingPackage, samplePercent);
+            EVENT_DB_OPERATION,
+            getPathForLogs(),
+            sql,
+            durationMillis,
+            blockingPackage,
+            samplePercent);
+    }
+
+    /**
+     * Removes email addresses from database filenames before they're
+     * logged to the EventLog where otherwise apps could potentially
+     * read them.
+     */
+    private String getPathForLogs() {
+        if (mPathForLogs != null) {
+            return mPathForLogs;
+        }
+        if (mPath == null) {
+            return null;
+        }
+        if (mPath.indexOf('@') == -1) {
+            mPathForLogs = mPath;
+        } else {
+            mPathForLogs = EMAIL_IN_DB_PATTERN.matcher(mPath).replaceAll("XX@YY");
+        }
+        return mPathForLogs;
     }
 
     /**
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
index 14a6abf..ac98054 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
@@ -16,45 +16,47 @@
 
 package com.android.dumprendertree;
 
-import java.util.HashSet;
-import java.util.Hashtable;
+import java.util.Vector;
 import android.util.*;
 
 public class FileFilter {
 
+    private static final String LOGTAG = "FileFilter";
+
     public static boolean ignoreTest(String file) {
-      // treat files like directories for the time being.
-      for (int i = 0; i < ignoreTestList.length; i ++) {
-          if (file.endsWith(ignoreTestList[i])) {
-             Log.e("FileFilter", "File path in IgnoreTest: " + file); 
-             return true;
-          }
-      }
-      for (int i = 0; i < ignoreTestDirs.length; i++) {
-          if (file.endsWith(ignoreTestDirs[i])) {
-              Log.e("FileFilter", "File path in ignore list: " + file);
-              return true;
-          }
-      }
-      
-      return false;
-    }
- 
-    public static boolean ignoreResults(String file) {
-        int index = file.indexOf("fast");
-        if (index != -1) {
-            String sub = file.substring(index);
-            if (ignoreResultList.contains(sub))
+        // treat files like directories for the time being.
+        for (int i = 0; i < ignoreTestList.length; i ++) {
+            if (file.endsWith(ignoreTestList[i])) {
+                Log.v(LOGTAG, "File path in list of ignored tests: " + file);
                 return true;
+            }
+        }
+        for (int i = 0; i < ignoreTestDirs.length; i++) {
+            if (file.endsWith(ignoreTestDirs[i])) {
+                Log.v(LOGTAG, "File path in list of ignored directories: " + file);
+                return true;
+            }
+        }
+        // We should run tests for which the expected result is wrong, as there is
+        // value in checking that they don't cause crashes.
+        // TODO: Run these tests but ignore the result.
+        return ignoreResults(file);
+    }
+
+    public static boolean ignoreResults(String file) {
+        for (int i = 0; i < ignoreResultList.size(); i++) {
+            if (file.endsWith(ignoreResultList.get(i))) {
+                Log.v(LOGTAG, "File path in list of ignored results: " + file);
+                return true;
+            }
         }
         return false;
+      }
 
-    }
-
-    final static HashSet<String> ignoreResultList = new HashSet<String>();
+    final static Vector<String> ignoreResultList = new Vector<String>();
 
     static {
-        fillIgnoreResultSet();
+        fillIgnoreResultList();
     }
 
     static final String[] ignoreTestDirs = {
@@ -78,7 +80,7 @@
         "storage/private-browsing-readonly.html", // No notion of private browsing.
     };
 
-    static void fillIgnoreResultSet() {
+    static void fillIgnoreResultList() {
         ignoreResultList.add("fast/css/case-transform.html"); // will not fix #619707
         ignoreResultList.add("fast/dom/Element/offsetLeft-offsetTop-body-quirk.html"); // different screen size result in extra spaces in Apple compared to us
         ignoreResultList.add("fast/dom/Window/Plug-ins.html"); // need test plugin