Merge "Add missing parameters in BackgroundRestrictionTest" into tm-dev

This commit is contained in:
Jing Ji
2022-03-19 14:38:20 +00:00
committed by Android (Google) Code Review

View File

@@ -1899,7 +1899,7 @@ public final class BackgroundRestrictionTest {
bgBatteryExemptionTypes.set(STATE_TYPE_FGS_WITH_NOTIFICATION); bgBatteryExemptionTypes.set(STATE_TYPE_FGS_WITH_NOTIFICATION);
// Start over. // Start over.
resetBgRestrictionController(); resetBgRestrictionController();
setUidBatteryConsumptions(stats, uids, zeros, zeros, zeros); setUidBatteryConsumptions(stats, uids, zeros, zeros, zeros, zeros);
mAppBatteryPolicy.reset(); mAppBatteryPolicy.reset();
// Run with a FGS with notification posted/removed immediately, we should // Run with a FGS with notification posted/removed immediately, we should
@@ -1908,16 +1908,16 @@ public final class BackgroundRestrictionTest {
FOREGROUND_SERVICE_TYPE_NONE, 0, true, true, FOREGROUND_SERVICE_TYPE_NONE, 0, true, true,
null, null, null, listener, stats, uids, null, null, null, listener, stats, uids,
new double[]{restrictBucketThresholdMah + 1, 0}, new double[]{restrictBucketThresholdMah + 1, 0},
new double[]{0, restrictBucketThresholdMah - 1}, zeros, new double[]{0, restrictBucketThresholdMah - 1}, zeros, zeros,
false, RESTRICTION_LEVEL_RESTRICTED_BUCKET, timeout, true, false, RESTRICTION_LEVEL_RESTRICTED_BUCKET, timeout, true,
null, windowMs, null, null, null); null, windowMs, null, null, null, null);
// Run with a service with notification for extended time. We should be back to normal. // Run with a service with notification for extended time. We should be back to normal.
runTestBgCurrentDrainExemptionOnce(testPkgName1, testUid1, testPid1, runTestBgCurrentDrainExemptionOnce(testPkgName1, testUid1, testPid1,
FOREGROUND_SERVICE_TYPE_NONE, bgMediaPlaybackMinDuration * 2, false, FOREGROUND_SERVICE_TYPE_NONE, bgMediaPlaybackMinDuration * 2, false,
true, null, null, null, listener, stats, uids, true, null, null, null, listener, stats, uids,
new double[]{restrictBucketThresholdMah + 1, 0}, new double[]{restrictBucketThresholdMah + 1, 0},
new double[]{0, restrictBucketThresholdMah - 1}, zeros, new double[]{0, restrictBucketThresholdMah - 1}, zeros, zeros,
true, RESTRICTION_LEVEL_ADAPTIVE_BUCKET, timeout, false, true, RESTRICTION_LEVEL_ADAPTIVE_BUCKET, timeout, false,
() -> { () -> {
// A user interaction will bring it back to normal. // A user interaction will bring it back to normal.
@@ -1934,7 +1934,7 @@ public final class BackgroundRestrictionTest {
eq(REASON_SUB_FORCED_SYSTEM_FLAG_ABUSE), eq(REASON_SUB_FORCED_SYSTEM_FLAG_ABUSE),
eq(REASON_MAIN_USAGE), eq(REASON_MAIN_USAGE),
eq(REASON_SUB_USAGE_USER_INTERACTION)); eq(REASON_SUB_USAGE_USER_INTERACTION));
}, windowMs, null, null, null); }, windowMs, null, null, null, null);
// Set the policy to exempt all. // Set the policy to exempt all.
bgBatteryExemptionTypes.set(STATE_TYPE_MEDIA_SESSION | STATE_TYPE_FGS_MEDIA_PLAYBACK bgBatteryExemptionTypes.set(STATE_TYPE_MEDIA_SESSION | STATE_TYPE_FGS_MEDIA_PLAYBACK