Configuration renaming and minor cleanup in AM and WM

- Configuration members in AM and WM are renamed to
  mGlobalConfiguration.
- Renamed parameters names in some methods to better represent
  their meaning.
- Added and fixed some docs.

Change-Id: Ie51f687fe4c10dbce776435f29d6b853fda50eec
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index c1df825..096f0cb 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -265,8 +265,20 @@
     public void finishInstrumentation(IApplicationThread target,
             int resultCode, Bundle results) throws RemoteException;
 
+    /**
+     * @return A copy of global {@link Configuration}, contains general settings for the entire
+     *         system. Corresponds to the configuration of the default display.
+     * @throws RemoteException
+     */
     public Configuration getConfiguration() throws RemoteException;
+
+    /**
+     * Updates global configuration and applies changes to the entire system.
+     * @param values Update values for global configuration.
+     * @throws RemoteException
+     */
     public void updateConfiguration(Configuration values) throws RemoteException;
+
     public void setRequestedOrientation(IBinder token,
             int requestedOrientation) throws RemoteException;
     public int getRequestedOrientation(IBinder token) throws RemoteException;
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 91d8c24..1d9f99f 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -101,7 +101,7 @@
      * @param launchTaskBehind True if the token is been launched from behind.
      * @param taskBounds Bounds to use when creating a new Task with the input task Id if
      *                   the task doesn't exist yet.
-     * @param configuration Configuration that is being used with this task.
+     * @param overrideConfig Override configuration that is being used with this task.
      * @param taskResizeMode The resize mode of the task.
      * @param alwaysFocusable True if the app windows are always focusable regardless of the stack
      *                        they are in.
@@ -112,7 +112,7 @@
     void addAppToken(int addPos, IApplicationToken token, int taskId, int stackId,
             int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
             int configChanges, boolean voiceInteraction, boolean launchTaskBehind,
-            in Rect taskBounds, in Configuration configuration, int taskResizeMode,
+            in Rect taskBounds, in Configuration overrideConfig, int taskResizeMode,
             boolean alwaysFocusable, boolean homeTask, int targetSdkVersion,
             int rotationAnimationHint, boolean isOnTopLauncher);
     /**
@@ -123,13 +123,14 @@
      *                if the task doesn't exist yet.
      * @param taskBounds Bounds to use when creating a new Task with the input task Id if
      *                   the task doesn't exist yet.
-     * @param config Configuration that is being used with this task.
+     * @param overrideConfig Override configuration that is being used with this task.
      * @param taskResizeMode The resize mode of the task.
      * @param homeTask True if this is the task.
      * @param isOnTopLauncher True if this task is an on-top launcher.
      */
     void setAppTask(IBinder token, int taskId, int stackId, in Rect taskBounds,
-            in Configuration config, int taskResizeMode, boolean homeTask, boolean isOnTopLauncher);
+            in Configuration overrideConfig, int taskResizeMode, boolean homeTask,
+            boolean isOnTopLauncher);
     void setAppOrientation(IApplicationToken token, int requestedOrientation);
     int getAppOrientation(IApplicationToken token);
     void setFocusedApp(IBinder token, boolean moveFocusNow);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index e063f18e..f740b4b 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -286,7 +286,6 @@
 import static android.provider.Settings.Global.LENIENT_BACKGROUND_CHECK;
 import static android.provider.Settings.Global.WAIT_FOR_DEBUGGER;
 import static android.provider.Settings.System.FONT_SCALE;
-import static android.security.KeyChain.ACTION_TRUST_STORE_CHANGED;
 import static com.android.internal.util.XmlUtils.readBooleanAttribute;
 import static com.android.internal.util.XmlUtils.readIntAttribute;
 import static com.android.internal.util.XmlUtils.readLongAttribute;
@@ -555,7 +554,7 @@
     public IntentFirewall mIntentFirewall;
 
     // Whether we should show our dialogs (ANR, crash, etc) or just perform their
-    // default actuion automatically.  Important for devices without direct input
+    // default action automatically.  Important for devices without direct input
     // devices.
     private boolean mShowDialogs = true;
     private boolean mInVrMode = false;
@@ -1121,19 +1120,18 @@
     final AppOpsService mAppOpsService;
 
     /**
-     * Current configuration information.  HistoryRecord objects are given
-     * a reference to this object to indicate which configuration they are
-     * currently running in, so this object must be kept immutable.
+     * Current global configuration information. Contains general settings for the entire system,
+     * also corresponds to the merged configuration of the default display.
      */
-    Configuration mConfiguration = new Configuration();
+    Configuration mGlobalConfiguration = new Configuration();
 
     /**
      * Current sequencing integer of the configuration, for skipping old
      * configurations.
      */
-    int mConfigurationSeq = 0;
+    private int mConfigurationSeq;
 
