ตั้งแต่ปี 2026 เป็นต้นไป เราจะเผยแพร่ซอร์สโค้ดไปยัง AOSP ในไตรมาสที่ 2 และ 4 เพื่อให้สอดคล้องกับโมเดลการพัฒนาที่เสถียรของ Trunk และรับประกันความเสถียรของแพลตฟอร์มสำหรับระบบนิเวศ เราขอแนะนำให้ใช้ android-latest-release แทน aosp-main ในการสร้างและมีส่วนร่วมใน AOSP android-latest-release สาขาไฟล์ Manifest จะอ้างอิงถึงรุ่นล่าสุดที่พุชไปยัง 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)
| พารามิเตอร์ |
device |
ITestDevice |
buildMetricsReportLog
public static MetricsReportLog buildMetricsReportLog (ITestDevice device)
| พารามิเตอร์ |
device |
ITestDevice |
| คิกรีเทิร์น |
MetricsReportLog |
|
createWifiHelper
public WifiHelper createWifiHelper ()
| การโยน |
DeviceNotAvailableException |
|
getAbi
public static IAbi getAbi (ITestDevice device)
| พารามิเตอร์ |
device |
ITestDevice |
getBuildInfo
public static IBuildInfo getBuildInfo (ITestDevice device)
| พารามิเตอร์ |
device |
ITestDevice |
getPocPusher
public static PocPusher getPocPusher (ITestDevice device)
| พารามิเตอร์ |
device |
ITestDevice |
getTestName
public static String getTestName (ITestDevice device)
| พารามิเตอร์ |
device |
ITestDevice |
moduleIsPlayManaged
public boolean moduleIsPlayManaged (String modulePackageName)
แสดงผลเป็น "จริง" หากโมดูลได้รับการจัดการโดย Play
ตัวอย่างการข้ามการทดสอบตามโมดูลหลัก
@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 และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[null,null,["อัปเดตล่าสุด 2025-07-27 UTC"],[],[]]