Loading core/java/android/content/res/Configuration.java +31 −21 Original line number Diff line number Diff line Loading @@ -1139,78 +1139,88 @@ public final class Configuration implements Parcelable, Comparable<Configuration * PackageManager.ActivityInfo.CONFIG_LAYOUT_DIRECTION}. */ public int diff(Configuration delta) { return diff(delta, false /* compareUndefined */); } /** * Variation of {@link #diff(Configuration)} with an option to skip checks for undefined values. * * @hide */ public int diff(Configuration delta, boolean compareUndefined) { int changed = 0; if (delta.fontScale > 0 && fontScale != delta.fontScale) { if ((compareUndefined || delta.fontScale > 0) && fontScale != delta.fontScale) { changed |= ActivityInfo.CONFIG_FONT_SCALE; } if (delta.mcc != 0 && mcc != delta.mcc) { if ((compareUndefined || delta.mcc != 0) && mcc != delta.mcc) { changed |= ActivityInfo.CONFIG_MCC; } if (delta.mnc != 0 && mnc != delta.mnc) { if ((compareUndefined || delta.mnc != 0) && mnc != delta.mnc) { changed |= ActivityInfo.CONFIG_MNC; } fixUpLocaleList(); delta.fixUpLocaleList(); if (!delta.mLocaleList.isEmpty() && !mLocaleList.equals(delta.mLocaleList)) { if ((compareUndefined || !delta.mLocaleList.isEmpty()) && !mLocaleList.equals(delta.mLocaleList)) { changed |= ActivityInfo.CONFIG_LOCALE; changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION; } final int deltaScreenLayoutDir = delta.screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK; if (deltaScreenLayoutDir != SCREENLAYOUT_LAYOUTDIR_UNDEFINED && deltaScreenLayoutDir != (screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK)) { if ((compareUndefined || deltaScreenLayoutDir != SCREENLAYOUT_LAYOUTDIR_UNDEFINED) && deltaScreenLayoutDir != (screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK)) { changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION; } if (delta.touchscreen != TOUCHSCREEN_UNDEFINED if ((compareUndefined || delta.touchscreen != TOUCHSCREEN_UNDEFINED) && touchscreen != delta.touchscreen) { changed |= ActivityInfo.CONFIG_TOUCHSCREEN; } if (delta.keyboard != KEYBOARD_UNDEFINED if ((compareUndefined || delta.keyboard != KEYBOARD_UNDEFINED) && keyboard != delta.keyboard) { changed |= ActivityInfo.CONFIG_KEYBOARD; } if (delta.keyboardHidden != KEYBOARDHIDDEN_UNDEFINED if ((compareUndefined || delta.keyboardHidden != KEYBOARDHIDDEN_UNDEFINED) && keyboardHidden != delta.keyboardHidden) { changed |= ActivityInfo.CONFIG_KEYBOARD_HIDDEN; } if (delta.hardKeyboardHidden != HARDKEYBOARDHIDDEN_UNDEFINED if ((compareUndefined || delta.hardKeyboardHidden != HARDKEYBOARDHIDDEN_UNDEFINED) && hardKeyboardHidden != delta.hardKeyboardHidden) { changed |= ActivityInfo.CONFIG_KEYBOARD_HIDDEN; } if (delta.navigation != NAVIGATION_UNDEFINED if ((compareUndefined || delta.navigation != NAVIGATION_UNDEFINED) && navigation != delta.navigation) { changed |= ActivityInfo.CONFIG_NAVIGATION; } if (delta.navigationHidden != NAVIGATIONHIDDEN_UNDEFINED if ((compareUndefined || delta.navigationHidden != NAVIGATIONHIDDEN_UNDEFINED) && navigationHidden != delta.navigationHidden) { changed |= ActivityInfo.CONFIG_KEYBOARD_HIDDEN; } if (delta.orientation != ORIENTATION_UNDEFINED if ((compareUndefined || delta.orientation != ORIENTATION_UNDEFINED) && orientation != delta.orientation) { changed |= ActivityInfo.CONFIG_ORIENTATION; } if (getScreenLayoutNoDirection(delta.screenLayout) != (SCREENLAYOUT_SIZE_UNDEFINED | SCREENLAYOUT_LONG_UNDEFINED) if ((compareUndefined || getScreenLayoutNoDirection(delta.screenLayout) != (SCREENLAYOUT_SIZE_UNDEFINED | SCREENLAYOUT_LONG_UNDEFINED)) && getScreenLayoutNoDirection(screenLayout) != getScreenLayoutNoDirection(delta.screenLayout)) { changed |= ActivityInfo.CONFIG_SCREEN_LAYOUT; } if (delta.uiMode != (UI_MODE_TYPE_UNDEFINED|UI_MODE_NIGHT_UNDEFINED) if ((compareUndefined || delta.uiMode != (UI_MODE_TYPE_UNDEFINED|UI_MODE_NIGHT_UNDEFINED)) && uiMode != delta.uiMode) { changed |= ActivityInfo.CONFIG_UI_MODE; } if (delta.screenWidthDp != SCREEN_WIDTH_DP_UNDEFINED if ((compareUndefined || delta.screenWidthDp != SCREEN_WIDTH_DP_UNDEFINED) && screenWidthDp != delta.screenWidthDp) { changed |= ActivityInfo.CONFIG_SCREEN_SIZE; } if (delta.screenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED if ((compareUndefined || delta.screenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED) && screenHeightDp != delta.screenHeightDp) { changed |= ActivityInfo.CONFIG_SCREEN_SIZE; } if (delta.smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED if ((compareUndefined || delta.smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED) && smallestScreenWidthDp != delta.smallestScreenWidthDp) { changed |= ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE; } if (delta.densityDpi != DENSITY_DPI_UNDEFINED if ((compareUndefined || delta.densityDpi != DENSITY_DPI_UNDEFINED) && densityDpi != delta.densityDpi) { changed |= ActivityInfo.CONFIG_DENSITY; } Loading services/core/java/com/android/server/am/ActivityManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -19037,8 +19037,8 @@ public final class ActivityManagerService extends ActivityManagerNative } /** * Decide based on the configuration whether we should shouw the ANR, * crash, etc dialogs. The idea is that if there is no affordence to * Decide based on the configuration whether we should show the ANR, * crash, etc dialogs. The idea is that if there is no affordance to * press the on-screen buttons, or the user experience would be more * greatly impacted than the crash itself, we shouldn't show the dialog. * services/core/java/com/android/server/am/ActivityStack.java +1 −43 Original line number Diff line number Diff line Loading @@ -4673,7 +4673,7 @@ final class ActivityStack { // that has come back from the app after going idle. In that case // we just want to leave the official config object now in the // activity and do nothing else. int taskChanges = oldTaskOverride.diff(taskConfig); int taskChanges = oldTaskOverride.diff(taskConfig, true /* skipUndefined */); // We don't want to use size changes if they don't cross boundaries that are important to // the app. if ((taskChanges & CONFIG_SCREEN_SIZE) != 0) { Loading @@ -4692,48 +4692,6 @@ final class ActivityStack { taskChanges &= ~CONFIG_SMALLEST_SCREEN_SIZE; } } return catchConfigChangesFromUnset(taskConfig, oldTaskOverride, taskChanges); } private static int catchConfigChangesFromUnset(Configuration taskConfig, Configuration oldTaskOverride, int taskChanges) { if (taskChanges == 0) { // {@link Configuration#diff} doesn't catch changes from unset values. // Check for changes we care about. if (oldTaskOverride.orientation != taskConfig.orientation) { taskChanges |= CONFIG_ORIENTATION; } // We want to explicitly track situations where the size configuration goes from // undefined to defined. We don't care about crossing the threshold in that case, // because there is no threshold. final int oldHeight = oldTaskOverride.screenHeightDp; final int newHeight = taskConfig.screenHeightDp; final int undefinedHeight = Configuration.SCREEN_HEIGHT_DP_UNDEFINED; if ((oldHeight == undefinedHeight && newHeight != undefinedHeight) || (oldHeight != undefinedHeight && newHeight == undefinedHeight)) { taskChanges |= CONFIG_SCREEN_SIZE; } final int oldWidth = oldTaskOverride.screenWidthDp; final int newWidth = taskConfig.screenWidthDp; final int undefinedWidth = Configuration.SCREEN_WIDTH_DP_UNDEFINED; if ((oldWidth == undefinedWidth && newWidth != undefinedWidth) || (oldWidth != undefinedWidth && newWidth == undefinedWidth)) { taskChanges |= CONFIG_SCREEN_SIZE; } final int oldSmallest = oldTaskOverride.smallestScreenWidthDp; final int newSmallest = taskConfig.smallestScreenWidthDp; final int undefinedSmallest = Configuration.SMALLEST_SCREEN_WIDTH_DP_UNDEFINED; if ((oldSmallest == undefinedSmallest && newSmallest != undefinedSmallest) || (oldSmallest != undefinedSmallest && newSmallest == undefinedSmallest)) { taskChanges |= CONFIG_SMALLEST_SCREEN_SIZE; } final int oldLayout = oldTaskOverride.screenLayout; final int newLayout = taskConfig.screenLayout; if ((oldLayout == SCREENLAYOUT_UNDEFINED && newLayout != SCREENLAYOUT_UNDEFINED) || (oldLayout != SCREENLAYOUT_UNDEFINED && newLayout == SCREENLAYOUT_UNDEFINED)) { taskChanges |= CONFIG_SCREEN_LAYOUT; } } return taskChanges; } Loading services/core/java/com/android/server/am/TaskRecord.java +0 −1 Original line number Diff line number Diff line Loading @@ -1580,7 +1580,6 @@ final class TaskRecord { extracted.smallestScreenWidthDp = config.smallestScreenWidthDp; extracted.orientation = config.orientation; extracted.screenLayout = config.screenLayout; extracted.fontScale = config.fontScale; return extracted; } Loading services/core/java/com/android/server/wm/AppWindowToken.java +2 −1 Original line number Diff line number Diff line Loading @@ -736,7 +736,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } else { mFrozenMergedConfig.offer(new Configuration(mTask.mPreparedFrozenMergedConfig)); } mTask.mPreparedFrozenMergedConfig.setToDefaults(); // Calling unset() to make it equal to Configuration.EMPTY. mTask.mPreparedFrozenMergedConfig.unset(); } /** Loading Loading
core/java/android/content/res/Configuration.java +31 −21 Original line number Diff line number Diff line Loading @@ -1139,78 +1139,88 @@ public final class Configuration implements Parcelable, Comparable<Configuration * PackageManager.ActivityInfo.CONFIG_LAYOUT_DIRECTION}. */ public int diff(Configuration delta) { return diff(delta, false /* compareUndefined */); } /** * Variation of {@link #diff(Configuration)} with an option to skip checks for undefined values. * * @hide */ public int diff(Configuration delta, boolean compareUndefined) { int changed = 0; if (delta.fontScale > 0 && fontScale != delta.fontScale) { if ((compareUndefined || delta.fontScale > 0) && fontScale != delta.fontScale) { changed |= ActivityInfo.CONFIG_FONT_SCALE; } if (delta.mcc != 0 && mcc != delta.mcc) { if ((compareUndefined || delta.mcc != 0) && mcc != delta.mcc) { changed |= ActivityInfo.CONFIG_MCC; } if (delta.mnc != 0 && mnc != delta.mnc) { if ((compareUndefined || delta.mnc != 0) && mnc != delta.mnc) { changed |= ActivityInfo.CONFIG_MNC; } fixUpLocaleList(); delta.fixUpLocaleList(); if (!delta.mLocaleList.isEmpty() && !mLocaleList.equals(delta.mLocaleList)) { if ((compareUndefined || !delta.mLocaleList.isEmpty()) && !mLocaleList.equals(delta.mLocaleList)) { changed |= ActivityInfo.CONFIG_LOCALE; changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION; } final int deltaScreenLayoutDir = delta.screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK; if (deltaScreenLayoutDir != SCREENLAYOUT_LAYOUTDIR_UNDEFINED && deltaScreenLayoutDir != (screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK)) { if ((compareUndefined || deltaScreenLayoutDir != SCREENLAYOUT_LAYOUTDIR_UNDEFINED) && deltaScreenLayoutDir != (screenLayout & SCREENLAYOUT_LAYOUTDIR_MASK)) { changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION; } if (delta.touchscreen != TOUCHSCREEN_UNDEFINED if ((compareUndefined || delta.touchscreen != TOUCHSCREEN_UNDEFINED) && touchscreen != delta.touchscreen) { changed |= ActivityInfo.CONFIG_TOUCHSCREEN; } if (delta.keyboard != KEYBOARD_UNDEFINED if ((compareUndefined || delta.keyboard != KEYBOARD_UNDEFINED) && keyboard != delta.keyboard) { changed |= ActivityInfo.CONFIG_KEYBOARD; } if (delta.keyboardHidden != KEYBOARDHIDDEN_UNDEFINED if ((compareUndefined || delta.keyboardHidden != KEYBOARDHIDDEN_UNDEFINED) && keyboardHidden != delta.keyboardHidden) { changed |= ActivityInfo.CONFIG_KEYBOARD_HIDDEN; } if (delta.hardKeyboardHidden != HARDKEYBOARDHIDDEN_UNDEFINED if ((compareUndefined || delta.hardKeyboardHidden != HARDKEYBOARDHIDDEN_UNDEFINED) && hardKeyboardHidden != delta.hardKeyboardHidden) { changed |= ActivityInfo.CONFIG_KEYBOARD_HIDDEN; } if (delta.navigation != NAVIGATION_UNDEFINED if ((compareUndefined || delta.navigation != NAVIGATION_UNDEFINED) && navigation != delta.navigation) { changed |= ActivityInfo.CONFIG_NAVIGATION; } if (delta.navigationHidden != NAVIGATIONHIDDEN_UNDEFINED if ((compareUndefined || delta.navigationHidden != NAVIGATIONHIDDEN_UNDEFINED) && navigationHidden != delta.navigationHidden) { changed |= ActivityInfo.CONFIG_KEYBOARD_HIDDEN; } if (delta.orientation != ORIENTATION_UNDEFINED if ((compareUndefined || delta.orientation != ORIENTATION_UNDEFINED) && orientation != delta.orientation) { changed |= ActivityInfo.CONFIG_ORIENTATION; } if (getScreenLayoutNoDirection(delta.screenLayout) != (SCREENLAYOUT_SIZE_UNDEFINED | SCREENLAYOUT_LONG_UNDEFINED) if ((compareUndefined || getScreenLayoutNoDirection(delta.screenLayout) != (SCREENLAYOUT_SIZE_UNDEFINED | SCREENLAYOUT_LONG_UNDEFINED)) && getScreenLayoutNoDirection(screenLayout) != getScreenLayoutNoDirection(delta.screenLayout)) { changed |= ActivityInfo.CONFIG_SCREEN_LAYOUT; } if (delta.uiMode != (UI_MODE_TYPE_UNDEFINED|UI_MODE_NIGHT_UNDEFINED) if ((compareUndefined || delta.uiMode != (UI_MODE_TYPE_UNDEFINED|UI_MODE_NIGHT_UNDEFINED)) && uiMode != delta.uiMode) { changed |= ActivityInfo.CONFIG_UI_MODE; } if (delta.screenWidthDp != SCREEN_WIDTH_DP_UNDEFINED if ((compareUndefined || delta.screenWidthDp != SCREEN_WIDTH_DP_UNDEFINED) && screenWidthDp != delta.screenWidthDp) { changed |= ActivityInfo.CONFIG_SCREEN_SIZE; } if (delta.screenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED if ((compareUndefined || delta.screenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED) && screenHeightDp != delta.screenHeightDp) { changed |= ActivityInfo.CONFIG_SCREEN_SIZE; } if (delta.smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED if ((compareUndefined || delta.smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED) && smallestScreenWidthDp != delta.smallestScreenWidthDp) { changed |= ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE; } if (delta.densityDpi != DENSITY_DPI_UNDEFINED if ((compareUndefined || delta.densityDpi != DENSITY_DPI_UNDEFINED) && densityDpi != delta.densityDpi) { changed |= ActivityInfo.CONFIG_DENSITY; } Loading
services/core/java/com/android/server/am/ActivityManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -19037,8 +19037,8 @@ public final class ActivityManagerService extends ActivityManagerNative } /** * Decide based on the configuration whether we should shouw the ANR, * crash, etc dialogs. The idea is that if there is no affordence to * Decide based on the configuration whether we should show the ANR, * crash, etc dialogs. The idea is that if there is no affordance to * press the on-screen buttons, or the user experience would be more * greatly impacted than the crash itself, we shouldn't show the dialog. *
services/core/java/com/android/server/am/ActivityStack.java +1 −43 Original line number Diff line number Diff line Loading @@ -4673,7 +4673,7 @@ final class ActivityStack { // that has come back from the app after going idle. In that case // we just want to leave the official config object now in the // activity and do nothing else. int taskChanges = oldTaskOverride.diff(taskConfig); int taskChanges = oldTaskOverride.diff(taskConfig, true /* skipUndefined */); // We don't want to use size changes if they don't cross boundaries that are important to // the app. if ((taskChanges & CONFIG_SCREEN_SIZE) != 0) { Loading @@ -4692,48 +4692,6 @@ final class ActivityStack { taskChanges &= ~CONFIG_SMALLEST_SCREEN_SIZE; } } return catchConfigChangesFromUnset(taskConfig, oldTaskOverride, taskChanges); } private static int catchConfigChangesFromUnset(Configuration taskConfig, Configuration oldTaskOverride, int taskChanges) { if (taskChanges == 0) { // {@link Configuration#diff} doesn't catch changes from unset values. // Check for changes we care about. if (oldTaskOverride.orientation != taskConfig.orientation) { taskChanges |= CONFIG_ORIENTATION; } // We want to explicitly track situations where the size configuration goes from // undefined to defined. We don't care about crossing the threshold in that case, // because there is no threshold. final int oldHeight = oldTaskOverride.screenHeightDp; final int newHeight = taskConfig.screenHeightDp; final int undefinedHeight = Configuration.SCREEN_HEIGHT_DP_UNDEFINED; if ((oldHeight == undefinedHeight && newHeight != undefinedHeight) || (oldHeight != undefinedHeight && newHeight == undefinedHeight)) { taskChanges |= CONFIG_SCREEN_SIZE; } final int oldWidth = oldTaskOverride.screenWidthDp; final int newWidth = taskConfig.screenWidthDp; final int undefinedWidth = Configuration.SCREEN_WIDTH_DP_UNDEFINED; if ((oldWidth == undefinedWidth && newWidth != undefinedWidth) || (oldWidth != undefinedWidth && newWidth == undefinedWidth)) { taskChanges |= CONFIG_SCREEN_SIZE; } final int oldSmallest = oldTaskOverride.smallestScreenWidthDp; final int newSmallest = taskConfig.smallestScreenWidthDp; final int undefinedSmallest = Configuration.SMALLEST_SCREEN_WIDTH_DP_UNDEFINED; if ((oldSmallest == undefinedSmallest && newSmallest != undefinedSmallest) || (oldSmallest != undefinedSmallest && newSmallest == undefinedSmallest)) { taskChanges |= CONFIG_SMALLEST_SCREEN_SIZE; } final int oldLayout = oldTaskOverride.screenLayout; final int newLayout = taskConfig.screenLayout; if ((oldLayout == SCREENLAYOUT_UNDEFINED && newLayout != SCREENLAYOUT_UNDEFINED) || (oldLayout != SCREENLAYOUT_UNDEFINED && newLayout == SCREENLAYOUT_UNDEFINED)) { taskChanges |= CONFIG_SCREEN_LAYOUT; } } return taskChanges; } Loading
services/core/java/com/android/server/am/TaskRecord.java +0 −1 Original line number Diff line number Diff line Loading @@ -1580,7 +1580,6 @@ final class TaskRecord { extracted.smallestScreenWidthDp = config.smallestScreenWidthDp; extracted.orientation = config.orientation; extracted.screenLayout = config.screenLayout; extracted.fontScale = config.fontScale; return extracted; } Loading
services/core/java/com/android/server/wm/AppWindowToken.java +2 −1 Original line number Diff line number Diff line Loading @@ -736,7 +736,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } else { mFrozenMergedConfig.offer(new Configuration(mTask.mPreparedFrozenMergedConfig)); } mTask.mPreparedFrozenMergedConfig.setToDefaults(); // Calling unset() to make it equal to Configuration.EMPTY. mTask.mPreparedFrozenMergedConfig.unset(); } /** Loading