自 2026 年起,为了与我们的主干稳定开发模型保持一致,并确保生态系统的平台稳定性,我们将在第 2 季度和第 4 季度将源代码发布到 AOSP。对于构建 AOSP 和向 AOSP 贡献代码,我们建议使用 android-latest-release 而不是 aosp-main。android-latest-release 清单分支将始终引用推送到 AOSP 的最新版本。如需了解详情,请参阅 AOSP 变更。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
SecurityTestCase
public
class
SecurityTestCase
extends StsExtraBusinessLogicHostTestBase
| java.lang.Object
|
| ↳ |
com.android.tradefed.testtype.junit4.BaseHostJUnit4Test
|
| |
↳ |
com.android.compatibility.common.tradefed.testtype.BusinessLogicHostTestBase
|
| |
|
↳ |
com.android.compatibility.common.tradefed.testtype.ExtraBusinessLogicHostTestBase
|
| |
|
|
↳ |
com.android.sts.common.tradefed.testtype.StsExtraBusinessLogicHostTestBase
|
| |
|
|
|
↳ |
com.android.sts.common.tradefed.testtype.SecurityTestCase
|
所有 STS 测试的基准测试类。
请改为使用 RootSecurityTestCase 或 NonRootSecurityTestCase。
摘要
受保护的方法 |
boolean
|
containsDriver(ITestDevice device, String driver, boolean checkReadable)
检查计算机上是否存在驱动程序。
|
boolean
|
containsDriver(ITestDevice device, String driver)
检查驱动程序是否存在且可读。
|
常量
TIMEOUT_DEFAULT
protected static final int TIMEOUT_DEFAULT
常量值:
60
(0x0000003c)
TIMEOUT_NONDETERMINISTIC
public static final int TIMEOUT_NONDETERMINISTIC
常量值:
315
(0x0000013b)
字段
testName
public TestName testName
公共构造函数
SecurityTestCase
public SecurityTestCase ()
公共方法
assertMatches
public void assertMatches (String pattern,
String input)
| 参数 |
pattern |
String |
input |
String |
assertMatchesMultiLine
public void assertMatchesMultiLine (String pattern,
String input)
| 参数 |
pattern |
String |
input |
String |
assertNotKernelPointer
public void assertNotKernelPointer (Callable<String> getPtrFunction,
ITestDevice deviceToReboot)
运行提供的函数,用于收集字符串以针对内核指针泄露进行测试。getPtrFunction 函数实现必须返回以指针开头的字符串。例如“01234567”。允许使用尾随字符,但 [0-9a-fA-F] 除外。如果指针似乎存在漏洞,系统会抛出 JUnit 断言。由于内核指针可以进行哈希处理,因此经过哈希处理的指针可能会与正常内核空间重叠。系统会重新运行测试,以使假正例在统计上不显著。如果内核指针在未重启的情况下不会更改,请提供要重启的设备。
| 参数 |
getPtrFunction |
Callable:一个函数,用于返回以指针开头的字符串 |
deviceToReboot |
ITestDevice:当内核指针不会更改时,设备会重启
|
assertNotMatches
public void assertNotMatches (String pattern,
String input)
| 参数 |
pattern |
String |
input |
String |
assertNotMatchesMultiLine
public void assertNotMatchesMultiLine (String pattern,
String input)
| 参数 |
pattern |
String |
input |
String |
assertWifiConnected
public void assertWifiConnected (ITestDevice device)
断言 Wi-Fi 连接状态为已连接。由于 STS 可以在运行测试之前立即重启设备,因此在测试运行之前可能无法连接到 Wi-Fi。我们会轮询 Wi-Fi,直到超时或 Wi-Fi 连接为止。
| 参数 |
device |
ITestDevice:要运行的设备
|
assumeIsSupportedNfcDevice
public void assumeIsSupportedNfcDevice (ITestDevice device)
buildMetricsReportLog
public static MetricsReportLog buildMetricsReportLog (ITestDevice device)
createWifiHelper
public WifiHelper createWifiHelper ()
| 抛出 |
DeviceNotAvailableException |
|
getAbi
public static IAbi getAbi (ITestDevice device)
getBuildInfo
public static IBuildInfo getBuildInfo (ITestDevice device)
getPocPusher
public static PocPusher getPocPusher (ITestDevice device)
getTestName
public static String getTestName (ITestDevice device)
moduleIsPlayManaged
public boolean moduleIsPlayManaged (String modulePackageName)
如果模块由 Play 管理,则返回 true。
基于 Mainline 模块跳过测试的示例:
@Test
public void testPocCVE_1234_5678() throws Exception {
// This will skip the test if MODULE_METADATA mainline module is play managed.
assumeFalse(moduleIsPlayManaged("com.google.android.captiveportallogin"));
// Do testing...
}
| 参数 |
modulePackageName |
String |
safeReboot
public void safeReboot ()
| 抛出 |
DeviceNotAvailableException |
|
setUp
public void setUp ()
等待设备上线,标记设备的最近启动时间
tearDown
public void tearDown ()
确保手机已联网,并检查设备是否发生了崩溃
updateKernelStartTime
public void updateKernelStartTime ()
如果在计划的重新启动后调用,则允许测试通过。
| 抛出 |
DeviceNotAvailableException |
|
受保护的方法
containsDriver
protected boolean containsDriver (ITestDevice device,
String driver,
boolean checkReadable)
检查计算机上是否存在驱动程序。
| 参数 |
device |
ITestDevice |
driver |
String |
checkReadable |
boolean |
containsDriver
protected boolean containsDriver (ITestDevice device,
String driver)
检查驱动程序是否存在且可读。
| 参数 |
device |
ITestDevice |
driver |
String |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-27。"],[],[]]