From 92ab103cb666059d48eca9e79977cf559abdde0a Mon Sep 17 00:00:00 2001 From: Chong Zhang Date: Fri, 3 Jun 2016 17:43:10 -0700 Subject: [PATCH] Set fontScale in override config to be equal to global. The default fontScale in EMPTY config is 1.0. This will result in updateFrom always overriding the fontScale to 1.0 since it's non-zero. We can't set it to 0.0 either as that will make the override config not equal to EMPTY. The rest of the code doesn't work well with that. So here we always set the override fontScale to be idential to global. bug: 29113700 Change-Id: I1dbe507145b8190a9ae5e108948c833d4e037e1d --- services/core/java/com/android/server/am/TaskRecord.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java index 8932e4bbafc4..c84aaacd8aff 100644 --- a/services/core/java/com/android/server/am/TaskRecord.java +++ b/services/core/java/com/android/server/am/TaskRecord.java @@ -1537,6 +1537,11 @@ final class TaskRecord { ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE; + // Always set fontScale to be euqal to global. Can't set to 0, as that makes the override + // config not equal to EMPTY. Also can't set to 1, as Configuration.updateFrom will use + // the override scale as long as it's non-zero, and we'll always use 1. + config.fontScale = serviceConfig.fontScale; + // For calculating screen layout, we need to use the non-decor inset screen area for the // calculation for compatibility reasons, i.e. screen area without system bars that could // never go away in Honeycomb. @@ -1564,6 +1569,7 @@ final class TaskRecord { extracted.smallestScreenWidthDp = config.smallestScreenWidthDp; extracted.orientation = config.orientation; extracted.screenLayout = config.screenLayout; + extracted.fontScale = config.fontScale; return extracted; } @@ -1597,6 +1603,9 @@ final class TaskRecord { newScreenLayout = (newScreenLayout & ~SCREENLAYOUT_SIZE_MASK) | (overrideScreenLayout & SCREENLAYOUT_SIZE_MASK); mOverrideConfig.screenLayout = newScreenLayout; + // we never override the fontScale, however we need to copy over the global value + // so that the default 1.0 doesn't get applied as an override. + mOverrideConfig.fontScale = globalConfig.fontScale; } static Rect validateBounds(Rect bounds) { -- 2.11.0