-    boolean mSuppressResizeConfigChanges = false;
+    boolean mSuppressResizeConfigChanges;
 
     /**
      * Hardware-reported OpenGLES version.
@@ -2304,7 +2302,7 @@
                     callingPackage = r.info.getComponentName();
                     if (mInVrMode != vrMode) {
                         mInVrMode = vrMode;
-                        mShowDialogs = shouldShowDialogs(mConfiguration, mInVrMode);
+                        mShowDialogs = shouldShowDialogs(mGlobalConfiguration, mInVrMode);
                         if (r.app != null) {
                             ProcessRecord proc = r.app;
                             if (proc.vrThreadTid > 0) {
@@ -2680,10 +2678,10 @@
 
         mTrackingAssociations = "1".equals(SystemProperties.get("debug.track-associations"));
 
-        mConfiguration.setToDefaults();
-        mConfiguration.setLocales(LocaleList.getDefault());
+        mGlobalConfiguration.setToDefaults();
+        mGlobalConfiguration.setLocales(LocaleList.getDefault());
 
-        mConfigurationSeq = mConfiguration.seq = 1;
+        mConfigurationSeq = mGlobalConfiguration.seq = 1;
         mProcessCpuTracker.init();
 
         mCompatModePackages = new CompatModePackages(this, systemDir, mHandler);
@@ -3120,8 +3118,8 @@
     }
 
     final void showUnsupportedZoomDialogIfNeededLocked(ActivityRecord r) {
-        if (mConfiguration.densityDpi != DisplayMetrics.DENSITY_DEVICE_STABLE
-                && r.appInfo.requiresSmallestWidthDp > mConfiguration.smallestScreenWidthDp) {
+        if (mGlobalConfiguration.densityDpi != DisplayMetrics.DENSITY_DEVICE_STABLE
+                && r.appInfo.requiresSmallestWidthDp > mGlobalConfiguration.smallestScreenWidthDp) {
             final Message msg = Message.obtain();
             msg.what = SHOW_UNSUPPORTED_DISPLAY_SIZE_DIALOG_MSG;
             msg.obj = r;
@@ -4725,7 +4723,7 @@
             final long origId = Binder.clearCallingIdentity();
             mWindowManager.setAppOrientation(r.appToken, requestedOrientation);
             Configuration config = mWindowManager.updateOrientationFromAppTokens(
-                    mConfiguration, r.mayFreezeScreenLocked(r.app) ? r.appToken : null);
+                    mGlobalConfiguration, r.mayFreezeScreenLocked(r.app) ? r.appToken : null);
             if (config != null) {
                 r.frozenBeforeDestroy = true;
                 if (!updateConfigurationLocked(config, r, false)) {
@@ -6508,7 +6506,7 @@
                                  PackageManager.NOTIFY_PACKAGE_USE_INSTRUMENTATION);
             }
             if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Binding proc "
-                    + processName + " with config " + mConfiguration);
+                    + processName + " with config " + mGlobalConfiguration);
             ApplicationInfo appInfo = app.instrumentationInfo != null
                     ? app.instrumentationInfo : app.info;
             app.compat = compatibilityInfoForPackageLocked(appInfo);
@@ -6522,7 +6520,7 @@
                     app.instrumentationUiAutomationConnection, testMode,
                     mBinderTransactionTrackingEnabled, enableTrackAllocation,
                     isRestrictedBackupMode || !normalMode, app.persistent,
-                    new Configuration(mConfiguration), app.compat,
+                    new Configuration(mGlobalConfiguration), app.compat,
                     getCommonServicesLocked(app.isolated),
                     mCoreSettingsObserver.getCoreSettingsLocked());
             updateLruProcessLocked(app, false, null);
@@ -9282,7 +9280,7 @@
                 r.task.stack.getDisplaySize(displaySize);
                 thumbnailInfo.taskWidth = displaySize.x;
                 thumbnailInfo.taskHeight = displaySize.y;
-                thumbnailInfo.screenOrientation = mConfiguration.orientation;
+                thumbnailInfo.screenOrientation = mGlobalConfiguration.orientation;
 
                 TaskRecord task = new TaskRecord(this,
                         mStackSupervisor.getNextTaskIdForUserLocked(r.userId),
@@ -13114,11 +13112,11 @@
                 mSupportsFreeformWindowManagement = false;
                 mSupportsPictureInPicture = false;
             }
-            // This happens before any activities are started, so we can
-            // change mConfiguration in-place.
+            // This happens before any activities are started, so we can change global configuration
+            // in-place.
             updateConfigurationLocked(configuration, null, true);
             if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
-                    "Initial config: " + mConfiguration);
+                    "Initial config: " + mGlobalConfiguration);
 
             // Load resources only after the current configuration has been set.
             final Resources res = mContext.getResources();
@@ -13133,10 +13131,11 @@
                     com.android.internal.R.string.config_appsNotReportingCrashes));
             mUserController.mUserSwitchUiEnabled = !res.getBoolean(
                     com.android.internal.R.bool.config_customUserSwitchUi);
-            if ((mConfiguration.uiMode & UI_MODE_TYPE_TELEVISION) == UI_MODE_TYPE_TELEVISION) {
+            if ((mGlobalConfiguration.uiMode & UI_MODE_TYPE_TELEVISION)
+                    == UI_MODE_TYPE_TELEVISION) {
                 mFullscreenThumbnailScale = (float) res
                     .getInteger(com.android.internal.R.integer.thumbnail_width_tv) /
-                    (float) mConfiguration.screenWidthDp;
+                    (float) mGlobalConfiguration.screenWidthDp;
             } else {
                 mFullscreenThumbnailScale = res.getFraction(
                     com.android.internal.R.fraction.thumbnail_fullscreen_scale, 1, 1);
@@ -14729,7 +14728,7 @@
             pw.println("  mHeavyWeightProcess: " + mHeavyWeightProcess);
         }
         if (dumpPackage == null) {
-            pw.println("  mConfiguration: " + mConfiguration);
+            pw.println("  mGlobalConfiguration: " + mGlobalConfiguration);
         }
         if (dumpAll) {
             pw.println("  mConfigWillChange: " + getFocusedStack().mConfigWillChange);
@@ -18712,15 +18711,15 @@
     public ConfigurationInfo getDeviceConfigurationInfo() {
         ConfigurationInfo config = new ConfigurationInfo();
         synchronized (this) {
-            config.reqTouchScreen = mConfiguration.touchscreen;
-            config.reqKeyboardType = mConfiguration.keyboard;
-            config.reqNavigation = mConfiguration.navigation;
-            if (mConfiguration.navigation == Configuration.NAVIGATION_DPAD
-                    || mConfiguration.navigation == Configuration.NAVIGATION_TRACKBALL) {
+            config.reqTouchScreen = mGlobalConfiguration.touchscreen;
+            config.reqKeyboardType = mGlobalConfiguration.keyboard;
+            config.reqNavigation = mGlobalConfiguration.navigation;
+            if (mGlobalConfiguration.navigation == Configuration.NAVIGATION_DPAD
+                    || mGlobalConfiguration.navigation == Configuration.NAVIGATION_TRACKBALL) {
                 config.reqInputFeatures |= ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
             }
-            if (mConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED
-                    && mConfiguration.keyboard != Configuration.KEYBOARD_NOKEYS) {
+            if (mGlobalConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED
+                    && mGlobalConfiguration.keyboard != Configuration.KEYBOARD_NOKEYS) {
                 config.reqInputFeatures |= ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
             }
             config.reqGlEsVersion = GL_ES_VERSION;
@@ -18744,7 +18743,7 @@
     public Configuration getConfiguration() {
         Configuration ci;
         synchronized(this) {
-            ci = new Configuration(mConfiguration);
+            ci = new Configuration(mGlobalConfiguration);
             ci.userSetLocale = false;
         }
         return ci;
@@ -18777,8 +18776,8 @@
     @Override
     public void updatePersistentConfiguration(Configuration values) {
         enforceCallingPermission(android.Manifest.permission.CHANGE_CONFIGURATION,
-                "updateConfiguration()");
-        enforceWriteSettingsPermission("updateConfiguration()");
+                "updatePersistentConfiguration()");
+        enforceWriteSettingsPermission("updatePersistentConfiguration()");
         if (values == null) {
             throw new NullPointerException("Configuration must not be null");
         }
@@ -18802,7 +18801,7 @@
     private void updateFontScaleIfNeeded(@UserIdInt int userId) {
         final float scaleFactor = Settings.System.getFloatForUser(mContext.getContentResolver(),
                 FONT_SCALE, 1.0f, userId);
-        if (mConfiguration.fontScale != scaleFactor) {
+        if (mGlobalConfiguration.fontScale != scaleFactor) {
             final Configuration configuration = mWindowManager.computeNewConfiguration();
             configuration.fontScale = scaleFactor;
             synchronized (this) {
@@ -18854,7 +18853,7 @@
     }
 
     void updateUserConfigurationLocked() {
-        Configuration configuration = new Configuration(mConfiguration);
+        Configuration configuration = new Configuration(mGlobalConfiguration);
         Settings.System.adjustConfigurationForUser(mContext.getContentResolver(), configuration,
                 mUserController.getCurrentUserIdLocked(), Settings.System.canWrite(mContext));
         updateConfigurationLocked(configuration, null, false);
@@ -18893,7 +18892,7 @@
             mWindowManager.deferSurfaceLayout();
         }
         if (values != null) {
-            Configuration newConfig = new Configuration(mConfiguration);
+            Configuration newConfig = new Configuration(mGlobalConfiguration);
             changes = newConfig.updateFrom(values);
             if (changes != 0) {
                 if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.i(TAG_CONFIGURATION,
@@ -18924,13 +18923,13 @@
                     mConfigurationSeq = 1;
                 }
                 newConfig.seq = mConfigurationSeq;
-                mConfiguration = newConfig;
+                mGlobalConfiguration = newConfig;
                 Slog.i(TAG, "Config changes=" + Integer.toHexString(changes) + " " + newConfig);
                 mUsageStatsService.reportConfigurationChange(newConfig,
                         mUserController.getCurrentUserIdLocked());
                 //mUsageStatsService.noteStartConfig(newConfig);
 
-                final Configuration configCopy = new Configuration(mConfiguration);
+                final Configuration configCopy = new Configuration(mGlobalConfiguration);
 
                 // TODO: If our config changes, should we auto dismiss any currently
                 // showing dialogs?
@@ -18971,7 +18970,7 @@
                     try {
                         if (app.thread != null) {
                             if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Sending to proc "
-                                    + app.processName + " new config " + mConfiguration);
+                                    + app.processName + " new config " + mGlobalConfiguration);
                             app.thread.scheduleConfigurationChanged(configCopy);
                         }
                     } catch (Exception e) {
@@ -19000,7 +18999,8 @@
             // relaunches if necessary. This way we don't need to relaunch again below in
             // ensureActivityConfigurationLocked().
             if (mWindowManager != null) {
-                final int[] resizedStacks = mWindowManager.setNewConfiguration(mConfiguration);
+                final int[] resizedStacks =
+                        mWindowManager.setNewConfiguration(mGlobalConfiguration);
                 if (resizedStacks != null) {
                     for (int stackId : resizedStacks) {
                         final Rect newBounds = mWindowManager.getBoundsForNewConfiguration(stackId);
@@ -19045,7 +19045,7 @@
      * A thought: SystemUI might also want to get told about this, the Power
      * dialog / global actions also might want different behaviors.
      */
