Renamed a few methods in ActivityRecord (42/n).

This is in preparation for having the ActivityRecord class
extend AppWindowToken where name distinction will be important.
There is no functional change in this CL.

ActivityRecord.realActivity -> mActivityComponent
ActivityRecord.userId -> mUserId
ActivityRecord.getTask() -> getTaskRecord()
ActivityRecord.getStack() -> getActivityStack()
ActivityRecord.service -> mAtmService
WindowContainer.mService -> mWmService

Bug: 80414790
Test: Existing tests pass.
Change-Id: Ie5788db7f2e823c7d5b64c7ce6eaade1c19c4dcd
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index c0e9836..871ceaf 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -100,6 +100,7 @@
 import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
 import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
 import static com.android.server.wm.WindowManagerService.CUSTOM_SCREEN_ROTATION;
+import static com.android.server.wm.WindowManagerService.H.REPORT_HARD_KEYBOARD_STATUS_CHANGE;
 import static com.android.server.wm.WindowManagerService.H.REPORT_LOSING_FOCUS;
 import static com.android.server.wm.WindowManagerService.H.SEND_NEW_CONFIGURATION;
 import static com.android.server.wm.WindowManagerService.H.UPDATE_DOCKED_STACK_DIVIDER;
@@ -208,21 +209,21 @@
 
     /** The containers below are the only child containers the display can have. */
     // Contains all window containers that are related to apps (Activities)
-    private final TaskStackContainers mTaskStackContainers = new TaskStackContainers(mService);
+    private final TaskStackContainers mTaskStackContainers = new TaskStackContainers(mWmService);
     // Contains all non-app window containers that should be displayed above the app containers
     // (e.g. Status bar)
     private final AboveAppWindowContainers mAboveAppWindowsContainers =
-            new AboveAppWindowContainers("mAboveAppWindowsContainers", mService);
+            new AboveAppWindowContainers("mAboveAppWindowsContainers", mWmService);
     // Contains all non-app window containers that should be displayed below the app containers
     // (e.g. Wallpaper).
     private final NonAppWindowContainers mBelowAppWindowsContainers =
-            new NonAppWindowContainers("mBelowAppWindowsContainers", mService);
+            new NonAppWindowContainers("mBelowAppWindowsContainers", mWmService);
     // Contains all IME window containers. Note that the z-ordering of the IME windows will depend
     // on the IME target. We mainly have this container grouping so we can keep track of all the IME
     // window containers together and move them in-sync if/when needed. We use a subclass of
     // WindowContainer which is omitted from screen magnification, as the IME is never magnified.
     private final NonMagnifiableWindowContainers mImeWindowsContainers =
-            new NonMagnifiableWindowContainers("mImeWindowsContainers", mService);
+            new NonMagnifiableWindowContainers("mImeWindowsContainers", mWmService);
 
     private WindowState mTmpWindow;
     private WindowState mTmpWindow2;
