Merge changes I17d87bae,Ie975e591,I6880b9b9,Ic752c7f3 into sc-dev
* changes: Add a TEST_MAPPING (9/n) Fix insufficient synchronization (8/n) Fix a race in the callback (7/n) setExplicitHealthCheckEnabled() needs to set mSyncRequired (6/n)
This commit is contained in:
@@ -259,10 +259,7 @@ public class PackageWatchdog {
|
||||
mIsPackagesReady = true;
|
||||
mHealthCheckController.setCallbacks(packageName -> onHealthCheckPassed(packageName),
|
||||
packages -> onSupportedPackages(packages),
|
||||
() -> {
|
||||
syncRequestsAsync();
|
||||
mSyncRequired = true;
|
||||
});
|
||||
this::onSyncRequestNotified);
|
||||
setPropertyChangedListenerLocked();
|
||||
updateConfigs();
|
||||
registerConnectivityModuleHealthListener();
|
||||
@@ -537,6 +534,7 @@ public class PackageWatchdog {
|
||||
synchronized (mLock) {
|
||||
mIsHealthCheckEnabled = enabled;
|
||||
mHealthCheckController.setEnabled(enabled);
|
||||
mSyncRequired = true;
|
||||
// Prune to update internal state whenever health check is enabled/disabled
|
||||
syncState("health check state " + (enabled ? "enabled" : "disabled"));
|
||||
}
|
||||
@@ -788,6 +786,13 @@ public class PackageWatchdog {
|
||||
}
|
||||
}
|
||||
|
||||
private void onSyncRequestNotified() {
|
||||
synchronized (mLock) {
|
||||
mSyncRequired = true;
|
||||
syncRequestsAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@GuardedBy("mLock")
|
||||
private Set<String> getPackagesPendingHealthChecksLocked() {
|
||||
Set<String> packages = new ArraySet<>();
|
||||
|
||||
7
tests/PackageWatchdog/TEST_MAPPING
Normal file
7
tests/PackageWatchdog/TEST_MAPPING
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"presubmit": [
|
||||
{
|
||||
"name": "PackageWatchdogTest"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user