In this CL, don't blame system app in anomaly detection and also
add log for it.
Following CL will update it to also check whether this system app
has launch entry.
Bug: 77477987
Test: RunSettingsRoboTests
Change-Id: I97490b32bc42ec2f8e03ec2d82f7c8bf89f9c66f
Lot of tests have been added already, this CL adds the missing tests
after robolectric upgrade.
Also add UID_NULL check in AnomalyDetectionJobService. It is almost
impossible to happen however we better catch it.
Bug: 73172999
Test: RunSettingsRoboTests
Change-Id: I950537efb166b0900393df1321ca64151b43e906
Statsd blame app based on uid, which may mapping to multiple packages.
If there is one app in whitelist, then we shouldn't blame other apps
in anomaly detection.
Change-Id: Ib546e207eb113cef9ef5fecb1138e61558e9cf55
Fixes: 77560853
Test: RunSettingsRoboTests
Statsd populates the anomaly info in StringArrayList, not StringArray. So
in settings we should use the correct API to get the data.
Bug: 77141809
Test: RunSettingsRoboTests
Change-Id: I56fc096106b5c040422fd7f5bb8cb4be7fe71d9d
When anomaly is detected, also log it in AnomalyDetectionJobService
Bug: 73888115
Test: RunSettingsRoboTests
Change-Id: I0a42f8935d9a83eb763dd1f9dedfb71301853104
Now the westworld config provides COOKIES to store private info
for each alert(anomaly). So we could use it to store:
1. AnomalyType: what is the type of anomaly
2. AutoRestriction: whether to auto restrict this anomaly
Bug: 74567790
Test: RunSettingsRoboTests
Change-Id: I15f5e225a4cb1f2da3fe109e56e5222816d179cc
Add "allow-in-power-save-except-idle" to whitelist. Also ignore
all the system uids
Bug: 74241534
Test: RunSettingsRoboTests
Change-Id: I593e558168db339f6f38c7f78ab4fd63f99b16ab
Even though we can add whitelist in config, we still need to have a
on device whitelist to reduce the size of config.
Use doze whitelist here because we already used it to detect whether
we can restrict the app in battery detail page.
Bug: 74241534
Test: RunSettingsRoboTests
Change-Id: I35b6f3eba9fbc8ae51bb02cd9d5416e4360c388e
If it is excessive bg anomaly and auto restriction is on, then
restrict the anomaly in receiver and store it in database.
Also in this cl we move the anomaly logic to a JobService, so all
works are done in a background thread and won't interfere the main
thread.
Bug: 72385333
Test: RunSettingsRoboTests &&
Will add auto restriction test once robo framework is updated(b/73172999)
Change-Id: Id0ec5fb449ce26bf19a292bcbe63838d621cfd8e