@@ -525,7 +526,7 @@
                 if (w.performShowLocked()) {
                     pendingLayoutChanges |= FINISH_LAYOUT_REDO_ANIM;
                     if (DEBUG_LAYOUT_REPEATS) {
-                        mService.mWindowPlacerLocked.debugLayoutRepeats(
+                        mWmService.mWindowPlacerLocked.debugLayoutRepeats(
                                 "updateWindowsAndWallpaperLocked 5", pendingLayoutChanges);
                     }
                 }
@@ -556,7 +557,7 @@
 
     private final Consumer<WindowState> mScheduleToastTimeout = w -> {
         final int lostFocusUid = mTmpWindow.mOwnerUid;
-        final Handler handler = mService.mH;
+        final Handler handler = mWmService.mH;
         if (w.mAttrs.type == TYPE_TOAST && w.mOwnerUid == lostFocusUid) {
             if (!handler.hasMessages(WINDOW_HIDE_TIMEOUT, w)) {
                 handler.sendMessageDelayed(handler.obtainMessage(WINDOW_HIDE_TIMEOUT, w),
@@ -618,7 +619,7 @@
     private final Consumer<WindowState> mPerformLayout = w -> {
         // Don't do layout of a window if it is not visible, or soon won't be visible, to avoid
         // wasting time and funky changes while a window is animating away.
-        final boolean gone = (mTmpWindow != null && mService.mPolicy.canBeHiddenByKeyguardLw(w))
+        final boolean gone = (mTmpWindow != null && mWmService.mPolicy.canBeHiddenByKeyguardLw(w))
                 || w.isGoneForLayoutLw();
 
         if (DEBUG_LAYOUT && !w.mLayoutAttached) {
@@ -686,7 +687,7 @@
             // If this view is GONE, then skip it -- keep the current frame, and let the caller
             // know so they can ignore it if they want.  (We do the normal layout for INVISIBLE
             // windows, since that means "perform layout as normal, just don't display").
-            if (mTmpWindow != null && mService.mPolicy.canBeHiddenByKeyguardLw(w)) {
+            if (mTmpWindow != null && mWmService.mPolicy.canBeHiddenByKeyguardLw(w)) {
                 return;
             }
             if ((w.mViewVisibility != GONE && w.mRelayoutCalled) || !w.mHaveFrame
@@ -721,10 +722,10 @@
                     mInputMethodTarget);
 
     private final Consumer<WindowState> mApplySurfaceChangesTransaction = w -> {
-        final WindowSurfacePlacer surfacePlacer = mService.mWindowPlacerLocked;
+        final WindowSurfacePlacer surfacePlacer = mWmService.mWindowPlacerLocked;
         final boolean obscuredChanged = w.mObscured !=
                 mTmpApplySurfaceChangesTransactionState.obscured;
-        final RootWindowContainer root = mService.mRoot;
+        final RootWindowContainer root = mWmService.mRoot;
 
         // Update effect.
         w.mObscured = mTmpApplySurfaceChangesTransactionState.obscured;
@@ -815,7 +816,7 @@
         }
 
         if (!mLosingFocus.isEmpty() && w.isFocused() && w.isDisplayedLw()) {
-            mService.mH.obtainMessage(REPORT_LOSING_FOCUS, this).sendToTarget();
+            mWmService.mH.obtainMessage(REPORT_LOSING_FOCUS, this).sendToTarget();
         }
 
         w.updateResizingWindowIfNeeded();
@@ -840,7 +841,7 @@
 
         mDisplay = display;
         mDisplayId = display.getDisplayId();
-        mWallpaperController = new WallpaperController(mService, this);
+        mWallpaperController = new WallpaperController(mWmService, this);
         display.getDisplayInfo(mDisplayInfo);
         display.getMetrics(mDisplayMetrics);
         isDefaultDisplay = mDisplayId == DEFAULT_DISPLAY;
@@ -857,8 +858,8 @@
         mBoundsAnimationController = new BoundsAnimationController(service.mContext,
                 mAppTransition, SurfaceAnimationThread.getHandler(), animationHandler);
 
-        if (mService.mInputManager != null) {
-            final InputChannel inputChannel = mService.mInputManager.monitorInput("Display "
+        if (mWmService.mInputManager != null) {
+            final InputChannel inputChannel = mWmService.mInputManager.monitorInput("Display "
                     + mDisplayId, mDisplayId);
             mPointerEventDispatcher = inputChannel != null
                     ? new PointerEventDispatcher(inputChannel) : null;
@@ -870,18 +871,18 @@
         if (isDefaultDisplay) {
             // The policy may be invoked right after here, so it requires the necessary default
             // fields of this display content.
-            mService.mPolicy.setDefaultDisplay(this);
+            mWmService.mPolicy.setDefaultDisplay(this);
         }
-        if (mService.mDisplayReady) {
+        if (mWmService.mDisplayReady) {
             mDisplayPolicy.onConfigurationChanged();
         }
-        if (mService.mSystemReady) {
+        if (mWmService.mSystemReady) {
             mDisplayPolicy.systemReady();
         }
         mDividerControllerLocked = new DockedStackDividerController(service, this);
         mPinnedStackControllerLocked = new PinnedStackController(service, this);
 
-        final SurfaceControl.Builder b = mService.makeSurfaceBuilder(mSession).setOpaque(true);
+        final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(mSession).setOpaque(true);
         mWindowingLayer = b.setName("Display Root").build();
         mOverlayLayer = b.setName("Display Overlays").build();
 
@@ -900,20 +901,20 @@
         super.addChild(mImeWindowsContainers, null);
 
         // Add itself as a child to the root container.
-        mService.mRoot.addChild(this, null);
+        mWmService.mRoot.addChild(this, null);
 
         // TODO(b/62541591): evaluate whether this is the best spot to declare the
         // {@link DisplayContent} ready for use.
         mDisplayReady = true;
 
-        mService.mAnimator.addDisplayLocked(mDisplayId);
+        mWmService.mAnimator.addDisplayLocked(mDisplayId);
         mInputMonitor = new InputMonitor(service, mDisplayId);
         mInsetsStateController = new InsetsStateController(this);
     }
 
     boolean isReady() {
         // The display is ready when the system and the individual display are both ready.
-        return mService.mDisplayReady && mDisplayReady;
+        return mWmService.mDisplayReady && mDisplayReady;
     }
 
     int getDisplayId() {
@@ -933,7 +934,7 @@
     }
 
     private void addWindowToken(IBinder binder, WindowToken token) {
-        final DisplayContent dc = mService.mRoot.getWindowTokenDisplay(token);
+        final DisplayContent dc = mWmService.mRoot.getWindowTokenDisplay(token);
         if (dc != null) {
             // We currently don't support adding a window token to the display if the display
             // already has the binder mapped to another token. If there is a use case for supporting
@@ -1139,7 +1140,7 @@
 
     /** Notify the configuration change of this display. */
     void sendNewConfiguration() {
-        mService.mH.obtainMessage(SEND_NEW_CONFIGURATION, this).sendToTarget();
+        mWmService.mH.obtainMessage(SEND_NEW_CONFIGURATION, this).sendToTarget();
     }
 
     /**
@@ -1214,7 +1215,7 @@
             }
 
             screenRotationAnimation =
-                    mService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
+                    mWmService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
             if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()) {
                 // Rotation updates cannot be performed while the previous rotation change
                 // animation is still in progress.  Skip this update.  We will try updating
@@ -1222,7 +1223,7 @@
                 if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Deferring rotation, animation in progress.");
                 return false;
             }
-            if (mService.mDisplayFrozen) {
+            if (mWmService.mDisplayFrozen) {
                 // Even if the screen rotation animation has finished (e.g. isAnimating
                 // returns false), there is still some time where we haven't yet unfrozen
                 // the display. We also need to abort rotation here.
@@ -1232,7 +1233,7 @@
             }
         }
 
-        if (!mService.mDisplayEnabled) {
+        if (!mWmService.mDisplayEnabled) {
             // No point choosing a rotation if the display is not enabled.
             if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Deferring rotation, display is not enabled.");
             return false;
@@ -1263,8 +1264,8 @@
             if (hasPinnedStack()) {
                 mayRotateSeamlessly = false;
             }
-            for (int i = 0; i < mService.mSessions.size(); i++) {
-                if (mService.mSessions.valueAt(i).hasAlertWindowSurfaces()) {
+            for (int i = 0; i < mWmService.mSessions.size(); i++) {
+                if (mWmService.mSessions.valueAt(i).hasAlertWindowSurfaces()) {
                     mayRotateSeamlessly = false;
                     break;
                 }
@@ -1302,8 +1303,8 @@
         mRotation = rotation;
         mAltOrientation = altOrientation;
 
-        mService.mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_ACTIVE;
-        mService.mH.sendNewMessageDelayed(WindowManagerService.H.WINDOW_FREEZE_TIMEOUT,
+        mWmService.mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_ACTIVE;
+        mWmService.mH.sendNewMessageDelayed(WindowManagerService.H.WINDOW_FREEZE_TIMEOUT,
                 this, WINDOW_FREEZE_TIMEOUT_DURATION);
 
         setLayoutNeeded();
@@ -1311,14 +1312,14 @@
         mDisplayPolicy.selectRotationAnimationLw(anim);
 
         if (!rotateSeamlessly) {
-            mService.startFreezingDisplayLocked(anim[0], anim[1], this);
+            mWmService.startFreezingDisplayLocked(anim[0], anim[1], this);
             // startFreezingDisplayLocked can reset the ScreenRotationAnimation.
         } else {
             // The screen rotation animation uses a screenshot to freeze the screen
             // while windows resize underneath.
             // When we are rotating seamlessly, we allow the elements to transition
             // to their rotated state independently and without a freeze required.
-            mService.startSeamlessRotation();
+            mWmService.startSeamlessRotation();
         }
 
         return true;
@@ -1333,9 +1334,9 @@
      */
     void applyRotationLocked(final int oldRotation, final int rotation) {
         mDisplayRotation.setRotation(rotation);
-        final boolean rotateSeamlessly = mService.isRotatingSeamlessly();
+        final boolean rotateSeamlessly = mWmService.isRotatingSeamlessly();
         ScreenRotationAnimation screenRotationAnimation = rotateSeamlessly
-                ? null : mService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
+                ? null : mWmService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
         // We need to update our screen size information to match the new rotation. If the rotation
         // has actually changed then this method will return true and, according to the comment at
         // the top of the method, the caller is obligated to call computeNewConfigurationLocked().
@@ -1348,9 +1349,9 @@
         if (CUSTOM_SCREEN_ROTATION && screenRotationAnimation != null
                 && screenRotationAnimation.hasScreenshot()) {
             if (screenRotationAnimation.setRotation(getPendingTransaction(), rotation,
-                    MAX_ANIMATION_DURATION, mService.getTransitionAnimationScaleLocked(),
+                    MAX_ANIMATION_DURATION, mWmService.getTransitionAnimationScaleLocked(),
                     mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight)) {
-                mService.scheduleAnimationLocked();
+                mWmService.scheduleAnimationLocked();
             }
         }
 
@@ -1359,27 +1360,27 @@
                     rotateSeamlessly);
         }, true /* traverseTopToBottom */);
 
-        mService.mDisplayManagerInternal.performTraversal(getPendingTransaction());
+        mWmService.mDisplayManagerInternal.performTraversal(getPendingTransaction());
         scheduleAnimation();
 
         forAllWindows(w -> {
             if (w.mHasSurface && !rotateSeamlessly) {
                 if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Set mOrientationChanging of " + w);
                 w.setOrientationChanging(true);
-                mService.mRoot.mOrientationChangeComplete = false;
+                mWmService.mRoot.mOrientationChangeComplete = false;
                 w.mLastFreezeDuration = 0;
             }
             w.mReportOrientationChanged = true;
         }, true /* traverseTopToBottom */);
 
         if (rotateSeamlessly) {
-            mService.mH.sendNewMessageDelayed(WindowManagerService.H.SEAMLESS_ROTATION_TIMEOUT,
+            mWmService.mH.sendNewMessageDelayed(WindowManagerService.H.SEAMLESS_ROTATION_TIMEOUT,
                     this, SEAMLESS_ROTATION_TIMEOUT_DURATION);
         }
 
-        for (int i = mService.mRotationWatchers.size() - 1; i >= 0; i--) {
+        for (int i = mWmService.mRotationWatchers.size() - 1; i >= 0; i--) {
             final WindowManagerService.RotationWatcher rotationWatcher
-                    = mService.mRotationWatchers.get(i);
+                    = mWmService.mRotationWatchers.get(i);
             if (rotationWatcher.mDisplayId == mDisplayId) {
                 try {
                     rotationWatcher.mWatcher.onRotationChanged(rotation);
@@ -1392,9 +1393,9 @@
         // TODO (multi-display): Magnification is supported only for the default display.
         // Announce rotation only if we will not animate as we already have the
         // windows in final state. Otherwise, we make this call at the rotation end.
-        if (screenRotationAnimation == null && mService.mAccessibilityController != null
+        if (screenRotationAnimation == null && mWmService.mAccessibilityController != null
                 && isDefaultDisplay) {
-            mService.mAccessibilityController.onRotationChangedLocked(this);
+            mWmService.mAccessibilityController.onRotationChangedLocked(this);
         }
     }
 
@@ -1428,9 +1429,9 @@
                 Slog.d(TAG,
                         "Registering PointerEventListener for DisplayId: " + mDisplayId);
             }
-            mTapDetector = new TaskTapPointerEventListener(mService, this);
+            mTapDetector = new TaskTapPointerEventListener(mWmService, this);
             registerPointerEventListener(mTapDetector);
-            registerPointerEventListener(mService.mMousePositionTracker);
+            registerPointerEventListener(mWmService.mMousePositionTracker);
         }
     }
 
@@ -1495,7 +1496,7 @@
         // because we don't want letter-/pillar-boxing during resize.
         final DisplayInfo overrideDisplayInfo = mShouldOverrideDisplayConfiguration
                 ? mDisplayInfo : null;
-        mService.mDisplayManagerInternal.setDisplayInfoOverrideFromWindowManager(mDisplayId,
+        mWmService.mDisplayManagerInternal.setDisplayInfoOverrideFromWindowManager(mDisplayId,
                 overrideDisplayInfo);
 
         mBaseDisplayRect.set(0, 0, dw, dh);
@@ -1581,10 +1582,10 @@
         config.densityDpi = displayInfo.logicalDensityDpi;
 
         config.colorMode =
-                ((displayInfo.isHdr() && mService.hasHdrSupport())
+                ((displayInfo.isHdr() && mWmService.hasHdrSupport())
                         ? Configuration.COLOR_MODE_HDR_YES
                         : Configuration.COLOR_MODE_HDR_NO)
-                        | (displayInfo.isWideColorGamut() && mService.hasWideColorGamutSupport()
+                        | (displayInfo.isWideColorGamut() && mWmService.hasWideColorGamutSupport()
                         ? Configuration.COLOR_MODE_WIDE_COLOR_GAMUT_YES
                         : Configuration.COLOR_MODE_WIDE_COLOR_GAMUT_NO);
 
@@ -1596,7 +1597,7 @@
 
         int keyboardPresence = 0;
         int navigationPresence = 0;
-        final InputDevice[] devices = mService.mInputManager.getInputDevices();
+        final InputDevice[] devices = mWmService.mInputManager.getInputDevices();
         final int len = devices != null ? devices.length : 0;
         for (int i = 0; i < len; i++) {
             InputDevice device = devices[i];
@@ -1607,7 +1608,7 @@
                         WindowManagerPolicy.PRESENCE_INTERNAL;
 
                 // TODO(multi-display): Configure on per-display basis.
-                if (mService.mIsTouchDevice) {
+                if (mWmService.mIsTouchDevice) {
                     if ((sources & InputDevice.SOURCE_TOUCHSCREEN) ==
                             InputDevice.SOURCE_TOUCHSCREEN) {
                         config.touchscreen = Configuration.TOUCHSCREEN_FINGER;
@@ -1632,7 +1633,7 @@
             }
         }
 
-        if (config.navigation == Configuration.NAVIGATION_NONAV && mService.mHasPermanentDpad) {
+        if (config.navigation == Configuration.NAVIGATION_NONAV && mWmService.mHasPermanentDpad) {
             config.navigation = Configuration.NAVIGATION_DPAD;
             navigationPresence |= WindowManagerPolicy.PRESENCE_INTERNAL;
         }
@@ -1640,10 +1641,10 @@
         // Determine whether a hard keyboard is available and enabled.
         // TODO(multi-display): Should the hardware keyboard be tied to a display or to a device?
         boolean hardKeyboardAvailable = config.keyboard != Configuration.KEYBOARD_NOKEYS;
-        if (hardKeyboardAvailable != mService.mHardKeyboardAvailable) {
-            mService.mHardKeyboardAvailable = hardKeyboardAvailable;
-            mService.mH.removeMessages(WindowManagerService.H.REPORT_HARD_KEYBOARD_STATUS_CHANGE);
-            mService.mH.sendEmptyMessage(WindowManagerService.H.REPORT_HARD_KEYBOARD_STATUS_CHANGE);
+        if (hardKeyboardAvailable != mWmService.mHardKeyboardAvailable) {
+            mWmService.mHardKeyboardAvailable = hardKeyboardAvailable;
+            mWmService.mH.removeMessages(REPORT_HARD_KEYBOARD_STATUS_CHANGE);
+            mWmService.mH.sendEmptyMessage(REPORT_HARD_KEYBOARD_STATUS_CHANGE);
         }
 
         mDisplayPolicy.updateConfigurationDependentBehaviors();
@@ -1652,7 +1653,7 @@
         config.keyboardHidden = Configuration.KEYBOARDHIDDEN_NO;
         config.hardKeyboardHidden = Configuration.HARDKEYBOARDHIDDEN_NO;
         config.navigationHidden = Configuration.NAVIGATIONHIDDEN_NO;
-        mService.mPolicy.adjustConfigurationLw(config, keyboardPresence, navigationPresence);
+        mWmService.mPolicy.adjustConfigurationLw(config, keyboardPresence, navigationPresence);
     }
 
     private int computeCompatSmallestWidth(boolean rotated, int uiMode, int dw, int dh,
@@ -1949,7 +1950,7 @@
     @Override
     void onAppTransitionDone() {
         super.onAppTransitionDone();
-        mService.mWindowsChanged = true;
+        mWmService.mWindowsChanged = true;
     }
 
     /**
@@ -2001,9 +2002,9 @@
 
     @Override
     int getOrientation() {
-        final WindowManagerPolicy policy = mService.mPolicy;
+        final WindowManagerPolicy policy = mWmService.mPolicy;
 
-        if (mService.mDisplayFrozen) {
+        if (mWmService.mDisplayFrozen) {
             if (mLastWindowForcedOrientation != SCREEN_ORIENTATION_UNSPECIFIED) {
                 if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Display id=" + mDisplayId
                         + " is frozen, return " + mLastWindowForcedOrientation);
@@ -2044,7 +2045,7 @@
     }
 
     void initializeDisplayBaseInfo() {
-        final DisplayManagerInternal displayManagerInternal = mService.mDisplayManagerInternal;
+        final DisplayManagerInternal displayManagerInternal = mWmService.mDisplayManagerInternal;
         if (displayManagerInternal != null) {
             // Bootstrap the default logical display from the display manager.
             final DisplayInfo newDisplayInfo = displayManagerInternal.getDisplayInfo(mDisplayId);
@@ -2067,7 +2068,7 @@
      */
     private void updateBaseDisplayMetricsIfNeeded() {
         // Get real display metrics without overrides from WM.
-        mService.mDisplayManagerInternal.getNonOverrideDisplayInfo(mDisplayId, mDisplayInfo);
+        mWmService.mDisplayManagerInternal.getNonOverrideDisplayInfo(mDisplayId, mDisplayInfo);
         final int orientation = mDisplayInfo.rotation;
         final boolean rotated = (orientation == ROTATION_90 || orientation == ROTATION_270);
         final int newWidth = rotated ? mDisplayInfo.logicalHeight : mDisplayInfo.logicalWidth;
@@ -2096,7 +2097,7 @@
             mInitialDisplayHeight = newHeight;
             mInitialDisplayDensity = newDensity;
             mInitialDisplayCutout = newCutout;
-            mService.reconfigureDisplayLocked(this);
+            mWmService.reconfigureDisplayLocked(this);
         }
     }
 
@@ -2147,9 +2148,9 @@
     void setForcedDensity(int density, int userId) {
         final boolean clear = density == mInitialDisplayDensity;
         final boolean updateCurrent = userId == UserHandle.USER_CURRENT;
-        if (mService.mCurrentUserId == userId || updateCurrent) {
+        if (mWmService.mCurrentUserId == userId || updateCurrent) {
             mBaseDisplayDensity = density;
-            mService.reconfigureDisplayLocked(this);
+            mWmService.reconfigureDisplayLocked(this);
         }
         if (updateCurrent) {
             // We are applying existing settings so no need to save it again.
@@ -2159,7 +2160,7 @@
         if (density == mInitialDisplayDensity) {
             density = 0;
         }
-        mService.mDisplayWindowSettings.setForcedDensity(this, density, userId);
+        mWmService.mDisplayWindowSettings.setForcedDensity(this, density, userId);
     }
 
     /** @param mode {@link #FORCE_SCALING_MODE_AUTO} or {@link #FORCE_SCALING_MODE_DISABLED}. */
@@ -2170,9 +2171,9 @@
 
         mDisplayScalingDisabled = (mode != FORCE_SCALING_MODE_AUTO);
         Slog.i(TAG_WM, "Using display scaling mode: " + (mDisplayScalingDisabled ? "off" : "auto"));
-        mService.reconfigureDisplayLocked(this);
+        mWmService.reconfigureDisplayLocked(this);
 
-        mService.mDisplayWindowSettings.setForcedScalingMode(this, mode);
+        mWmService.mDisplayWindowSettings.setForcedScalingMode(this, mode);
     }
 
     /** If the given width and height equal to initial size, the setting will be cleared. */
@@ -2189,12 +2190,12 @@
 
         Slog.i(TAG_WM, "Using new display size: " + width + "x" + height);
         updateBaseDisplayMetrics(width, height, mBaseDisplayDensity);
-        mService.reconfigureDisplayLocked(this);
+        mWmService.reconfigureDisplayLocked(this);
 
         if (clear) {
             width = height = 0;
         }
-        mService.mDisplayWindowSettings.setForcedSize(this, width, height);
+        mWmService.mDisplayWindowSettings.setForcedSize(this, width, height);
     }
 
     void getStableRect(Rect out) {
@@ -2205,7 +2206,7 @@
         if (DEBUG_STACK) Slog.d(TAG_WM, "Create new stackId=" + stackId + " on displayId="
                 + mDisplayId);
 
-        final TaskStack stack = new TaskStack(mService, stackId, controller);
+        final TaskStack stack = new TaskStack(mWmService, stackId, controller);
         mTaskStackContainers.addStackToDisplay(stack, onTop);
         return stack;
     }
@@ -2361,7 +2362,7 @@
     @Override
     void switchUser() {
         super.switchUser();
-        mService.mWindowsChanged = true;
+        mWmService.mWindowsChanged = true;
     }
 
     private void resetAnimationBackgroundAnimator() {
@@ -2389,15 +2390,15 @@
             mUnknownAppVisibilityController.clear();
             mAppTransition.removeAppTransitionTimeoutCallbacks();
             handleAnimatingStoppedAndTransition();
-            mService.stopFreezingDisplayLocked();
+            mWmService.stopFreezingDisplayLocked();
             super.removeImmediately();
             if (DEBUG_DISPLAY) Slog.v(TAG_WM, "Removing display=" + this);
             if (mPointerEventDispatcher != null && mTapDetector != null) {
                 unregisterPointerEventListener(mTapDetector);
-                unregisterPointerEventListener(mService.mMousePositionTracker);
+                unregisterPointerEventListener(mWmService.mMousePositionTracker);
                 mTapDetector = null;
             }
-            mService.mAnimator.removeDisplayLocked(mDisplayId);
+            mWmService.mAnimator.removeDisplayLocked(mDisplayId);
             mWindowingLayer.release();
             mOverlayLayer.release();
         } finally {
@@ -2406,7 +2407,7 @@
         }
 
         mDisplayPolicy.onDisplayRemoved();
-        mService.mWindowPlacerLocked.requestTraversal();
+        mWmService.mWindowPlacerLocked.requestTraversal();
     }
 
     /** Returns true if a removal action is still being deferred. */
@@ -2483,7 +2484,7 @@
         final boolean imeVisible = imeWin != null && imeWin.isVisibleLw() && imeWin.isDisplayedLw()
                 && !mDividerControllerLocked.isImeHideRequested();
         final boolean dockVisible = isStackVisible(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
-        final TaskStack imeTargetStack = mService.getImeFocusStackLocked();
+        final TaskStack imeTargetStack = mWmService.getImeFocusStackLocked();
         final int imeDockSide = (dockVisible && imeTargetStack != null) ?
                 imeTargetStack.getDockSide() : DOCKED_INVALID;
         final boolean imeOnTop = (imeDockSide == DOCKED_TOP);
@@ -2610,7 +2611,7 @@
         mDisplayInfo.writeToProto(proto, DISPLAY_INFO);
         proto.write(ROTATION, mRotation);
         final ScreenRotationAnimation screenRotationAnimation =
-                mService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
+                mWmService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
         if (screenRotationAnimation != null) {
             screenRotationAnimation.writeToProto(proto, SCREEN_ROTATION_ANIMATION);
         }
@@ -2855,11 +2856,11 @@
         }
 
         if (imWindowChanged) {
-            mService.mWindowsChanged = true;
+            mWmService.mWindowsChanged = true;
             setLayoutNeeded();
         }
 
-        if (DEBUG_FOCUS_LIGHT || mService.localLOGV) Slog.v(TAG_WM, "Changing focus from "
+        if (DEBUG_FOCUS_LIGHT || mWmService.localLOGV) Slog.v(TAG_WM, "Changing focus from "
                 + mCurrentFocus + " to " + newFocus + " displayId=" + getDisplayId()
                 + " Callers=" + Debug.getCallers(4));
         final WindowState oldFocus = mCurrentFocus;
@@ -2898,7 +2899,7 @@
             if (mode == UPDATE_FOCUS_PLACING_SURFACES) {
                 performLayout(true /*initial*/, updateInputWindows);
             } else if (mode == UPDATE_FOCUS_REMOVING_FOCUS) {
-                mService.mRoot.performSurfacePlacement(false);
+                mWmService.mRoot.performSurfacePlacement(false);
             }
         }
 
@@ -2963,16 +2964,16 @@
     // moving containers or resizing them. Need to investigate the best way to have it automatically
     // happen so we don't run into issues with programmers forgetting to do it.
     void layoutAndAssignWindowLayersIfNeeded() {
-        mService.mWindowsChanged = true;
+        mWmService.mWindowsChanged = true;
         setLayoutNeeded();
 
-        if (!mService.updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
+        if (!mWmService.updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
                 false /*updateInputWindows*/)) {
             assignWindowLayers(false /* setLayoutNeeded */);
         }
 
         mInputMonitor.setUpdateInputWindowsNeededLw();
-        mService.mWindowPlacerLocked.performSurfacePlacement();
+        mWmService.mWindowPlacerLocked.performSurfacePlacement();
         mInputMonitor.updateInputWindowsLw(false /*force*/);
     }
 
@@ -2985,14 +2986,14 @@
             if (wsa.mSurfaceController == null) {
                 return;
             }
-            if (!mService.mSessions.contains(wsa.mSession)) {
+            if (!mWmService.mSessions.contains(wsa.mSession)) {
                 Slog.w(TAG_WM, "LEAKED SURFACE (session doesn't exist): "
                         + w + " surface=" + wsa.mSurfaceController
                         + " token=" + w.mToken
                         + " pid=" + w.mSession.mPid
                         + " uid=" + w.mSession.mUid);
                 wsa.destroySurface();
-                mService.mForceRemoves.add(w);
+                mWmService.mForceRemoves.add(w);
                 mTmpWindow = w;
             } else if (w.mAppToken != null && w.mAppToken.isClientHidden()) {
                 Slog.w(TAG_WM, "LEAKED SURFACE (app token hidden): "
@@ -3016,7 +3017,7 @@
         // Update display configuration for IME process.
         if (mInputMethodWindow != null) {
             final int imePid = mInputMethodWindow.mSession.mPid;
-            mService.mAtmInternal.onImeWindowSetOnDisplay(imePid,
+            mWmService.mAtmInternal.onImeWindowSetOnDisplay(imePid,
                     mInputMethodWindow.getDisplayId());
         }
         computeImeTarget(true /* updateImeTarget */);
@@ -3237,7 +3238,7 @@
      * Starts the Keyguard exit animation on all windows that don't belong to an app token.
      */
     void startKeyguardExitOnNonAppWindows(boolean onWallpaper, boolean goingToShade) {
-        final WindowManagerPolicy policy = mService.mPolicy;
+        final WindowManagerPolicy policy = mWmService.mPolicy;
         forAllWindows(w -> {
             if (w.mAppToken == null && policy.canBeHiddenByKeyguardLw(w)
                     && w.wouldBeVisibleIfPolicyIgnored() && !w.isVisible()) {
@@ -3266,7 +3267,7 @@
                 } else if (w.mAttrs.type == TYPE_WALLPAPER) {
                     mHaveWallpaper = true;
                 } else if (w.mAttrs.type == TYPE_STATUS_BAR) {
-                    mHaveKeyguard = mService.mPolicy.isKeyguardDrawnLw();
+                    mHaveKeyguard = mWmService.mPolicy.isKeyguardDrawnLw();
                 }
             }
             return false;
@@ -3279,28 +3280,28 @@
 
         // if the wallpaper service is disabled on the device, we're never going to have
         // wallpaper, don't bother waiting for it
-        boolean wallpaperEnabled = mService.mContext.getResources().getBoolean(
+        boolean wallpaperEnabled = mWmService.mContext.getResources().getBoolean(
                 com.android.internal.R.bool.config_enableWallpaperService)
-                && mService.mContext.getResources().getBoolean(
+                && mWmService.mContext.getResources().getBoolean(
                         com.android.internal.R.bool.config_checkWallpaperAtBoot)
-                && !mService.mOnlyCore;
+                && !mWmService.mOnlyCore;
 
         if (DEBUG_SCREEN_ON || DEBUG_BOOT) Slog.i(TAG_WM,
-                "******** booted=" + mService.mSystemBooted
-                + " msg=" + mService.mShowingBootMessages
+                "******** booted=" + mWmService.mSystemBooted
+                + " msg=" + mWmService.mShowingBootMessages
                 + " haveBoot=" + mHaveBootMsg + " haveApp=" + mHaveApp
                 + " haveWall=" + mHaveWallpaper + " wallEnabled=" + wallpaperEnabled
                 + " haveKeyguard=" + mHaveKeyguard);
 
         // If we are turning on the screen to show the boot message, don't do it until the boot
         // message is actually displayed.
-        if (!mService.mSystemBooted && !mHaveBootMsg) {
+        if (!mWmService.mSystemBooted && !mHaveBootMsg) {
             return true;
         }
 
         // If we are turning on the screen after the boot is completed normally, don't do so until
         // we have the application and wallpaper.
-        if (mService.mSystemBooted
+        if (mWmService.mSystemBooted
                 && ((!mHaveApp && !mHaveKeyguard) || (wallpaperEnabled && !mHaveWallpaper))) {
             return true;
         }
@@ -3366,7 +3367,7 @@
 
         mLastDispatchedSystemUiVisibility = visibility;
         if (isDefaultDisplay) {
-            mService.mInputManager.setSystemUiVisibility(visibility);
+            mWmService.mInputManager.setSystemUiVisibility(visibility);
         }
         updateSystemUiVisibility(visibility, globalDiff);
         return true;
@@ -3395,13 +3396,13 @@
     void reevaluateStatusBarVisibility() {
         int visibility = getDisplayPolicy().adjustSystemUiVisibilityLw(mLastStatusBarVisibility);
         if (updateStatusBarVisibilityLocked(visibility)) {
-            mService.mWindowPlacerLocked.requestTraversal();
+            mWmService.mWindowPlacerLocked.requestTraversal();
         }
     }
 
     void onWindowFreezeTimeout() {
         Slog.w(TAG_WM, "Window freeze timeout expired.");
-        mService.mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_TIMEOUT;
+        mWmService.mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_TIMEOUT;
 
         forAllWindows(w -> {
             if (!w.getOrientationChanging()) {
@@ -3409,28 +3410,28 @@
             }
             w.orientationChangeTimedOut();
             w.mLastFreezeDuration = (int)(SystemClock.elapsedRealtime()
-                    - mService.mDisplayFreezeTime);
+                    - mWmService.mDisplayFreezeTime);
             Slog.w(TAG_WM, "Force clearing orientation change: " + w);
         }, true /* traverseTopToBottom */);
-        mService.mWindowPlacerLocked.performSurfacePlacement();
+        mWmService.mWindowPlacerLocked.performSurfacePlacement();
     }
 
     void waitForAllWindowsDrawn() {
-        final WindowManagerPolicy policy = mService.mPolicy;
+        final WindowManagerPolicy policy = mWmService.mPolicy;
         forAllWindows(w -> {
             final boolean keyguard = policy.isKeyguardHostWindow(w.mAttrs);
             if (w.isVisibleLw() && (w.mAppToken != null || keyguard)) {
                 w.mWinAnimator.mDrawState = DRAW_PENDING;
                 // Force add to mResizingWindows.
                 w.resetLastContentInsets();
-                mService.mWaitingForDrawn.add(w);
+                mWmService.mWaitingForDrawn.add(w);
             }
         }, true /* traverseTopToBottom */);
     }
 
     // TODO: Super crazy long method that should be broken down...
     void applySurfaceChangesTransaction(boolean recoveringMemory) {
-        final WindowSurfacePlacer surfacePlacer = mService.mWindowPlacerLocked;
+        final WindowSurfacePlacer surfacePlacer = mWmService.mWindowPlacerLocked;
 
         mTmpUpdateAllDrawn.clear();
 
@@ -3487,7 +3488,7 @@
         prepareSurfaces();
 
         mLastHasContent = mTmpApplySurfaceChangesTransactionState.displayHasContent;
-        mService.mDisplayManagerInternal.setDisplayProperties(mDisplayId,
+        mWmService.mDisplayManagerInternal.setDisplayProperties(mDisplayId,
                 mLastHasContent,
                 mTmpApplySurfaceChangesTransactionState.preferredRefreshRate,
                 mTmpApplySurfaceChangesTransactionState.preferredModeId,
@@ -3496,7 +3497,7 @@
         final boolean wallpaperVisible = mWallpaperController.isWallpaperVisible();
         if (wallpaperVisible != mLastWallpaperVisible) {
             mLastWallpaperVisible = wallpaperVisible;
-            mService.mWallpaperVisibilityListeners.notifyWallpaperVisibilityChanged(this);
+            mWmService.mWallpaperVisibilityListeners.notifyWallpaperVisibilityChanged(this);
         }
 
         while (!mTmpUpdateAllDrawn.isEmpty()) {
@@ -3594,7 +3595,7 @@
             mInputMonitor.updateInputWindowsLw(false /*force*/);
         }
 
-        mService.mH.sendEmptyMessage(UPDATE_DOCKED_STACK_DIVIDER);
+        mWmService.mH.sendEmptyMessage(UPDATE_DOCKED_STACK_DIVIDER);
     }
 
     /**
@@ -3604,7 +3605,7 @@
      * @param config of the output bitmap
      */
     Bitmap screenshotDisplayLocked(Bitmap.Config config) {
-        if (!mService.mPolicy.isScreenOn()) {
+        if (!mWmService.mPolicy.isScreenOn()) {
             if (DEBUG_SCREENSHOT) {
                 Slog.i(TAG_WM, "Attempted to take screenshot while display was off.");
             }
@@ -3632,7 +3633,7 @@
         convertCropForSurfaceFlinger(frame, rot, dw, dh);
 
         final ScreenRotationAnimation screenRotationAnimation =
-                mService.mAnimator.getScreenRotationAnimationLocked(DEFAULT_DISPLAY);
+                mWmService.mAnimator.getScreenRotationAnimationLocked(DEFAULT_DISPLAY);
         final boolean inRotation = screenRotationAnimation != null &&
                 screenRotationAnimation.isAnimating();
         if (DEBUG_SCREENSHOT && inRotation) Slog.v(TAG_WM, "Taking screenshot while rotating");
@@ -3688,11 +3689,11 @@
             mTmpWindow = w;
             w.setDisplayLayoutNeeded();
             w.finishSeamlessRotation(true /* timeout */);
-            mService.markForSeamlessRotation(w, false);
+            mWmService.markForSeamlessRotation(w, false);
         }, true /* traverseTopToBottom */);
 
         if (mTmpWindow != null) {
-            mService.mWindowPlacerLocked.performSurfacePlacement();
+            mWmService.mWindowPlacerLocked.performSurfacePlacement();
         }
     }
 
@@ -3720,20 +3721,20 @@
     @Override
     void onDescendantOverrideConfigurationChanged() {
         setLayoutNeeded();
-        mService.requestTraversal();
+        mWmService.requestTraversal();
     }
 
     boolean okToDisplay() {
         if (mDisplayId == DEFAULT_DISPLAY) {
-            return !mService.mDisplayFrozen
-                    && mService.mDisplayEnabled && mService.mPolicy.isScreenOn();
+            return !mWmService.mDisplayFrozen
+                    && mWmService.mDisplayEnabled && mWmService.mPolicy.isScreenOn();
         }
         return mDisplayInfo.state == Display.STATE_ON;
     }
 
     boolean okToAnimate() {
         return okToDisplay() &&
-                (mDisplayId != DEFAULT_DISPLAY || mService.mPolicy.okToAnimate());
+                (mDisplayId != DEFAULT_DISPLAY || mWmService.mPolicy.okToAnimate());
     }
 
     static final class TaskForResizePointSearchResult {
@@ -3951,7 +3952,7 @@
             } else if (stack == mSplitScreenPrimaryStack) {
                 mSplitScreenPrimaryStack = null;
                 // Re-set the split-screen create mode whenever the split-screen stack is removed.
-                mService.setDockedStackCreateStateLocked(
+                mWmService.setDockedStackCreateStateLocked(
                         SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT, null /* initialBounds */);
                 mDividerControllerLocked.notifyDockedStackExistsChanged(false);
             }
@@ -4169,7 +4170,7 @@
             }
 
             final int orientation = super.getOrientation();
-            boolean isCar = mService.mContext.getPackageManager().hasSystemFeature(
+            boolean isCar = mWmService.mContext.getPackageManager().hasSystemFeature(
                     PackageManager.FEATURE_AUTOMOTIVE);
             if (isCar) {
                 // In a car, you cannot physically rotate the screen, so it doesn't make sense to
@@ -4350,10 +4351,10 @@
                 wt.assignLayer(t, j);
                 wt.assignChildLayers(t);
 
-                int layer = mService.mPolicy.getWindowLayerFromTypeLw(
+                int layer = mWmService.mPolicy.getWindowLayerFromTypeLw(
                         wt.windowType, wt.mOwnerCanManageAppTokens);
 
-                if (needAssignIme && layer >= mService.mPolicy.getWindowLayerFromTypeLw(
+                if (needAssignIme && layer >= mWmService.mPolicy.getWindowLayerFromTypeLw(
                                 TYPE_INPUT_METHOD_DIALOG, true)) {
                     imeContainer.assignRelativeLayer(t, wt.getSurfaceControl(), -1);
                     needAssignIme = false;
@@ -4376,9 +4377,9 @@
          */
         private final Comparator<WindowToken> mWindowComparator = (token1, token2) ->
                 // Tokens with higher base layer are z-ordered on-top.
-                mService.mPolicy.getWindowLayerFromTypeLw(token1.windowType,
+                mWmService.mPolicy.getWindowLayerFromTypeLw(token1.windowType,
                         token1.mOwnerCanManageAppTokens)
-                < mService.mPolicy.getWindowLayerFromTypeLw(token2.windowType,
+                < mWmService.mPolicy.getWindowLayerFromTypeLw(token2.windowType,
                         token2.mOwnerCanManageAppTokens) ? -1 : 1;
 
         private final Predicate<WindowState> mGetOrientingWindow = w -> {
@@ -4408,7 +4409,7 @@
 
         @Override
         int getOrientation() {
-            final WindowManagerPolicy policy = mService.mPolicy;
+            final WindowManagerPolicy policy = mWmService.mPolicy;
             // Find a window requesting orientation.
             final WindowState win = getWindow(mGetOrientingWindow);
 
@@ -4416,7 +4417,7 @@
                 final int req = win.mAttrs.screenOrientation;
                 if (policy.isKeyguardHostWindow(win.mAttrs)) {
                     mLastKeyguardForcedOrientation = req;
-                    if (mService.mKeyguardGoingAway) {
+                    if (mWmService.mKeyguardGoingAway) {
                         // Keyguard can't affect the orientation if it is going away...
                         mLastWindowForcedOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
                         return SCREEN_ORIENTATION_UNSET;
@@ -4474,7 +4475,7 @@
     };
 
     SurfaceControl.Builder makeSurface(SurfaceSession s) {
-        return mService.makeSurfaceBuilder(s)
+        return mWmService.makeSurfaceBuilder(s)
                 .setParent(mWindowingLayer);
     }
 
@@ -4486,7 +4487,7 @@
     @Override
     SurfaceControl.Builder makeChildSurface(WindowContainer child) {
         SurfaceSession s = child != null ? child.getSession() : getSession();
-        final SurfaceControl.Builder b = mService.makeSurfaceBuilder(s);
+        final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(s);
         if (child == null) {
             return b;
         }
@@ -4502,7 +4503,7 @@
      * and other potpourii.
      */
     SurfaceControl.Builder makeOverlay() {
-        return mService.makeSurfaceBuilder(mSession)
+        return mWmService.makeSurfaceBuilder(mSession)
             .setParent(mOverlayLayer);
     }
 
@@ -4601,7 +4602,7 @@
     @Override
     void prepareSurfaces() {
         final ScreenRotationAnimation screenRotationAnimation =
-                mService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
+                mWmService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
         if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()) {
             screenRotationAnimation.getEnterTransformation().getMatrix().getValues(mTmpFloats);
             mPendingTransaction.setMatrix(mWindowingLayer,
@@ -4689,7 +4690,7 @@
                         + mDisplayId + " Callers=" + Debug.getCallers(5));
             }
             mAppTransition.setReady();
-            mService.mWindowPlacerLocked.requestTraversal();
+            mWmService.mWindowPlacerLocked.requestTraversal();
         }
     }
 
@@ -4719,7 +4720,7 @@
         mWallpaperMayChange = true;
         // Since the window list has been rebuilt, focus might have to be recomputed since the
         // actual order of windows might have changed again.
-        mService.mFocusMayChange = true;
+        mWmService.mFocusMayChange = true;
 
         pendingLayoutChanges |= changes;
     }
@@ -4732,7 +4733,7 @@
         return mDisplay.supportsSystemDecorations()
                 // TODO (b/111363427): Remove this and set the new FLAG_SHOULD_SHOW_LAUNCHER flag
                 // (b/114338689) whenever vr 2d display id is set.
-                || mDisplayId == mService.mVr2dDisplayId
-                || mService.mForceDesktopModeOnExternalDisplays;
+                || mDisplayId == mWmService.mVr2dDisplayId
+                || mWmService.mForceDesktopModeOnExternalDisplays;
     }
 }