9 Commits

Author SHA1 Message Date
Zimuzo
ef65fb8424 Fail package if explicit health check does not pass
As part of extending PackageWatchdog with explicit health check support
in Ib4322c327bcb00ca9a3fbdc83579e7b5f2fd633b. Trigger the observers #execute
method if a package never passed explicit health check on expiry.

Bug: 120598832
Test: atest PackageWatchdogTest
Change-Id: I8e916a6ca115d3883fe29f66456da36cd0ed09fb
2019-03-06 14:05:09 +00:00
Zimuzo Ezeozue
101ac58981 Merge "Extend PackageWatchdog with explicit health checks" 2019-03-06 10:25:22 +00:00
Zimuzo
9284e74585 Extend PackageWatchdog with explicit health checks
Allow PackageWatchdog to monitor packages with explicit health checks
enabled. In this case, at the end of a monitoring duration if a
passed-health-check callback is not triggered, the package would be
regarded as failed (in a later cl) and the observer is notified.
If monitoring without explicit health checks, the behavior is the same
as before, packages expire silently.

TODO: Implement the package failure trigger on expiry with failed
explict checks and enable added tests

Removed username from TODO comments

Bug: 120598832
Test: atest PackageWatchdogTest
Change-Id: Ib4322c327bcb00ca9a3fbdc83579e7b5f2fd633b
2019-03-06 05:41:42 +00:00
Brett Chabot
502ec7ae4b Migrate remainder of frameworks/base to androidx.test
See go/jetpack-test-android-migration

Exempt-From-Owner-Approval: automated package name refactoring

Test: m  m -j BroadcastRadioTests KeystoreTests mediaframeworktest ActivityManagerPerfTests AppLaunch AppLaunchWear BackgroundDexOptServiceIntegrationTests AppCompatibilityTest DynamicCodeLoggerIntegrationTests FlickerLibTest InternalTests PackageWatchdogTest RcsTests RollbackTestAppAv1 RollbackTestAppAv2 RollbackTestAppACrashingV2 RollbackTestAppBv1 RollbackTestAppBv2 RollbackTestAppASplitV1 RollbackTestAppASplitV2 RollbackTest ServiceCrashTest UsageStatsPerfTests UsbTests WindowAnimationJank
Change-Id: I32fe3297656eec6060da6c7e24582bcd5315fb16
2019-03-02 00:35:17 +00:00
Zimuzo
71d931e9c8 Refactor PackageWatchdog to use VersionedPackage
We now pass a VersionedPackage argument instead of passing separate
method arguments for packageName and versionCode.

Test: atest PackageWatchdogtest
Bug: 120598832
Change-Id: I8dd7e6d1e144251830108c58f4a752c411d7295b
2019-02-01 13:43:09 +00:00
Zimuzo
972e1cdb2e Notify PackageHealthObservers of the package versionCode on package failure
PackageHealthObservers may need to verify that the package failure
notification they receive matches the expected package version code.
We now pass the version code along with the package name when notifying
observers.

Test: atest com.android.server.PackageWatchdogTest
Bug: 120598832
Change-Id: I272965d08a07240f3bde358039b52187ff2dd3cf
2019-01-29 22:43:04 +00:00
Zimuzo
e5009cd82c Add PackageHealthObserverImpact
When a package fails health check, observers will report the impact of their
action on the user. Only the observer with the least user impact will be
allowed to take action.

Bug: 120598832
Test: atest PackageWatchdogTest
Change-Id: I15f358cd599431e1d7ea211aea5b1391f4aa33ab
2019-01-28 08:24:15 +00:00
Allen Hair
f134eb793b Depend on services.core instead of services to fix coverage build.
Bug: 122839224
Test: EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true mma
Change-Id: Idfd55f951de60905dc68ada087f23dd670a84ec0
2019-01-14 17:49:51 -08:00
Zimuzo
3eee43845a Fix PackageWatchdog and add PackageWatchdogTest
Fixes:
1. Remove registered observer when removed from persisted file
2. Only call external observers after threshold is exceeded
3. Handle edge case where we reschedule package cleanup and elapsed time
is longer than scheduled duration
4. Modify code to allow easier testing

Bug: 120598832
Test: atest PackageWatchdogTest

Change-Id: I92181136fb5994a4d8ebe976be3138f210e853a5
2019-01-11 14:45:28 +00:00