Commit Graph

18 Commits

Author SHA1 Message Date
Lei Yu
63795b2f5c Log app versionCode in anomaly detection
Change-Id: Ie760a4156b14b739279aa398bd1d2b8485449e91
Fixes: 77919142
Test: RunSettingsRoboTests
2018-04-12 10:32:08 -07:00
Lei Yu
6c4c7ba0fe Add system app check for anomaly detection.
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
2018-04-11 18:02:50 -07:00
Lei Yu
fa447e698d Merge "Update field for ACTION_ANOMALY_TRIGGERED" into pi-dev 2018-04-10 17:39:08 +00:00
Lei Yu
c7b58b6997 Update field for ACTION_ANOMALY_TRIGGERED
Use new field FIELD_ANOMALY_TYPE

Bug: 75976625
Test: RunSettingsRoboTests
Change-Id: Ifb67c687d25e1e35afaadb05f2e9883e8dcf8049
2018-04-09 15:22:19 -07:00
Lei Yu
9553855af4 Add test for anomaly detection in P
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
2018-04-06 10:49:36 -07:00
Lei Yu
78e2cad8b1 Merge "Hide app if it shares uid with whitelisted app" into pi-dev 2018-04-06 17:19:19 +00:00
Lei Yu
f82d22afbb Hide app if it shares uid with whitelisted app
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
2018-04-05 15:13:07 -07:00
Lei Yu
695290b129 Update the anomaly type constants
Bug: 77323601
Test: Build
Change-Id: I0b6733edbfe12f494104f78be7087fa621191431
2018-04-05 11:13:50 -07:00
Lei Yu
d4482339d5 Update job ids in Settings
Use constant integers instead of ids

Bug: 77331929
Test: RunSettingsRoboTests
Change-Id: Ic6def54aaae4a9ba025161340f1cee210cb2e87f
2018-03-30 13:20:53 -07:00
Lei Yu
bb90c955df Get anomaly info from StringArrayList
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
2018-03-27 16:10:54 -07:00
Lei Yu
2246ea9e89 Add log for AnomalyDetectionJobService
When anomaly is detected, also log it in AnomalyDetectionJobService

Bug: 73888115
Test: RunSettingsRoboTests
Change-Id: I0a42f8935d9a83eb763dd1f9dedfb71301853104
2018-03-21 17:44:02 -07:00
Lei Yu
baf8a0cf9e Get anomalyType and autoRestriction from config
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
2018-03-20 17:50:44 -07:00
hughchen
18ce28ed33 Change BatteryUtils.isLegacyApp() to isPreOApp()
Bug: 73792442
Test: RunSettingsRoboTests
      make -j40 RunSettingsRoboTests
Change-Id: I770030a8f38ec6156aa2a40f4c88ac9e0673751d
2018-03-20 01:44:43 +00:00
Lei Yu
f4318f613d update the whitelist for anomaly detection
Add "allow-in-power-save-except-idle" to whitelist. Also ignore
all the system uids

Bug: 74241534
Test: RunSettingsRoboTests
Change-Id: I593e558168db339f6f38c7f78ab4fd63f99b16ab
2018-03-13 12:28:35 -07:00
jackqdyulei
10051afb96 Add whitelist for anomaly detection.
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
2018-03-07 13:20:36 -08:00
jackqdyulei
36249c6254 Update dabase manager to store the uid
Also update the AppInfo to store the uid

Bug: 74022362
Test: RunSettingsRoboTests
Change-Id: I373242a12e9dbf48be134f2e9be30831b09f91c9
2018-03-07 04:20:13 +00:00
jackqdyulei
457fb842eb Add special check for excessive bg anomaly
To check whether this app has battery usage more than x%

Bug: 72385333
Test: RunSettingsRoboTests
Change-Id: I87e6b01c866a053658f84ce3486120ae82963fd9
2018-02-23 10:12:05 -08:00
jackqdyulei
3ee28c810d Add auto restriction for excessive background
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
2018-02-23 10:11:34 -08:00