-    private static final boolean shouldShowDialogs(Configuration config, boolean inVrMode) {
+    private static boolean shouldShowDialogs(Configuration config, boolean inVrMode) {
         final boolean inputMethodExists = !(config.keyboard == Configuration.KEYBOARD_NOKEYS
                                    && config.touchscreen == Configuration.TOUCHSCREEN_NOTOUCH
                                    && config.navigation == Configuration.NAVIGATION_NONAV);
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index b50783c..06eeb2c 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -2497,7 +2497,7 @@
             boolean notUpdated = true;
             if (mStackSupervisor.isFocusedStack(this)) {
                 Configuration config = mWindowManager.updateOrientationFromAppTokens(
-                        mService.mConfiguration,
+                        mService.mGlobalConfiguration,
                         next.mayFreezeScreenLocked(next.app) ? next.appToken : null);
                 if (config != null) {
                     next.frozenBeforeDestroy = true;
@@ -4543,7 +4543,7 @@
 
         // Short circuit: if the two configurations are equal (the common case), then there is
         // nothing to do.
-        final Configuration newConfig = mService.mConfiguration;
+        final Configuration newConfig = mService.mGlobalConfiguration;
         r.task.sanitizeOverrideConfiguration(newConfig);
         final Configuration taskConfig = r.task.mOverrideConfig;
         if (r.configuration.equals(newConfig)
@@ -4773,7 +4773,7 @@
             r.forceNewConfig = false;
             mStackSupervisor.activityRelaunchingLocked(r);
             r.app.thread.scheduleRelaunchActivity(r.appToken, results, newIntents, changes,
-                    !andResume, new Configuration(mService.mConfiguration),
+                    !andResume, new Configuration(mService.mGlobalConfiguration),
                     new Configuration(r.task.mOverrideConfig), preserveWindow);
             // Note: don't need to call pauseIfSleepingLocked() here, because
             // the caller will only pass in 'andResume' if this activity is
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 647c2ec..80d51e5 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -1191,7 +1191,7 @@
         // just restarting it anyway.
         if (checkConfig) {
             Configuration config = mWindowManager.updateOrientationFromAppTokens(
-                    mService.mConfiguration,
+                    mService.mGlobalConfiguration,
                     r.mayFreezeScreenLocked(app) ? r.appToken : null);
             // Deferring resume here because we're going to launch new activity shortly.
             // We don't want to perform a redundant launch of the same record while ensuring
@@ -1282,7 +1282,8 @@
             }
             app.forceProcessStateUpTo(mService.mTopProcessState);
             app.thread.scheduleLaunchActivity(new Intent(r.intent), r.appToken,
-                    System.identityHashCode(r), r.info, new Configuration(mService.mConfiguration),
+                    System.identityHashCode(r), r.info,
+                    new Configuration(mService.mGlobalConfiguration),
                     new Configuration(task.mOverrideConfig), r.compat, r.launchedFromPackage,
                     task.voiceInteractor, app.repProcState, r.icicle, r.persistentState, results,
                     newIntents, !andResume, mService.isNextTransitionForward(), profilerInfo);
@@ -2272,12 +2273,12 @@
 
         Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizeTask_" + task.taskId);
 
-        final Configuration overrideConfig =  task.updateOverrideConfiguration(bounds);
+        final boolean updatedConfig = task.updateOverrideConfiguration(bounds);
         // This variable holds information whether the configuration didn't change in a significant
         // way and the activity was kept the way it was. If it's false, it means the activity had
         // to be relaunched due to configuration change.
         boolean kept = true;
-        if (overrideConfig != null) {
+        if (updatedConfig) {
             final ActivityRecord r = task.topRunningActivityLocked();
             if (r != null) {
                 final ActivityStack stack = task.stack;
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index bd0d9b8..975b23e1 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -99,11 +99,9 @@
 import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.os.Binder;
-import android.os.Build;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.PowerManagerInternal;
-import android.os.Process;
 import android.os.RemoteException;
 import android.os.SystemClock;
 import android.os.UserHandle;
@@ -471,7 +469,7 @@
         }
 
         ActivityRecord r = new ActivityRecord(mService, callerApp, callingUid, callingPackage,
-                intent, resolvedType, aInfo, mService.mConfiguration, resultRecord, resultWho,
+                intent, resolvedType, aInfo, mService.mGlobalConfiguration, resultRecord, resultWho,
                 requestCode, componentSpecified, voiceSession != null, mSupervisor, container,
                 options, sourceRecord);
         if (outActivity != null) {
@@ -713,8 +711,8 @@
             String callingPackage, Intent intent, String resolvedType,
             IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
             IBinder resultTo, String resultWho, int requestCode, int startFlags,
-            ProfilerInfo profilerInfo, IActivityManager.WaitResult outResult, Configuration config,
-            Bundle bOptions, boolean ignoreTargetSecurity, int userId,
+            ProfilerInfo profilerInfo, IActivityManager.WaitResult outResult,
+            Configuration globalConfig, Bundle bOptions, boolean ignoreTargetSecurity, int userId,
             IActivityContainer iContainer, TaskRecord inTask) {
         // Refuse possible leaked file descriptors
         if (intent != null && intent.hasFileDescriptors()) {
@@ -783,7 +781,8 @@
             } else {
                 stack = container.mStack;
             }
-            stack.mConfigWillChange = config != null && mService.mConfiguration.diff(config) != 0;
+            stack.mConfigWillChange = globalConfig != null
+                    && mService.mGlobalConfiguration.diff(globalConfig) != 0;
             if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
                     "Starting activity when config will change = " + stack.mConfigWillChange);
 
@@ -872,7 +871,7 @@
                 stack.mConfigWillChange = false;
                 if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
                         "Updating to new configuration after starting activity.");
-                mService.updateConfigurationLocked(config, null, false);
+                mService.updateConfigurationLocked(globalConfig, null, false);
             }
 
             if (outResult != null) {
diff --git a/services/core/java/com/android/server/am/CompatModePackages.java b/services/core/java/com/android/server/am/CompatModePackages.java
index a54df4b..0b282ed 100644
--- a/services/core/java/com/android/server/am/CompatModePackages.java
+++ b/services/core/java/com/android/server/am/CompatModePackages.java
@@ -197,8 +197,8 @@
     }
 
     public CompatibilityInfo compatibilityInfoForPackageLocked(ApplicationInfo ai) {
-        CompatibilityInfo ci = new CompatibilityInfo(ai, mService.mConfiguration.screenLayout,
-                mService.mConfiguration.smallestScreenWidthDp,
+        CompatibilityInfo ci = new CompatibilityInfo(ai, mService.mGlobalConfiguration.screenLayout,
+                mService.mGlobalConfiguration.smallestScreenWidthDp,
                 (getPackageFlags(ai.packageName)&COMPAT_FLAG_ENABLED) != 0);
         //Slog.i(TAG, "*********** COMPAT FOR PKG " + ai.packageName + ": " + ci);
         return ci;
@@ -207,8 +207,8 @@
     public int computeCompatModeLocked(ApplicationInfo ai) {
         boolean enabled = (getPackageFlags(ai.packageName)&COMPAT_FLAG_ENABLED) != 0;
         CompatibilityInfo info = new CompatibilityInfo(ai,
-                mService.mConfiguration.screenLayout,
-                mService.mConfiguration.smallestScreenWidthDp, enabled);
+                mService.mGlobalConfiguration.screenLayout,
+                mService.mGlobalConfiguration.smallestScreenWidthDp, enabled);
         if (info.alwaysSupportsScreen()) {
             return ActivityManager.COMPAT_MODE_NEVER;
         }
@@ -408,8 +408,8 @@
             out.startTag(null, "compat-packages");
 
             final IPackageManager pm = AppGlobals.getPackageManager();
-            final int screenLayout = mService.mConfiguration.screenLayout;
-            final int smallestScreenWidthDp = mService.mConfiguration.smallestScreenWidthDp;
+            final int screenLayout = mService.mGlobalConfiguration.screenLayout;
+            final int smallestScreenWidthDp = mService.mGlobalConfiguration.smallestScreenWidthDp;
             final Iterator<Map.Entry<String, Integer>> it = pkgs.entrySet().iterator();
             while (it.hasNext()) {
                 Map.Entry<String, Integer> entry = it.next();
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 0745a85..013d61b 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -271,6 +271,7 @@
     // This number will be assigned when we evaluate OOM scores for all visible tasks.
     int mLayerRank = -1;
 
+    /** Contains configurations settings that are different from the parent's configuration. */
     Configuration mOverrideConfig = Configuration.EMPTY;
 
     TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent,
@@ -575,7 +576,7 @@
      * @return whether the thumbnail was set
      */
     boolean setLastThumbnailLocked(Bitmap thumbnail) {
-        final Configuration serviceConfig = mService.mConfiguration;
+        final Configuration serviceConfig = mService.mGlobalConfiguration;
         int taskWidth = 0;
         int taskHeight = 0;
         if (mBounds != null) {
@@ -1453,9 +1454,9 @@
     /**
      * Update task's override configuration based on the bounds.
      * @param bounds The bounds of the task.
-     * @return Update configuration or null if there is no change.
+     * @return True if the override configuration was updated.
      */
-    Configuration updateOverrideConfiguration(Rect bounds) {
+    boolean updateOverrideConfiguration(Rect bounds) {
         return updateOverrideConfiguration(bounds, null /* insetBounds */);
     }
 
@@ -1465,11 +1466,11 @@
      * @param insetBounds The bounds used to calculate the system insets, which is used here to
      *                    subtract the navigation bar/status bar size from the screen size reported
      *                    to the application. See {@link IActivityManager#resizeDockedStack}.
-     * @return Update configuration or null if there is no change.
+     * @return True if the override configuration was updated.
      */
-    Configuration updateOverrideConfiguration(Rect bounds, @Nullable Rect insetBounds) {
+    boolean updateOverrideConfiguration(Rect bounds, @Nullable Rect insetBounds) {
         if (Objects.equals(mBounds, bounds)) {
-            return null;
+            return false;
         }
         final Configuration oldConfig = mOverrideConfig;
         final boolean oldFullscreen = mFullscreen;
@@ -1500,7 +1501,7 @@
             mService.mStackSupervisor.scheduleReportMultiWindowModeChanged(this);
         }
 
-        return !mOverrideConfig.equals(oldConfig) ? mOverrideConfig : null;
+        return !mOverrideConfig.equals(oldConfig);
     }
 
     private void subtractNonDecorInsets(Rect inOutBounds, Rect inInsetBounds,
@@ -1538,7 +1539,7 @@
 
         // For calculating screenWidthDp, screenWidthDp, we use the stable inset screen area,
         // i.e. the screen area without the system bars.
-        final Configuration serviceConfig = mService.mConfiguration;
+        final Configuration serviceConfig = mService.mGlobalConfiguration;
         final Configuration config = new Configuration(Configuration.EMPTY);
         // TODO(multidisplay): Update Dp to that of display stack is on.
         final float density = serviceConfig.densityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE;
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 9d29a22..00b315d 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -718,7 +718,7 @@
 
         if (mTask.mPreparedFrozenMergedConfig.equals(Configuration.EMPTY)) {
             // We didn't call prepareFreezingBounds on the task, so use the current value.
-            final Configuration config = new Configuration(mService.mCurConfiguration);
+            final Configuration config = new Configuration(mService.mGlobalConfiguration);
             config.updateFrom(mTask.mOverrideConfig);
             mFrozenMergedConfig.offer(config);
         } else {
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 155c46f..3cb6a37 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -240,7 +240,8 @@
             // Apps and their containers are not allowed to specify an orientation while the docked
             // or freeform stack is visible...except for the home stack/task if the docked stack is
             // minimized and it actually set something.
-            if (mHomeStack.isVisible() && mDividerControllerLocked.isMinimizedDock()) {
+            if (mHomeStack != null && mHomeStack.isVisible()
+                    && mDividerControllerLocked.isMinimizedDock()) {
                 final int orientation = mHomeStack.getOrientation();
                 if (orientation != SCREEN_ORIENTATION_UNSET) {
                     return orientation;
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index 0f5b042..573eca1 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -153,7 +153,7 @@
         // If the bounds are fullscreen, return the value of the fullscreen configuration
         if (bounds == null || (bounds.left == 0 && bounds.top == 0
                 && bounds.right == di.logicalWidth && bounds.bottom == di.logicalHeight)) {
-            return mService.mCurConfiguration.smallestScreenWidthDp;
+            return mService.mGlobalConfiguration.smallestScreenWidthDp;
         }
         final int baseDisplayWidth = mDisplayContent.mBaseDisplayWidth;
         final int baseDisplayHeight = mDisplayContent.mBaseDisplayHeight;
@@ -190,7 +190,7 @@
     }
 
     private void initSnapAlgorithmForRotations() {
-        final Configuration baseConfig = mService.mCurConfiguration;
+        final Configuration baseConfig = mService.mGlobalConfiguration;
 
         // Initialize the snap algorithms for all 4 screen orientations.
         final Configuration config = new Configuration();
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 5c6cb6b..2d647f8d 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -74,8 +74,10 @@
     // Whether mBounds is fullscreen
     private boolean mFullscreen = true;
 
-    // Contains configurations settings that are different from the global configuration due to
-    // stack specific operations. E.g. {@link #setBounds}.
+    /**
+     * Contains configurations settings that are different from the parent configuration due to
+     * stack specific operations. E.g. {@link #setBounds}.
+     */
     Configuration mOverrideConfig = Configuration.EMPTY;
 
     // For comparison with DisplayContent bounds.
@@ -96,13 +98,13 @@
     private boolean mIsOnTopLauncher;
 
     Task(int taskId, TaskStack stack, int userId, WindowManagerService service, Rect bounds,
-            Configuration config, boolean isOnTopLauncher) {
+            Configuration overrideConfig, boolean isOnTopLauncher) {
         mTaskId = taskId;
         mStack = stack;
         mUserId = userId;
         mService = service;
         mIsOnTopLauncher = isOnTopLauncher;
-        setBounds(bounds, config);
+        setBounds(bounds, overrideConfig);
     }
 
     DisplayContent getDisplayContent() {
@@ -212,15 +214,15 @@
     }
 
     /** Set the task bounds. Passing in null sets the bounds to fullscreen. */
-    private int setBounds(Rect bounds, Configuration config) {
-        if (config == null) {
-            config = Configuration.EMPTY;
+    private int setBounds(Rect bounds, Configuration overrideConfig) {
+        if (overrideConfig == null) {
+            overrideConfig = Configuration.EMPTY;
         }
-        if (bounds == null && !Configuration.EMPTY.equals(config)) {
+        if (bounds == null && !Configuration.EMPTY.equals(overrideConfig)) {
             throw new IllegalArgumentException("null bounds but non empty configuration: "
-                    + config);
+                    + overrideConfig);
         }
-        if (bounds != null && Configuration.EMPTY.equals(config)) {
+        if (bounds != null && Configuration.EMPTY.equals(overrideConfig)) {
             throw new IllegalArgumentException("non null bounds, but empty configuration");
         }
         boolean oldFullscreen = mFullscreen;
@@ -257,7 +259,7 @@
         if (displayContent != null) {
             displayContent.mDimLayerController.updateDimLayer(this);
         }
-        mOverrideConfig = mFullscreen ? Configuration.EMPTY : config;
+        mOverrideConfig = mFullscreen ? Configuration.EMPTY : overrideConfig;
         return boundsChange;
     }
 
@@ -302,12 +304,8 @@
         return mHomeTask;
     }
 
-    private boolean inCropWindowsResizeMode() {
-        return !mHomeTask && !isResizeable() && mResizeMode == RESIZE_MODE_CROP_WINDOWS;
-    }
-
-    boolean resizeLocked(Rect bounds, Configuration configuration, boolean forced) {
-        int boundsChanged = setBounds(bounds, configuration);
+    boolean resizeLocked(Rect bounds, Configuration overrideConfig, boolean forced) {
+        int boundsChanged = setBounds(bounds, overrideConfig);
         if (forced) {
             boundsChanged |= BOUNDS_CHANGE_SIZE;
         }
@@ -328,7 +326,7 @@
      */
     void prepareFreezingBounds() {
         mPreparedFrozenBounds.set(mBounds);
-        mPreparedFrozenMergedConfig.setTo(mService.mCurConfiguration);
+        mPreparedFrozenMergedConfig.setTo(mService.mGlobalConfiguration);
         mPreparedFrozenMergedConfig.updateFrom(mOverrideConfig);
     }
 
diff --git a/services/core/java/com/android/server/wm/TaskPositioner.java b/services/core/java/com/android/server/wm/TaskPositioner.java
index 5c321a1..c097128 100644
--- a/services/core/java/com/android/server/wm/TaskPositioner.java
+++ b/services/core/java/com/android/server/wm/TaskPositioner.java
@@ -478,7 +478,7 @@
     private int getDimSide(int x) {
         if (mTask.mStack.mStackId != FREEFORM_WORKSPACE_STACK_ID
                 || !mTask.mStack.isFullscreen()
-                || mService.mCurConfiguration.orientation != ORIENTATION_LANDSCAPE) {
+                || mService.mGlobalConfiguration.orientation != ORIENTATION_LANDSCAPE) {
             return CTRL_NONE;
         }
 
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index 25f3c0a..0c1980f 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -468,7 +468,7 @@
 
         // Snap the position to a target.
         final int rotation = displayInfo.rotation;
-        final int orientation = mService.mCurConfiguration.orientation;
+        final int orientation = mService.mGlobalConfiguration.orientation;
         mService.mPolicy.getStableInsetsLw(rotation, displayWidth, displayHeight, outBounds);
         final DividerSnapAlgorithm algorithm = new DividerSnapAlgorithm(
                 mService.mContext.getResources(), displayWidth, displayHeight,
@@ -720,7 +720,7 @@
                     di.logicalWidth,
                     di.logicalHeight,
                     dockDividerWidth,
-                    mService.mCurConfiguration.orientation == ORIENTATION_PORTRAIT,
+                    mService.mGlobalConfiguration.orientation == ORIENTATION_PORTRAIT,
                     mTmpRect2).getMiddleTarget().position;
 
             if (dockOnTopOrLeft) {
@@ -1186,7 +1186,7 @@
             return DOCKED_INVALID;
         }
         mDisplayContent.getLogicalDisplayRect(mTmpRect);
-        final int orientation = mService.mCurConfiguration.orientation;
+        final int orientation = mService.mGlobalConfiguration.orientation;
         return getDockSideUnchecked(bounds, mTmpRect, orientation);
     }
 
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 39544c0..03d80e9 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -170,7 +170,6 @@
 
 import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
 import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
-import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
 import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
 import static android.app.StatusBarManager.DISABLE_MASK;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;
@@ -216,7 +215,6 @@
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
-import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_ORIENTATION;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_BOOT;
 import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_CONFIGURATION;
@@ -601,7 +599,11 @@
     // State while inside of layoutAndPlaceSurfacesLocked().
     boolean mFocusMayChange;
 
-    Configuration mCurConfiguration = new Configuration();
+    /**
+     * Current global configuration information. Contains general settings for the entire system,
+     * corresponds to the configuration of the default display.
+     */
+    Configuration mGlobalConfiguration = new Configuration();
 
     // This is held as long as we have the screen frozen, to give us time to
     // perform a rotation animation when turning off shows the lock screen which
@@ -2692,9 +2694,10 @@
             if (DEBUG_APP_TRANSITIONS) Slog.d(TAG_WM, "Loading animation for app transition."
                     + " transit=" + AppTransition.appTransitionToString(transit) + " enter=" + enter
                     + " frame=" + frame + " insets=" + insets + " surfaceInsets=" + surfaceInsets);
-            Animation a = mAppTransition.loadAnimation(lp, transit, enter, mCurConfiguration.uiMode,
-                    mCurConfiguration.orientation, frame, displayFrame, insets, surfaceInsets,
-                    isVoiceInteraction, freeform, atoken.mTask.mTaskId);
+            Animation a = mAppTransition.loadAnimation(lp, transit, enter,
+                    mGlobalConfiguration.uiMode, mGlobalConfiguration.orientation, frame,
+                    displayFrame, insets, surfaceInsets, isVoiceInteraction, freeform,
+                    atoken.mTask.mTaskId);
             if (a != null) {
                 if (DEBUG_ANIM) logWithStack(TAG, "Loaded animation " + a + " for " + atoken);
                 final int containingWidth = frame.width();
@@ -2785,7 +2788,7 @@
     }
 
     private Task createTaskLocked(int taskId, int stackId, int userId, AppWindowToken atoken,
-            Rect bounds, Configuration config, boolean isOnTopLauncher) {
+            Rect bounds, Configuration overrideConfig, boolean isOnTopLauncher) {
         if (DEBUG_STACK) Slog.i(TAG_WM, "createTaskLocked: taskId=" + taskId + " stackId=" + stackId
                 + " atoken=" + atoken + " bounds=" + bounds);
         final TaskStack stack = mStackIdToStack.get(stackId);
@@ -2793,7 +2796,7 @@
             throw new IllegalArgumentException("addAppToken: invalid stackId=" + stackId);
         }
         EventLog.writeEvent(EventLogTags.WM_TASK_CREATED, taskId, stackId);
-        Task task = new Task(taskId, stack, userId, this, bounds, config, isOnTopLauncher);
+        Task task = new Task(taskId, stack, userId, this, bounds, overrideConfig, isOnTopLauncher);
         mTaskIdToTask.put(taskId, task);
         stack.addTask(task, !atoken.mLaunchTaskBehind /* toTop */, atoken.showForAllUsers);
         return task;
@@ -2803,9 +2806,9 @@
     public void addAppToken(int addPos, IApplicationToken token, int taskId, int stackId,
             int requestedOrientation, boolean fullscreen, boolean showForAllUsers, int userId,
             int configChanges, boolean voiceInteraction, boolean launchTaskBehind,
-            Rect taskBounds, Configuration config, int taskResizeMode, boolean alwaysFocusable,
-            boolean homeTask, int targetSdkVersion, int rotationAnimationHint,
-            boolean isOnTopLauncher) {
+            Rect taskBounds, Configuration overrideConfig, int taskResizeMode,
+            boolean alwaysFocusable, boolean homeTask, int targetSdkVersion,
+            int rotationAnimationHint, boolean isOnTopLauncher) {
         if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
                 "addAppToken()")) {
             throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
@@ -2847,7 +2850,7 @@
 
             Task task = mTaskIdToTask.get(taskId);
             if (task == null) {
-                task = createTaskLocked(taskId, stackId, userId, atoken, taskBounds, config,
+                task = createTaskLocked(taskId, stackId, userId, atoken, taskBounds, overrideConfig,
                         isOnTopLauncher);
             }
             task.addAppToken(addPos, atoken, taskResizeMode, homeTask);
@@ -2860,7 +2863,8 @@
 
     @Override
     public void setAppTask(IBinder token, int taskId, int stackId, Rect taskBounds,
-            Configuration config, int taskResizeMode, boolean homeTask, boolean isOnTopLauncher) {
+            Configuration overrideConfig, int taskResizeMode, boolean homeTask,
+            boolean isOnTopLauncher) {
         if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
                 "setAppTask()")) {
             throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
@@ -2878,7 +2882,7 @@
             Task newTask = mTaskIdToTask.get(taskId);
             if (newTask == null) {
                 newTask = createTaskLocked(
-                        taskId, stackId, oldTask.mUserId, atoken, taskBounds, config,
+                        taskId, stackId, oldTask.mUserId, atoken, taskBounds, overrideConfig,
                         isOnTopLauncher);
             }
             newTask.addAppToken(Integer.MAX_VALUE /* at top */, atoken, taskResizeMode, homeTask);
@@ -3068,12 +3072,12 @@
                 mWaitingForConfig = false;
                 mLastFinishedFreezeSource = "new-config";
             }
-            boolean configChanged = mCurConfiguration.diff(config) != 0;
+            boolean configChanged = mGlobalConfiguration.diff(config) != 0;
             if (!configChanged) {
                 return null;
             }
             prepareFreezingAllTaskBounds();
-            mCurConfiguration = new Configuration(config);
+            mGlobalConfiguration = new Configuration(config);
             return onConfigurationChanged();
         }
     }
@@ -4163,7 +4167,7 @@
      * Returns a {@link Configuration} object that contains configurations settings
      * that should be overridden due to the operation.
      */
-    public void resizeTask(int taskId, Rect bounds, Configuration configuration,
+    public void resizeTask(int taskId, Rect bounds, Configuration overrideConfig,
             boolean relayout, boolean forced) {
         synchronized (mWindowMap) {
             Task task = mTaskIdToTask.get(taskId);
@@ -4172,7 +4176,7 @@
                         + " not found.");
             }
 
-            if (task.resizeLocked(bounds, configuration, forced) && relayout) {
+            if (task.resizeLocked(bounds, overrideConfig, forced) && relayout) {
                 task.getDisplayContent().layoutNeeded = true;
                 mWindowPlacerLocked.performSurfacePlacement();
             }
@@ -5707,7 +5711,7 @@
         // the top of the method, the caller is obligated to call computeNewConfigurationLocked().
         // By updating the Display info here it will be available to
         // computeScreenConfigurationLocked later.
-        updateDisplayAndOrientationLocked(mCurConfiguration.uiMode);
+        updateDisplayAndOrientationLocked(mGlobalConfiguration.uiMode);
 
         final DisplayInfo displayInfo = displayContent.getDisplayInfo();
         if (!inTransaction) {
@@ -6257,9 +6261,9 @@
         return null;
     }
 
-    /*
-     * Instruct the Activity Manager to fetch the current configuration and broadcast
-     * that to config-changed listeners if appropriate.
+    /**
+     * Instruct the Activity Manager to fetch new configurations, update global configuration
+     * and broadcast changes to config-changed listeners if appropriate.
      */
     void sendNewConfiguration() {
         try {
@@ -8101,9 +8105,9 @@
 
         boolean configChanged = updateOrientationFromAppTokensLocked(false);
         mTempConfiguration.setToDefaults();
-        mTempConfiguration.updateFrom(mCurConfiguration);
+        mTempConfiguration.updateFrom(mGlobalConfiguration);
         computeScreenConfigurationLocked(mTempConfiguration);
-        configChanged |= mCurConfiguration.diff(mTempConfiguration) != 0;
+        configChanged |= mGlobalConfiguration.diff(mTempConfiguration) != 0;
 
         if (configChanged) {
             mWaitingForConfig = true;
@@ -8264,7 +8268,7 @@
             w.setReportResizeHints();
             boolean configChanged = w.isConfigChanged();
             if (DEBUG_CONFIGURATION && configChanged) {
-                Slog.v(TAG_WM, "Win " + w + " config changed: " + mCurConfiguration);
+                Slog.v(TAG_WM, "Win " + w + " config changed: " + mGlobalConfiguration);
             }
             final boolean dragResizingChanged = w.isDragResizeChanged()
                     && !w.isDragResizingChangeReported();
@@ -9271,7 +9275,7 @@
             }
         }
         pw.println();
-        pw.print("  mCurConfiguration="); pw.println(this.mCurConfiguration);
+        pw.print("  mGlobalConfiguration="); pw.println(mGlobalConfiguration);
         pw.print("  mHasPermanentDpad="); pw.println(mHasPermanentDpad);
         pw.print("  mCurrentFocus="); pw.println(mCurrentFocus);
         if (mLastFocus != mCurrentFocus) {
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index a917011..82aaba65 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1588,7 +1588,7 @@
     boolean isConfigChanged() {
         getMergedConfig(mTmpConfig);
 
-        // If the merged configuration is still empty, it means that we haven't issues the
+        // If the merged configuration is still empty, it means that we haven't issued the
         // configuration to the client yet and we need to return true so the configuration updates.
         boolean configChanged = mMergedConfiguration.equals(Configuration.EMPTY)
                 || mTmpConfig.diff(mMergedConfiguration) != 0;
@@ -2901,8 +2901,7 @@
         final Configuration overrideConfig = task != null
                 ? task.mOverrideConfig
                 : Configuration.EMPTY;
-        final Configuration serviceConfig = mService.mCurConfiguration;
-        outConfig.setTo(serviceConfig);
+        outConfig.setTo(mService.mGlobalConfiguration);
         if (overrideConfig != Configuration.EMPTY) {
             outConfig.updateFrom(overrideConfig);
         }
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index f128cf9..056a7a1 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -913,7 +913,7 @@
         }
 
         mService.mPolicy.beginLayoutLw(isDefaultDisplay, dw, dh, mService.mRotation,
-                mService.mCurConfiguration.uiMode);
+                mService.mGlobalConfiguration.uiMode);
         if (isDefaultDisplay) {
             // Not needed on non-default displays.
             mService.mSystemDecorLayer = mService.mPolicy.getSystemDecorLayerLw();
@@ -1639,8 +1639,8 @@
                 // synchronize its thumbnail surface with the surface for the
                 // open/close animation (only on the way down)
                 anim = mService.mAppTransition.createThumbnailAspectScaleAnimationLocked(appRect,
-                        insets, thumbnailHeader, taskId, mService.mCurConfiguration.uiMode,
-                        mService.mCurConfiguration.orientation);
+                        insets, thumbnailHeader, taskId, mService.mGlobalConfiguration.uiMode,
+                        mService.mGlobalConfiguration.orientation);
                 openingAppAnimator.thumbnailForceAboveLayer = Math.max(openingLayer, closingLayer);
                 openingAppAnimator.deferThumbnailDestruction =
                         !mService.mAppTransition.isNextThumbnailTransitionScaleUp();