Merge "Fix taking actions without considering pending health checks" into qt-dev
am: 9192a430af
Change-Id: I069620eb5f96c8d63ade4cffc945612607282173
This commit is contained in:
@@ -529,8 +529,7 @@ public class PackageWatchdog {
|
||||
while (pit.hasNext()) {
|
||||
MonitoredPackage monitoredPackage = pit.next();
|
||||
String packageName = monitoredPackage.getName();
|
||||
if (monitoredPackage.getHealthCheckStateLocked()
|
||||
!= MonitoredPackage.STATE_PASSED) {
|
||||
if (monitoredPackage.isPendingHealthChecksLocked()) {
|
||||
packages.add(packageName);
|
||||
}
|
||||
}
|
||||
@@ -1093,7 +1092,10 @@ public class PackageWatchdog {
|
||||
*/
|
||||
@GuardedBy("mLock")
|
||||
public long getShortestScheduleDurationMsLocked() {
|
||||
return Math.min(toPositive(mDurationMs), toPositive(mHealthCheckDurationMs));
|
||||
// Consider health check duration only if #isPendingHealthChecksLocked is true
|
||||
return Math.min(toPositive(mDurationMs),
|
||||
isPendingHealthChecksLocked()
|
||||
? toPositive(mHealthCheckDurationMs) : Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1105,6 +1107,15 @@ public class PackageWatchdog {
|
||||
return mDurationMs <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the package, {@link #getName} is expecting health check results
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
@GuardedBy("mLock")
|
||||
public boolean isPendingHealthChecksLocked() {
|
||||
return mHealthCheckState == STATE_ACTIVE || mHealthCheckState == STATE_INACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the health check state based on {@link #mHasPassedHealthCheck}
|
||||
* and {@link #mHealthCheckDurationMs}.
|
||||
|
||||
Reference in New Issue
Block a user