diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2019-10-10 18:47:46 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-10-10 18:47:46 +0000 |
commit | ee2b75f8ac50f9868b20668aace3518d1d407246 (patch) | |
tree | 04e9f3bd2e40880212c9c410d7205e893a3fb397 | |
parent | 1c8a6bbcaea955805e46c0bee68122651d38f4da (diff) | |
parent | 1045188ea0625b16d4bc4c4e309a306f37b871dc (diff) | |
download | cts-nougat-mr1-cts-release.tar.gz |
Merge "Snap for 5905676 from 12b4ca149925047c7e01f43d0080e622c8143c57 to nougat-mr1-cts-release" into nougat-mr1-cts-releaseandroid-cts-7.1_r29nougat-mr1-cts-release
18 files changed, 315 insertions, 101 deletions
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml index aeaddc99d36..9e852421890 100644 --- a/apps/CtsVerifier/AndroidManifest.xml +++ b/apps/CtsVerifier/AndroidManifest.xml @@ -18,7 +18,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.cts.verifier" android:versionCode="5" - android:versionName="7.1_r28"> + android:versionName="7.1_r29"> <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="25"/> diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml index ace06d33011..4b6a17fd54a 100755 --- a/apps/CtsVerifier/res/values/strings.xml +++ b/apps/CtsVerifier/res/values/strings.xml @@ -1733,6 +1733,7 @@ You should be prompted to select credentials; choose the ones you just installed Verify that the notification is badged (see sample badge below). Then mark this test accordingly. </string> <string name="provisioning_byod_notification_title">This is a notification</string> + <string name="provisioning_byod_notification_public_title">Contents hidden by policy</string> <string name="provisioning_byod_disallow_apps_control">Disallow apps control</string> <string name="provisioning_byod_disallow_apps_control_info"> diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java index 86087f2931a..cf1fe0c9bf7 100644 --- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java +++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java @@ -184,9 +184,17 @@ public class ByodHelperActivity extends LocationListenerActivity .setContentTitle(getString(R.string.provisioning_byod_notification_title)) .setVisibility(visibility) .setAutoCancel(true) + .setPublicVersion(createPublicVersionNotification()) .build(); mNotificationManager.notify(NOTIFICATION_ID, notification); } + private Notification createPublicVersionNotification() { + return new Notification.Builder(this) + .setSmallIcon(R.drawable.icon) + .setContentTitle(getString(R.string.provisioning_byod_notification_public_title)) + .setAutoCancel(true) + .build(); + } @Override diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/CrashReporter.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/CrashReporter.java index 42d71e7ff0f..c8a7dfe5af6 100644 --- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/CrashReporter.java +++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/CrashReporter.java @@ -34,6 +34,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.PosixFilePermissions; import java.util.regex.Matcher; +import java.util.List; import java.util.ArrayList; /** @@ -45,7 +46,7 @@ public class CrashReporter implements ITargetCleaner { private BackgroundDeviceAction mBackgroundThread; /** Uploads the current buffer of Crashes to the phone under the current test name. */ - private static void upload(ITestDevice device, String testname, ArrayList<Crash> crashes) { + private static void upload(ITestDevice device, String testname, List<Crash> crashes) { try { if (testname == null) { CLog.logAndDisplay(LogLevel.ERROR, "Attempted upload with no test name"); @@ -113,7 +114,7 @@ public class CrashReporter implements ITargetCleaner { private class CrashReporterReceiver extends MultiLineReceiver { private String mTestName; - private ArrayList<Crash> mCrashes; + private List<Crash> mCrashes; private StringBuilder mLogcatChunk; private ITestDevice mDevice; @@ -125,15 +126,16 @@ public class CrashReporter implements ITargetCleaner { private void processLogLine(String line) { mLogcatChunk.append(line); + mLogcatChunk.append('\n'); Matcher m; - if ((m = CrashUtils.sNewTestPattern.matcher(line)).matches()) { + if ((m = CrashUtils.sNewTestPattern.matcher(line)).find()) { mTestName = m.group(1); mCrashes = new ArrayList<Crash>(); mLogcatChunk.setLength(0); - } else if (CrashUtils.sEndofCrashPattern.matcher(line).matches()) { + } else if (CrashUtils.sEndofCrashPattern.matcher(line).find()) { mCrashes = CrashUtils.getAllCrashes(mLogcatChunk.toString()); mLogcatChunk.setLength(0); - } else if (CrashUtils.sUploadRequestPattern.matcher(line).matches()) { + } else if (CrashUtils.sUploadRequestPattern.matcher(line).find()) { upload(mDevice, mTestName, mCrashes); } } diff --git a/common/util/src/com/android/compatibility/common/util/Crash.java b/common/util/src/com/android/compatibility/common/util/Crash.java index 190ec39b3d4..0c554007847 100644 --- a/common/util/src/com/android/compatibility/common/util/Crash.java +++ b/common/util/src/com/android/compatibility/common/util/Crash.java @@ -16,28 +16,39 @@ package com.android.compatibility.common.util; -import java.util.Objects; -import java.io.Serializable; import javax.annotation.Nullable; +import java.io.Serializable; +import java.util.Objects; +import java.math.BigInteger; public class Crash implements Serializable { public static final long serialVersionUID = 42L; + public final int pid; public final int tid; - @Nullable - public final String name; - @Nullable - public final Long faultAddress; - @Nullable + public final String threadName; + public final String process; + @Nullable // the fault address is not always present in the log + public final BigInteger faultAddress; public final String signal; + @Nullable + public final String crashString; + + public Crash(int pid, int tid, String threadName, String process, + BigInteger faultAddress, String signal) { + this(pid, tid, threadName, process, faultAddress, signal, null); + } - public Crash(int pid, int tid, String name, Long faultAddress, String signal) { + public Crash(int pid, int tid, String threadName, String process, + BigInteger faultAddress, String signal, String crashString) { this.pid = pid; this.tid = tid; - this.name = name; + this.threadName = threadName; + this.process = process; this.faultAddress = faultAddress; this.signal = signal; + this.crashString = crashString; } @Override @@ -45,8 +56,10 @@ public class Crash implements Serializable { return "Crash{" + "pid=" + pid + ", tid=" + tid + - ", name=" + name + - ", faultAddress=" + faultAddress + + ", threadName=" + threadName + + ", process=" + process + + ", faultAddress=" + + (faultAddress == null ? "--------" : "0x" + faultAddress.toString(16)) + ", signal=" + signal + '}'; } @@ -62,13 +75,14 @@ public class Crash implements Serializable { Crash crash = (Crash) object; return pid == crash.pid && tid == crash.tid && - Objects.equals(name, crash.name) && + Objects.equals(threadName, crash.threadName) && + Objects.equals(process, crash.process) && Objects.equals(faultAddress, crash.faultAddress) && Objects.equals(signal, crash.signal); } @Override public int hashCode() { - return Objects.hash(pid, tid, name, faultAddress, signal); + return Objects.hash(pid, tid, threadName, process, faultAddress, signal); } -}
\ No newline at end of file +} diff --git a/common/util/src/com/android/compatibility/common/util/CrashUtils.java b/common/util/src/com/android/compatibility/common/util/CrashUtils.java index d77b9a0b51a..93d2d2dd8bb 100644 --- a/common/util/src/com/android/compatibility/common/util/CrashUtils.java +++ b/common/util/src/com/android/compatibility/common/util/CrashUtils.java @@ -16,78 +16,106 @@ package com.android.compatibility.common.util; +import java.io.File; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Set; +import java.util.HashSet; +import java.util.stream.Stream; +import java.util.stream.Collectors; +import java.math.BigInteger; /** Contains helper functions and shared constants for crash parsing. */ public class CrashUtils { + // used to only detect actual addresses instead of nullptr and other unlikely values + public static final BigInteger MIN_CRASH_ADDR = new BigInteger("8000", 16); - public static final long MIN_CRASH_ADDR = 32768; // Matches the end of a crash public static final Pattern sEndofCrashPattern = - Pattern.compile(".*DEBUG\\s+:\\s+backtrace:.*"); + Pattern.compile("DEBUG\\s+?:\\s+?backtrace:"); public static final String DEVICE_PATH = "/data/local/tmp/CrashParserResults/"; public static final String LOCK_FILENAME = "lockFile.loc"; public static final String UPLOAD_REQUEST = "Please upload a result file to stagefright"; public static final Pattern sUploadRequestPattern = - Pattern.compile(".*" + UPLOAD_REQUEST + ".*"); + Pattern.compile(UPLOAD_REQUEST); public static final String NEW_TEST_ALERT = "New test starting with name: "; public static final Pattern sNewTestPattern = - Pattern.compile(".*" + NEW_TEST_ALERT + "(\\w+)\\(.*\\).*"); + Pattern.compile(NEW_TEST_ALERT + "(\\w+?)\\(.*?\\)"); // Matches the smallest blob that has the appropriate header and footer private static final Pattern sCrashBlobPattern = - Pattern.compile("DEBUG\\s+:( [*]{3})+.*?DEBUG\\s+:\\s+backtrace:", Pattern.DOTALL); + Pattern.compile("DEBUG\\s+?:( [*]{3})+?.*?DEBUG\\s+?:\\s+?backtrace:", Pattern.DOTALL); // Matches process id and name line and captures them private static final Pattern sPidtidNamePattern = - Pattern.compile("pid: (\\d+), tid: (\\d+), name: ([^\\s]+\\s+)*>>> (.*) <<<"); + Pattern.compile("pid: (\\d+?), tid: (\\d+?), name: ([^\\s]+?\\s+?)*?>>> (.*?) <<<"); // Matches fault address and signal type line private static final Pattern sFaultLinePattern = Pattern.compile( - "\\w+ \\d+ \\((.*)\\), code -*\\d+ \\(.*\\), fault addr " + "\\w+? \\d+? \\((.*?)\\), code -*?\\d+? \\(.*?\\), fault addr " + "(?:0x(\\p{XDigit}+)|-+)"); // Matches the abort message line if it contains CHECK_ private static Pattern sAbortMessageCheckPattern = - Pattern.compile("(?i)Abort message.*CHECK_.*"); + Pattern.compile("(?i)Abort message.*?CHECK_"); + + /** + * returns true if the signal is a segmentation fault or bus error. + */ + public static boolean isSecuritySignal(Crash c) { + return c.signal.toLowerCase().matches("sig(segv|bus)"); + } + + /** + * returns the filename of the process. + * e.g. "/system/bin/mediaserver" returns "mediaserver" + */ + public static String getProcessFileName(Crash c) { + return new File(c.process).getName(); + } /** * Determines if the given input has a {@link com.android.compatibility.common.util.Crash} that * should fail an sts test * - * @param processNames list of applicable process names + * @param processPatterns list of patterns that match applicable process names * @param checkMinAddr if the minimum fault address should be respected * @param crashes list of crashes to check * @return if a crash is serious enough to fail an sts test */ - public static boolean detectCrash( - String[] processNames, boolean checkMinAddr, List<Crash> crashes) { - for (Crash crash : crashes) { - if (!crash.signal.toLowerCase().matches("sig(segv|bus)")) { - continue; - } - - if (checkMinAddr) { - if (crash.faultAddress != null && crash.faultAddress < MIN_CRASH_ADDR) { - continue; - } - } + public static boolean securityCrashDetected( + List<Crash> crashes, boolean checkMinAddr, Pattern... processPatterns) { + return !matchSecurityCrashes(crashes, checkMinAddr, processPatterns).isEmpty(); + } - boolean foundProcess = false; - for (String process : processNames) { - if (crash.name.equals(process)) { - foundProcess = true; - break; - } - } + /** + * Determines which given inputs have a {@link com.android.compatibility.common.util.Crash} that + * should fail an sts test + * + * @param processPatterns list of patterns that match applicable process names + * @param checkMinAddr if the minimum fault address should be respected + * @param crashes list of crashes to check + * @return the list of crashes serious enough to fail an sts test + */ + public static List<Crash> matchSecurityCrashes( + List<Crash> crashes, boolean checkMinAddr, Pattern... processPatterns) { + return crashes.stream() + .filter(c -> matchesAny(getProcessFileName(c), processPatterns)) + .filter(c -> isSecuritySignal(c)) + .filter(c -> !checkMinAddr + || c.faultAddress == null || c.faultAddress.compareTo(MIN_CRASH_ADDR) >= 0) + .collect(Collectors.toList()); + } - if (!foundProcess) { - continue; + /** + * returns true if the input matches any of the patterns. + */ + private static boolean matchesAny(String input, Pattern... patterns) { + for (Pattern p : patterns) { + if (p.matcher(input).matches()) { + return true; } - - return true; // crash detected } - return false; } @@ -97,26 +125,28 @@ public class CrashUtils { * @param input logs to scan through * @return List of all crashes as Crash objects */ - public static ArrayList<Crash> getAllCrashes(String input) { - ArrayList<Crash> crashes = new ArrayList<>(); + public static List<Crash> getAllCrashes(String input) { + List<Crash> crashes = new ArrayList<>(); Matcher crashBlobFinder = sCrashBlobPattern.matcher(input); while (crashBlobFinder.find()) { String crashStr = crashBlobFinder.group(0); - int tid = 0, pid = 0; - Long faultAddress = null; - String name = null, signal = null; + int tid = 0; + int pid = 0; + BigInteger faultAddress = null; + String name = null; + String process = null; + String signal = null; Matcher pidtidNameMatcher = sPidtidNamePattern.matcher(crashStr); if (pidtidNameMatcher.find()) { try { pid = Integer.parseInt(pidtidNameMatcher.group(1)); - } catch (NumberFormatException e) { - } + } catch (NumberFormatException e) {} try { tid = Integer.parseInt(pidtidNameMatcher.group(2)); - } catch (NumberFormatException e) { - } + } catch (NumberFormatException e) {} name = pidtidNameMatcher.group(3).trim(); + process = pidtidNameMatcher.group(4).trim(); } Matcher faultLineMatcher = sFaultLinePattern.matcher(crashStr); @@ -125,13 +155,12 @@ public class CrashUtils { String faultAddrMatch = faultLineMatcher.group(2); if (faultAddrMatch != null) { try { - faultAddress = Long.parseLong(faultAddrMatch, 16); - } catch (NumberFormatException e) { - } + faultAddress = new BigInteger(faultAddrMatch, 16); + } catch (NumberFormatException e) {} } } if (!sAbortMessageCheckPattern.matcher(crashStr).find()) { - crashes.add(new Crash(pid, tid, name, faultAddress, signal)); + crashes.add(new Crash(pid, tid, name, process, faultAddress, signal, crashStr)); } } diff --git a/common/util/tests/res/logcat.txt b/common/util/tests/res/logcat.txt index ad778c76f9f..b9d10d05aab 100644 --- a/common/util/tests/res/logcat.txt +++ b/common/util/tests/res/logcat.txt @@ -271,4 +271,66 @@ 11-25 19:47:35.597 940 940 F DEBUG : #24 pc 0003fa3b /system/lib/libc.so (_ZL15__pthread_startPv+30) 11-25 19:47:35.597 940 940 F DEBUG : #25 pc 0001a085 /system/lib/libc.so (__start_thread+6) 11-25 19:47:35.837 940 940 F DEBUG : -11-25 19:47:35.837 940 940 F DEBUG : Tombstone written to: /data/tombstones/tombstone_01
\ No newline at end of file +11-25 19:47:35.837 940 940 F DEBUG : Tombstone written to: /data/tombstones/tombstone_01 +--------- beginning of crash +09-03 17:48:05.627 11071 11189 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xe9380000 in tid 11189 (synthetic_thread) +09-03 17:48:05.707 359 359 W : debuggerd: handling request: pid=11071 uid=1041 gid=1005 tid=11189 +09-03 17:48:05.796 7072 7072 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +09-03 17:48:05.796 7072 7072 F DEBUG : Build fingerprint: 'google/angler/angler:7.1.1/N4F26T/3687331:userdebug/dev-keys' +09-03 17:48:05.796 7072 7072 F DEBUG : Revision: '0' +09-03 17:48:05.796 7072 7072 F DEBUG : ABI: 'arm' +09-03 17:48:05.796 7072 7072 F DEBUG : pid: 11071, tid: 11189, name: synthetic_thread >>> synthetic_process_0 <<< +09-03 17:48:05.797 7072 7072 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xe9380000 +09-03 17:48:05.797 7072 7072 F DEBUG : r0 e9e7a240 r1 e9380000 r2 00000170 r3 00000000 +09-03 17:48:05.797 7072 7072 F DEBUG : r4 00000002 r5 00000000 r6 ec1e1f25 r7 eb6f8000 +09-03 17:48:05.797 7072 7072 F DEBUG : r8 00000000 r9 eb105204 sl 00000000 fp 000003c0 +09-03 17:48:05.797 7072 7072 F DEBUG : ip ebd3df18 sp eaf80688 lr ec1e1f41 pc ebd38dd6 cpsr 20000030 +09-03 17:48:05.805 7072 7072 F DEBUG : +09-03 17:48:05.805 7072 7072 F DEBUG : backtrace: +09-03 17:48:05.806 7072 7072 F DEBUG : #00 pc 00002dd6 /system/lib/libaudioutils.so (memcpy_to_float_from_i16+5) +09-03 17:48:05.806 7072 7072 F DEBUG : #01 pc 00040f3d /system/lib/libaudioflinger.so +09-03 17:48:05.806 7072 7072 F DEBUG : #02 pc 00040799 /system/lib/libaudioflinger.so +09-03 17:48:05.806 7072 7072 F DEBUG : #03 pc 00011178 /system/lib/libaudioflinger.so +09-03 17:48:05.806 7072 7072 F DEBUG : #04 pc 0003180b /system/lib/libaudioflinger.so +09-03 17:48:05.806 7072 7072 F DEBUG : #05 pc 0002fe57 /system/lib/libaudioflinger.so +09-03 17:48:05.806 7072 7072 F DEBUG : #06 pc 0000e345 /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+140) +09-03 17:48:05.806 7072 7072 F DEBUG : #07 pc 000470b3 /system/lib/libc.so (_ZL15__pthread_startPv+22) +09-03 17:48:05.806 7072 7072 F DEBUG : #08 pc 00019e3d /system/lib/libc.so (__start_thread+6) +09-03 17:48:05.967 11272 11568 W NativeCrashListener: Couldn't find ProcessRecord for pid 11071 +09-03 17:48:05.969 359 359 W : debuggerd: resuming target 11071 +09-03 17:48:05.981 11272 11307 I BootReceiver: Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE) +09-03 17:48:06.067 394 394 I ServiceManager: service 'media.sound_trigger_hw' died +06-15 19:57:33.607 12736 12761 D PermissionCache: checking android.permission.MODIFY_AUDIO_SETTINGS for uid=10197 => granted (698 us) +--------- beginning of crash +06-15 19:57:33.607 12736 12761 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 12761 (synthetic_thread) +06-15 19:57:33.608 379 379 W : debuggerd: handling request: pid=12736 uid=1041 gid=1005 tid=12761 +06-15 19:57:33.670 26192 26192 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +06-15 19:57:33.670 26192 26192 F DEBUG : Build fingerprint: 'google/bullhead/bullhead:7.1.2/N2G48C/4104010:userdebug/dev-keys' +06-15 19:57:33.670 26192 26192 F DEBUG : Revision: 'rev_1.0' +06-15 19:57:33.670 26192 26192 F DEBUG : ABI: 'arm' +06-15 19:57:33.670 26192 26192 F DEBUG : pid: 12736, tid: 12761, name: synthetic_thread >>> synthetic_process_1 <<< +06-15 19:57:33.670 26192 26192 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 +06-15 19:57:33.670 26192 26192 F DEBUG : r0 00000000 r1 00000000 r2 0000005f r3 00000000 +06-15 19:57:33.670 26192 26192 F DEBUG : r4 ffffffff r5 00000000 r6 f14f9000 r7 00000001 +06-15 19:57:33.670 26192 26192 F DEBUG : r8 00000004 r9 f3353114 sl f3313900 fp 00000000 +06-15 19:57:33.670 26192 26192 F DEBUG : ip f3bd4d88 sp f127d9c8 lr f3b9cbc5 pc f3b65af4 cpsr 60000030 +06-15 19:57:33.676 26192 26192 F DEBUG : +06-15 19:57:33.676 26192 26192 F DEBUG : backtrace: +06-15 19:57:33.677 26192 26192 F DEBUG : #00 pc 00018af4 /system/lib/libc.so (strlen+71) +06-15 19:57:33.677 26192 26192 F DEBUG : #01 pc 0004fbc1 /system/lib/libc.so (__strlen_chk+4) +06-15 19:57:33.677 26192 26192 F DEBUG : #02 pc 0000c599 /system/lib/libutils.so (_ZN7android7String8C2EPKc+12) +06-15 19:57:33.677 26192 26192 F DEBUG : #03 pc 0002fdbf /system/lib/libaudiopolicymanagerdefault.so (_ZNK7android18HwModuleCollection19getDeviceDescriptorEjPKcS2_b+458) +06-15 19:57:33.677 26192 26192 F DEBUG : #04 pc 0001de47 /system/lib/libaudiopolicymanagerdefault.so (_ZN7android18AudioPolicyManager27setDeviceConnectionStateIntEj24audio_policy_dev_state_tPKcS3_+178) +06-15 19:57:33.677 26192 26192 F DEBUG : #05 pc 0000a009 /system/lib/libaudiopolicyservice.so +06-15 19:57:33.677 26192 26192 F DEBUG : #06 pc 000a01a5 /system/lib/libmedia.so (_ZN7android20BnAudioPolicyService10onTransactEjRKNS_6ParcelEPS1_j+1256) +06-15 19:57:33.677 26192 26192 F DEBUG : #07 pc 000359c3 /system/lib/libbinder.so (_ZN7android7BBinder8transactEjRKNS_6ParcelEPS1_j+70) +06-15 19:57:33.677 26192 26192 F DEBUG : #08 pc 0003d1bb /system/lib/libbinder.so (_ZN7android14IPCThreadState14executeCommandEi+702) +06-15 19:57:33.677 26192 26192 F DEBUG : #09 pc 0003ce07 /system/lib/libbinder.so (_ZN7android14IPCThreadState20getAndExecuteCommandEv+114) +06-15 19:57:33.677 26192 26192 F DEBUG : #10 pc 0003d31b /system/lib/libbinder.so (_ZN7android14IPCThreadState14joinThreadPoolEb+46) +06-15 19:57:33.678 26192 26192 F DEBUG : #11 pc 0004f8c5 /system/lib/libbinder.so +06-15 19:57:33.678 26192 26192 F DEBUG : #12 pc 0000e345 /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+140) +06-15 19:57:33.678 26192 26192 F DEBUG : #13 pc 000470b3 /system/lib/libc.so (_ZL15__pthread_startPv+22) +06-15 19:57:33.678 26192 26192 F DEBUG : #14 pc 00019e3d /system/lib/libc.so (__start_thread+6) +06-15 19:57:33.839 934 2991 W NativeCrashListener: Couldn't find ProcessRecord for pid 12736 +06-15 19:57:33.846 934 952 I BootReceiver: Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE) + diff --git a/common/util/tests/src/com/android/compatibility/common/util/CrashUtilsTest.java b/common/util/tests/src/com/android/compatibility/common/util/CrashUtilsTest.java index 431571ebef1..6a2ab6eb185 100644 --- a/common/util/tests/src/com/android/compatibility/common/util/CrashUtilsTest.java +++ b/common/util/tests/src/com/android/compatibility/common/util/CrashUtilsTest.java @@ -25,6 +25,8 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; +import java.util.regex.Pattern; +import java.math.BigInteger; import junit.framework.TestCase; @@ -60,52 +62,67 @@ public class CrashUtilsTest extends TestCase { @Test public void testGetAllCrashes() throws Exception { List<Crash> expectedResults = new ArrayList<>(); - expectedResults.add(new Crash(11071, 11189, "AudioOut_D", 3912761344L, "SIGSEGV")); - expectedResults.add(new Crash(12736, 12761, "Binder:12736_2", 0L, "SIGSEGV")); - expectedResults.add(new Crash(26201, 26227, "Binder:26201_3", 0L, "SIGSEGV")); - expectedResults.add(new Crash(26246, 26282, "Binder:26246_5", 0L, "SIGSEGV")); - expectedResults.add(new Crash(245, 245, "installd", null, "SIGABRT")); - expectedResults.add(new Crash(6371, 8072, "media.codec", 3976200192L, "SIGSEGV")); - expectedResults.add(new Crash(8373, 8414, "loo", null, "SIGABRT")); + expectedResults.add(new Crash(11071, 11189, "AudioOut_D", "/system/bin/audioserver", + new BigInteger("e9380000", 16), "SIGSEGV")); + expectedResults.add(new Crash(12736, 12761, "Binder:12736_2", "/system/bin/audioserver", + new BigInteger("0", 16), "SIGSEGV")); + expectedResults.add(new Crash(26201, 26227, "Binder:26201_3", "/system/bin/audioserver", + new BigInteger("0", 16), "SIGSEGV")); + expectedResults.add(new Crash(26246, 26282, "Binder:26246_5", "/system/bin/audioserver", + new BigInteger("0", 16), "SIGSEGV")); + expectedResults.add(new Crash(245, 245, "installd", "/system/bin/installd", + null, "SIGABRT")); + expectedResults.add(new Crash(6371, 8072, "media.codec", "omx@1.0-service", + new BigInteger("ed000000", 16), "SIGSEGV")); + expectedResults.add(new Crash(8373, 8414, "loo", "com.android.bluetooth", + null, "SIGABRT")); + expectedResults.add(new Crash(11071, 11189, "synthetic_thread", "synthetic_process_0", + new BigInteger("e9380000", 16), "SIGSEGV")); + expectedResults.add(new Crash(12736, 12761, "synthetic_thread", "synthetic_process_1", + new BigInteger("0", 16), "SIGSEGV")); assertEquals(expectedResults, mCrashes); } @Test public void testValidCrash() throws Exception { - assertTrue(CrashUtils.detectCrash(new String[]{"AudioOut_D"}, true, mCrashes)); + assertTrue(CrashUtils.securityCrashDetected(mCrashes, true, + Pattern.compile("synthetic_process_0"))); } @Test public void testMissingName() throws Exception { - assertFalse(CrashUtils.detectCrash(new String[]{""}, true, mCrashes)); + assertFalse(CrashUtils.securityCrashDetected(mCrashes, true, + Pattern.compile(""))); } @Test public void testSIGABRT() throws Exception { - assertFalse(CrashUtils.detectCrash(new String[]{"installd"}, true, mCrashes)); + assertFalse(CrashUtils.securityCrashDetected(mCrashes, true, + Pattern.compile("installd"))); } @Test public void testFaultAddressBelowMin() throws Exception { - assertFalse( - CrashUtils.detectCrash(new String[]{"Binder:12736_2"}, true, mCrashes)); + assertFalse(CrashUtils.securityCrashDetected(mCrashes, true, + Pattern.compile("synthetic_process_1"))); } @Test public void testIgnoreMinAddressCheck() throws Exception { - assertTrue( - CrashUtils.detectCrash(new String[]{"Binder:12736_2"}, false, mCrashes)); + assertTrue(CrashUtils.securityCrashDetected(mCrashes, false, + Pattern.compile("synthetic_process_1"))); } @Test public void testBadAbortMessage() throws Exception { - assertFalse(CrashUtils.detectCrash(new String[]{"generic"}, true, mCrashes)); + assertFalse(CrashUtils.securityCrashDetected(mCrashes, true, + Pattern.compile("generic"))); } @Test public void testGoodAndBadCrashes() throws Exception { - assertTrue( - CrashUtils.detectCrash(new String[]{"AudioOut_D", "generic"}, true, mCrashes)); + assertTrue(CrashUtils.securityCrashDetected(mCrashes, true, + Pattern.compile("synthetic_process_0"), Pattern.compile("generic"))); } -}
\ No newline at end of file +} diff --git a/hostsidetests/net/app/Android.mk b/hostsidetests/net/app/Android.mk index 9519ec5242f..443ea71b1cc 100644 --- a/hostsidetests/net/app/Android.mk +++ b/hostsidetests/net/app/Android.mk @@ -19,10 +19,13 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := tests -LOCAL_SDK_VERSION := current +#LOCAL_SDK_VERSION := current +LOCAL_PRIVATE_PLATFORM_APIS := true LOCAL_STATIC_JAVA_LIBRARIES := ctsdeviceutil ctstestrunner ub-uiautomator \ CtsHostsideNetworkTestsAidl +LOCAL_JAVA_LIBRARIES := android.test.runner + LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_PACKAGE_NAME := CtsHostsideNetworkTestsApp diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java index 075fce69a04..0795ea60be4 100755 --- a/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java +++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java @@ -29,6 +29,7 @@ import android.net.NetworkRequest; import android.net.VpnService; import android.os.ParcelFileDescriptor; import android.os.Process; +import android.os.SystemProperties; import android.support.test.uiautomator.UiDevice; import android.support.test.uiautomator.UiObject; import android.support.test.uiautomator.UiObjectNotFoundException; @@ -533,6 +534,14 @@ public class VpnTest extends InstrumentationTestCase { public void testDefault() throws Exception { if (!supportedHardware()) return; + // If adb TCP port opened, this test may running by adb over network. + // All of socket would be destroyed in this test. So this test don't + // support adb over network, see b/119382723. + if (SystemProperties.getInt("persist.adb.tcp.port", -1) > -1 + || SystemProperties.getInt("service.adb.tcp.port", -1) > -1) { + Log.i(TAG, "adb is running over the network, so skip this test"); + return; + } FileDescriptor fd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS); @@ -550,6 +559,7 @@ public class VpnTest extends InstrumentationTestCase { FileDescriptor fd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS); + // Shell app must not be put in here or it would kill the ADB-over-network use case String allowedApps = mRemoteSocketFactoryClient.getPackageName() + "," + mPackageName; startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"192.0.2.0/24", "2001:db8::/32"}, @@ -567,6 +577,12 @@ public class VpnTest extends InstrumentationTestCase { FileDescriptor remoteFd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS); String disallowedApps = mRemoteSocketFactoryClient.getPackageName() + "," + mPackageName; + // If adb TCP port opened, this test may running by adb over TCP. + // Add com.android.shell appllication into blacklist to exclude adb socket for VPN test, + // see b/119382723. + // Note: The test don't support running adb over network for root device + disallowedApps = disallowedApps + ",com.android.shell"; + Log.i(TAG, "Append shell app to disallowedApps: " + disallowedApps); startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"192.0.2.0/24", "2001:db8::/32"}, "", disallowedApps); diff --git a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java index e8995aeaac1..51038aece4f 100644 --- a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java +++ b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java @@ -61,7 +61,7 @@ public class RobustnessTest extends Camera2AndroidTestCase { private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE); private static final int CONFIGURE_TIMEOUT = 5000; //ms - private static final int CAPTURE_TIMEOUT = 1000; //ms + private static final int CAPTURE_TIMEOUT = 1500; //ms // For testTriggerInteractions private static final int PREVIEW_WARMUP_FRAMES = 60; diff --git a/tests/tests/net/jni/NativeMultinetworkJni.c b/tests/tests/net/jni/NativeMultinetworkJni.c index ad56b510c32..4531f822eb9 100644 --- a/tests/tests/net/jni/NativeMultinetworkJni.c +++ b/tests/tests/net/jni/NativeMultinetworkJni.c @@ -177,13 +177,17 @@ JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runDatagramCheck( setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo)); // For reference see: - // https://tools.ietf.org/html/draft-tsvwg-quic-protocol-01#section-6.1 - uint8_t quic_packet[] = { - 0x0c, // public flags: 64bit conn ID, 8bit sequence number + // https://tools.ietf.org/html/draft-tsvwg-quic-protocol#section-6.1 + uint8_t quic_packet[1200] = { + 0x0d, // public flags: + // - version present (0x01), + // - 64bit connection ID (0x0c), + // - 1 byte packet number (0x00) 0, 0, 0, 0, 0, 0, 0, 0, // 64bit connection ID - 0x01, // sequence number + 0xaa, 0xda, 0xca, 0xaa, // reserved-space version number + 1, // 1 byte packet number 0x00, // private flags - 0x07, // type: regular frame type "PING" + 0x07, // PING frame (cuz why not) }; arc4random_buf(quic_packet + 1, 8); // random connection ID @@ -211,7 +215,7 @@ JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runDatagramCheck( i + 1, MAX_RETRIES, rcvd, errnum); } } - if (rcvd < sent) { + if (rcvd < 9) { ALOGD("QUIC UDP %s: sent=%zd but rcvd=%zd, errno=%d", kPort, sent, rcvd, errnum); if (rcvd <= 0) { ALOGD("Does this network block UDP port %s?", kPort); @@ -227,8 +231,7 @@ JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runDatagramCheck( return -EPROTO; } - // TODO: log, and compare to the IP address encoded in the - // response, since this should be a public reset packet. + // TODO: Replace this quick 'n' dirty test with proper QUIC-capable code. close(fd); return 0; diff --git a/tests/tests/security/Android.mk b/tests/tests/security/Android.mk index f2b4470cf11..7e573c24d42 100644 --- a/tests/tests/security/Android.mk +++ b/tests/tests/security/Android.mk @@ -21,7 +21,13 @@ LOCAL_MODULE_TAGS := tests # Include both the 32 and 64 bit versions LOCAL_MULTILIB := both -LOCAL_STATIC_JAVA_LIBRARIES := ctstestserver ctstestrunner ctsdeviceutil compatibility-device-util guava +LOCAL_STATIC_JAVA_LIBRARIES := \ + ctstestserver \ + ctstestrunner \ + ctsdeviceutil \ + compatibility-device-util \ + compatibility-common-util-devicesidelib \ + guava LOCAL_JAVA_LIBRARIES := android.test.runner org.apache.http.legacy diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java index 394ae145734..5cc40244c39 100644 --- a/tests/tests/security/src/android/security/cts/StagefrightTest.java +++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java @@ -59,6 +59,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; +import java.util.regex.Pattern; import android.security.cts.R; @@ -447,8 +448,23 @@ public class StagefrightTest extends InstrumentationTestCase { MediaPlayer.OnPreparedListener, MediaPlayer.OnCompletionListener { - private final String[] validProcessNames = { - "mediaserver", "mediadrmserver", "media.extractor", "media.codec", "media.metrics" + private final Pattern[] validProcessPatterns = { + Pattern.compile("adsprpcd"), + Pattern.compile("android\\.hardware\\.cas@\\d+?\\.\\d+?-service"), + Pattern.compile("android\\.hardware\\.drm@\\d+?\\.\\d+?-service"), + Pattern.compile("android\\.hardware\\.drm@\\d+?\\.\\d+?-service\\.clearkey"), + Pattern.compile("android\\.hardware\\.drm@\\d+?\\.\\d+?-service\\.widevine"), + Pattern.compile("android\\.process\\.media"), + Pattern.compile("mediadrmserver"), + Pattern.compile("media\\.extractor"), + Pattern.compile("media\\.metrics"), + Pattern.compile("mediaserver"), + Pattern.compile("media\\.codec"), + Pattern.compile("media\\.swcodec"), + Pattern.compile("\\[?sdcard\\]?"), // name:/system/bin/sdcard, user:media_rw + // Match any vendor processes. + // It should only catch crashes that happen during the test. + Pattern.compile("vendor.*"), }; @Override @@ -496,7 +512,7 @@ public class StagefrightTest extends InstrumentationTestCase { if (crashes == null) { Log.e(TAG, "Crash results not found for test " + getName()); return what; - } else if (CrashUtils.detectCrash(validProcessNames, true, crashes)) { + } else if (CrashUtils.securityCrashDetected(crashes, true, validProcessPatterns)) { return what; } else { Log.i(TAG, "Crash ignored due to no security crash found for test " + diff --git a/tests/tests/text/src/android/text/format/cts/TimeTest.java b/tests/tests/text/src/android/text/format/cts/TimeTest.java index f4f444c409b..1a590a5f784 100644 --- a/tests/tests/text/src/android/text/format/cts/TimeTest.java +++ b/tests/tests/text/src/android/text/format/cts/TimeTest.java @@ -2717,6 +2717,12 @@ public class TimeTest extends AndroidTestCase { Fields.assertTimeEquals(expected, t); } + public void test_bug118835133() { + Time t = new Time("Asia/Singapore"); + Fields.set(t, 2018, 9, 30, 12, 48, 32, 0 /* isDst */, 0, 0, 0); + // With http://b/118835133 toMillis() returns -1. + assertEquals(1540874912000L, t.toMillis(true /* ignoreDst */)); + } private static void assertNormalizeResult(boolean normalizeArgument, Time toNormalize, Time expectedTime, long expectedTimeMillis) { long actualTimeMillis = toNormalize.normalize(normalizeArgument /* ignore isDst */); diff --git a/tests/tests/webkit/src/android/webkit/cts/ServiceWorkerClientTest.java b/tests/tests/webkit/src/android/webkit/cts/ServiceWorkerClientTest.java index e09e0d64006..181bdd3388f 100644 --- a/tests/tests/webkit/src/android/webkit/cts/ServiceWorkerClientTest.java +++ b/tests/tests/webkit/src/android/webkit/cts/ServiceWorkerClientTest.java @@ -56,13 +56,22 @@ public class ServiceWorkerClientTest extends ActivityInstrumentationTestCase2<We + " <script>\n" + " navigator.serviceWorker.register('sw.js').then(function(reg) {\n" + " " + JS_INTERFACE_NAME + ".registrationSuccess();\n" - + " }).catch(function(err) { \n" + + " }).catch(function(err) {\n" + " console.error(err);\n" + " });\n" + " </script>\n" + " </body>\n" + "</html>\n"; private static final String SW_RAW_HTML = "fetch('fetch.html');"; + private static final String SW_UNREGISTER_RAW_JS = + "navigator.serviceWorker.getRegistration().then(function(r) {" + + " r.unregister().then(function(success) {" + + " if (success) " + JS_INTERFACE_NAME + ".unregisterSuccess();" + + " else console.error('unregister() was not successful');" + + " });" + + "}).catch(function(err) {" + + " console.error(err);" + + "});"; private JavascriptStatusReceiver mJavascriptStatusReceiver; private WebViewOnUiThread mOnUiThread; @@ -170,17 +179,34 @@ public class ServiceWorkerClientTest extends ActivityInstrumentationTestCase2<We assertEquals(2, requests.size()); assertEquals(SW_URL, requests.get(0).getUrl().toString()); assertEquals(FETCH_URL, requests.get(1).getUrl().toString()); + + // Clean-up, make sure to unregister the Service Worker. + mOnUiThread.evaluateJavascript(SW_UNREGISTER_RAW_JS, null); + Callable<Boolean> unregisterSuccess = new Callable<Boolean>() { + @Override + public Boolean call() { + return mJavascriptStatusReceiver.mUnregisterSuccess; + } + }; + PollingCheck.check("JS could not unregister Service Worker", POLLING_TIMEOUT, + unregisterSuccess); } // Object added to the page via AddJavascriptInterface() that is used by the test Javascript to // notify back to Java if the Service Worker registration was successful. public final static class JavascriptStatusReceiver { public volatile boolean mRegistrationSuccess = false; + public volatile boolean mUnregisterSuccess = false; @JavascriptInterface public void registrationSuccess() { mRegistrationSuccess = true; } + + @JavascriptInterface + public void unregisterSuccess() { + mUnregisterSuccess = true; + } } } diff --git a/tools/cts-tradefed/Android.mk b/tools/cts-tradefed/Android.mk index 540d0a419ab..f046f77343d 100644 --- a/tools/cts-tradefed/Android.mk +++ b/tools/cts-tradefed/Android.mk @@ -25,7 +25,7 @@ LOCAL_SUITE_BUILD_NUMBER := $(BUILD_NUMBER_FROM_FILE) LOCAL_SUITE_TARGET_ARCH := $(TARGET_ARCH) LOCAL_SUITE_NAME := CTS LOCAL_SUITE_FULLNAME := "Compatibility Test Suite" -LOCAL_SUITE_VERSION := 7.1_r28 +LOCAL_SUITE_VERSION := 7.1_r29 LOCAL_MODULE := cts-tradefed diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml index 73e4f2c08ae..7404463e62d 100644 --- a/tools/cts-tradefed/res/config/cts-known-failures.xml +++ b/tools/cts-tradefed/res/config/cts-known-failures.xml @@ -241,4 +241,9 @@ <!-- b/26149528 --> <option name="compatibility:exclude-filter" value="CtsTelecomTestCases android.telecom.cts.WiredHeadsetTest" /> + + <!-- b/122746861 --> + <option name="compatibility:exclude-filter" value="CtsBackupTestCases" /> + <option name="compatibility:exclude-filter" value="CtsBackupHostTestCases" /> + </configuration> |