summaryrefslogtreecommitdiff
path: root/tests/BinaryTransparencyHostTest/src
AgeCommit message (Collapse)Author
2024-11-25Added uninstall event metric handling and unit tests. George Chan
Change-Id: Ibaead8e08cea509610f644779a3e09de6fc44634 Flag: android.app.background_install_control_callback_api Bug: 374120984 Test: atest
2023-08-16Switch placeholder app in test to another Victor Hsieh
I'm removing ApkVerityTestApp soon, so switch the placeholder app here to another (instead of maintaining our own copy) from frameworks/base/tests/FeatureSplit/. Bug: 277916185 Test: atest BinaryTransparencyHostTest Change-Id: Iac0a9bc52221f626fe0eeeadcfebc3ad96d356a3
2023-06-28Deduplicate test expectation data in a different way Victor Hsieh
The test collects expected APEX package names from listing /apex by a shell command. The shell command also tries to remove the noise (normally an APEX has two entires, see below). $ ls -d /apex/*/ /apex/com.android.adbd/ /apex/com.android.adbd@340815002/ ... /apex/com.google.mainline.primary.libs@340716000/ /apex/sharedlibs/ The test used to deduplicate by filtering out '@'. But apparently an (DLCA) APEX only has one entry with '@'. With this change, the shell command removes '@\d+' then deduplicate the strings. Bug: 288551133 Test: BinaryTransparencyHostTest#testCollectAllApexInfo Change-Id: I4bc3e8226dd7790aa276ac5dfad7371c60046384
2023-02-07Add annotations to BinaryTransparencyHostTest Victor Hsieh
@Presubmit: since it's now running there @LargeTest: the the test can easily run more than a MediumTest's budget Bug: 264296226 Test: atest BinaryTransparencyHostTest Change-Id: I0a77893baa18c9bfed1bbe65d91e7d66c5b444ba
2023-02-01Support measuring split Victor Hsieh
measurePackage is changed into measureApk, which would hint that the method deals with a file instead of a "package" in the package manager's term. collectAppInfo is added to measure an app package, which may include split. Test * Add a test that leverages debug.transparency.bg-install-apps of BICs. * Copy BaseInstallMultiple from another test in frameworks/base to support split install. Misc * Delete getApexInfo and corresponding unit tests, since it's now coverred through collectAllApexInfo in integration test. This also makes it easy for refactoring without having to keeping the Bundle works as the return type. Bug: 264296226 Test: atest BinaryTransparencyServiceTest BinaryTransparencyHostTest Change-Id: Iaa4118dfa8605acda313dbcc2466ae96a60b4721
2023-02-01Improve test efficiency and stablility Victor Hsieh
* Run uninstallRebootlessApex (which reboots the device, thus slow) only necessarily in test cases. * Use EasterEgg from the device, not a local build. Surprisingly this app is signed with the platform key, so a different build can have different key thus may fail to install. * Increase waiting time to 30 seconds. For some reason that scheduling may not happen very soon, even on real device. * Always cancel the pending job before starting a test. For example, this can cancel a job scheduled at boot, so that we can correctly verify that a package install actually triggers a job scheduling. * Add a simply check to uniqueness of expected APEX list. Bug: 265244016 Test: atest BinaryTransparencyServiceTest BinaryTransparencyHostTest Change-Id: I4b7bf232be2ee74b6c0129bc9938c680f1835619
2023-01-26Add tests to verify job scheduling on events Victor Hsieh
... of rebootless APEX and preload update installation. Changes made to the actual service: * DO_BINARY_MEASUREMENTS_JOB_ID is now a constant, like most of jobs in the framework. This makes it easy to use from the host. * Replace the local state of sScheduled with a query to JobScheduler, which is the source of truth. I've messed up the state during test and manual interaction, and this is supposed to make it more resilient. Bug: 265244016 Test: atest BinaryTransparencyHostTest Test: atest BinaryTransparencyServiceTest Change-Id: I17872bbded0b5c5c44e6fbd1c669f1eb00f3333e
2023-01-26Add tests for preload and APEX measurement Victor Hsieh
A new host-side test "BinaryTransparencyHostTest" is added to drive the actual test on device. The host can be used to set up the testing environment (e.g. update a preload, or later install MBA), then ask the helper app "BinaryTransparencyTestApp" to verify returned value of private APIs in the main service. Since the APIs are private (@hide, because we're not ready to make anything public yet), the (bundled) helper app needs to be compiled with `platform_apis: true`. Plus, since the service is not accessible to apps by sepolicy, the test has to run with SELinux disabled. An alternative is to add a userdebug_or_eng rule in sepolicy, but it's better to avoid adding rule for one specific test, and isolate the setup here (in AndroidTest.xml). The test is not yet added to TEST_MAPPING/presubmit. Once it runs successfully for a few runs in postsubmit, we should graduate it to presubmit. Test: atest BinaryTransparencyHostTest Test: atest BinaryTransparencyServiceTest Bug: 265244016 Change-Id: Ibd87f4cf6a2ae989ddfa8eaf9494cff5d34005ed