Minor refactoring for instrumenting with background activity
starts permission

Bug: 110956953
Test: atest WmTests:ActivityStarterTests
Change-Id: I144542ffb6a17364efc5d64e8fc516b4af7465ad
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index 6161f7d..5dccaf1 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -1172,9 +1172,9 @@
 
     void setActiveInstrumentation(ActiveInstrumentation instr) {
         mInstr = instr;
-        mWindowProcessController.setInstrumenting(instr != null);
-        mWindowProcessController.setInstrumentingWithBackgroundActivityStartPrivileges(instr != null
-                && instr.mHasBackgroundActivityStartsPermission);
+        boolean isInstrumenting = instr != null;
+        mWindowProcessController.setInstrumenting(isInstrumenting,
+                isInstrumenting && instr.mHasBackgroundActivityStartsPermission);
     }
 
     ActiveInstrumentation getActiveInstrumentation() {
diff --git a/services/core/java/com/android/server/wm/WindowProcessController.java b/services/core/java/com/android/server/wm/WindowProcessController.java
index 8da39b6..37e2200 100644
--- a/services/core/java/com/android/server/wm/WindowProcessController.java
+++ b/services/core/java/com/android/server/wm/WindowProcessController.java
@@ -364,8 +364,10 @@
         return mAllowBackgroundActivityStarts;
     }
 
-    public void setInstrumenting(boolean instrumenting) {
+    public void setInstrumenting(boolean instrumenting,
+            boolean hasBackgroundActivityStartPrivileges) {
         mInstrumenting = instrumenting;
+        mInstrumentingWithBackgroundActivityStartPrivileges = hasBackgroundActivityStartPrivileges;
     }
 
     boolean isInstrumenting() {
@@ -373,15 +375,6 @@
     }
 
     /**
-     * {@see isInstrumentingWithBackgroundActivityStartPrivileges}
-     */
-    public void setInstrumentingWithBackgroundActivityStartPrivileges(
-            boolean instrumentingWithBackgroundActivityStartPrivileges) {
-        mInstrumentingWithBackgroundActivityStartPrivileges =
-                instrumentingWithBackgroundActivityStartPrivileges;
-    }
-
-    /**
      * @return true if the instrumentation was started by a holder of
      * START_ACTIVITIES_FROM_BACKGROUND permission
      */