Fix FGS mode in test Corrects testBoundByForegroundFgs to use mFgsCheckConfiguration, aligning the test with its intended purpose of testing Foreground Service (FGS) scenarios. Removes the obsolete testBoundByForegroundOld test method (as thethe BAL codes changed to BLOCKED for this case) Flag: EXEMPT CVE_FIX Test: atest BackgroundActivityLaunchProcessorTest Bug: 508112183 Bug: 464526458 Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:e26dda735b99edd974444462ce5b333dbbd3aa6a Merged-In: Iab1fe3b66e73e057d4410dff93a44c13be5bfc76 Change-Id: Iab1fe3b66e73e057d4410dff93a44c13be5bfc76
diff --git a/services/tests/wmtests/src/com/android/server/wm/BackgroundLaunchProcessControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/BackgroundLaunchProcessControllerTests.java index 0b4f52f..0d13e2a 100644 --- a/services/tests/wmtests/src/com/android/server/wm/BackgroundLaunchProcessControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/BackgroundLaunchProcessControllerTests.java
@@ -24,7 +24,6 @@ import static com.android.server.wm.BackgroundActivityStartController.BAL_ALLOW_GRACE_PERIOD; import static com.android.server.wm.BackgroundActivityStartController.BAL_ALLOW_PERMISSION; import static com.android.server.wm.BackgroundActivityStartController.BAL_ALLOW_TOKEN; -import static com.android.server.wm.BackgroundActivityStartController.BAL_ALLOW_VISIBLE_WINDOW; import static com.android.server.wm.BackgroundActivityStartController.BAL_BLOCK; import static com.google.common.truth.Truth.assertThat; @@ -213,28 +212,13 @@ } @Test - @DisableFlags(Flags.FLAG_BAL_IMPROVED_METRICS) - public void testBoundByForegroundOld() { - mAppSwitchState = APP_SWITCH_ALLOW; - mController.addBoundClientUid(999, "visible.package", Context.BIND_ALLOW_ACTIVITY_STARTS); - mHasActiveVisibleWindow.add(999); - BalVerdict balVerdict = mController.areBackgroundActivityStartsAllowed( - mPid, mUid, mPackageName, - mAppSwitchState, mBalCheckConfiguration, mInPinnedWindoMode, - mHasActivityInVisibleTask, mHasBackgroundActivityStartPrivileges, - mLastStopAppSwitchesTime, mLastActivityLaunchTime, - mLastActivityFinishTime); - assertThat(balVerdict.getCode()).isEqualTo(BAL_ALLOW_VISIBLE_WINDOW); - } - - @Test public void testBoundByForegroundFgs() { mAppSwitchState = APP_SWITCH_ALLOW; mController.addBoundClientUid(999, "visible.package", Context.BIND_ALLOW_ACTIVITY_STARTS); mHasActiveVisibleWindow.add(999); BalVerdict balVerdict = mController.areBackgroundActivityStartsAllowed( mPid, mUid, mPackageName, - mAppSwitchState, mBalCheckConfiguration, mInPinnedWindoMode, + mAppSwitchState, mFgsCheckConfiguration, mInPinnedWindoMode, mHasActivityInVisibleTask, mHasBackgroundActivityStartPrivileges, mLastStopAppSwitchesTime, mLastActivityLaunchTime, mLastActivityFinishTime);