Merge "Compute config based on original override for inherited letterbox" into udc-dev
This commit is contained in:
@@ -1597,11 +1597,10 @@ final class LetterboxUiController {
|
|||||||
inheritConfiguration(firstOpaqueActivityBeneath);
|
inheritConfiguration(firstOpaqueActivityBeneath);
|
||||||
mLetterboxConfigListener = WindowContainer.overrideConfigurationPropagation(
|
mLetterboxConfigListener = WindowContainer.overrideConfigurationPropagation(
|
||||||
mActivityRecord, firstOpaqueActivityBeneath,
|
mActivityRecord, firstOpaqueActivityBeneath,
|
||||||
(opaqueConfig, transparentConfig) -> {
|
(opaqueConfig, transparentOverrideConfig) -> {
|
||||||
final Configuration mutatedConfiguration =
|
resetTranslucentOverrideConfig(transparentOverrideConfig);
|
||||||
fromOriginalTranslucentConfig(transparentConfig);
|
|
||||||
final Rect parentBounds = parent.getWindowConfiguration().getBounds();
|
final Rect parentBounds = parent.getWindowConfiguration().getBounds();
|
||||||
final Rect bounds = mutatedConfiguration.windowConfiguration.getBounds();
|
final Rect bounds = transparentOverrideConfig.windowConfiguration.getBounds();
|
||||||
final Rect letterboxBounds = opaqueConfig.windowConfiguration.getBounds();
|
final Rect letterboxBounds = opaqueConfig.windowConfiguration.getBounds();
|
||||||
// We cannot use letterboxBounds directly here because the position relies on
|
// We cannot use letterboxBounds directly here because the position relies on
|
||||||
// letterboxing. Using letterboxBounds directly, would produce a double offset.
|
// letterboxing. Using letterboxBounds directly, would produce a double offset.
|
||||||
@@ -1610,9 +1609,9 @@ final class LetterboxUiController {
|
|||||||
parentBounds.top + letterboxBounds.height());
|
parentBounds.top + letterboxBounds.height());
|
||||||
// We need to initialize appBounds to avoid NPE. The actual value will
|
// We need to initialize appBounds to avoid NPE. The actual value will
|
||||||
// be set ahead when resolving the Configuration for the activity.
|
// be set ahead when resolving the Configuration for the activity.
|
||||||
mutatedConfiguration.windowConfiguration.setAppBounds(new Rect());
|
transparentOverrideConfig.windowConfiguration.setAppBounds(new Rect());
|
||||||
inheritConfiguration(firstOpaqueActivityBeneath);
|
inheritConfiguration(firstOpaqueActivityBeneath);
|
||||||
return mutatedConfiguration;
|
return transparentOverrideConfig;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1691,20 +1690,16 @@ final class LetterboxUiController {
|
|||||||
true /* traverseTopToBottom */));
|
true /* traverseTopToBottom */));
|
||||||
}
|
}
|
||||||
|
|
||||||
// When overriding translucent activities configuration we need to keep some of the
|
/** Resets the screen size related fields so they can be resolved by requested bounds later. */
|
||||||
// original properties
|
private static void resetTranslucentOverrideConfig(Configuration config) {
|
||||||
private Configuration fromOriginalTranslucentConfig(Configuration translucentConfig) {
|
|
||||||
final Configuration configuration = new Configuration(translucentConfig);
|
|
||||||
// The values for the following properties will be defined during the configuration
|
// The values for the following properties will be defined during the configuration
|
||||||
// resolution in {@link ActivityRecord#resolveOverrideConfiguration} using the
|
// resolution in {@link ActivityRecord#resolveOverrideConfiguration} using the
|
||||||
// properties inherited from the first not finishing opaque activity beneath.
|
// properties inherited from the first not finishing opaque activity beneath.
|
||||||
configuration.orientation = ORIENTATION_UNDEFINED;
|
config.orientation = ORIENTATION_UNDEFINED;
|
||||||
configuration.screenWidthDp = configuration.compatScreenWidthDp = SCREEN_WIDTH_DP_UNDEFINED;
|
config.screenWidthDp = config.compatScreenWidthDp = SCREEN_WIDTH_DP_UNDEFINED;
|
||||||
configuration.screenHeightDp =
|
config.screenHeightDp = config.compatScreenHeightDp = SCREEN_HEIGHT_DP_UNDEFINED;
|
||||||
configuration.compatScreenHeightDp = SCREEN_HEIGHT_DP_UNDEFINED;
|
config.smallestScreenWidthDp = config.compatSmallestScreenWidthDp =
|
||||||
configuration.smallestScreenWidthDp =
|
SMALLEST_SCREEN_WIDTH_DP_UNDEFINED;
|
||||||
configuration.compatSmallestScreenWidthDp = SMALLEST_SCREEN_WIDTH_DP_UNDEFINED;
|
|
||||||
return configuration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void inheritConfiguration(ActivityRecord firstOpaque) {
|
private void inheritConfiguration(ActivityRecord firstOpaque) {
|
||||||
|
|||||||
@@ -4047,7 +4047,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
final Configuration mergedConfiguration =
|
final Configuration mergedConfiguration =
|
||||||
configurationMerger != null
|
configurationMerger != null
|
||||||
? configurationMerger.merge(mergedOverrideConfig,
|
? configurationMerger.merge(mergedOverrideConfig,
|
||||||
receiver.getConfiguration())
|
receiver.getRequestedOverrideConfiguration())
|
||||||
: supplier.getConfiguration();
|
: supplier.getConfiguration();
|
||||||
receiver.onRequestedOverrideConfigurationChanged(mergedConfiguration);
|
receiver.onRequestedOverrideConfigurationChanged(mergedConfiguration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.server.wm;
|
package com.android.server.wm;
|
||||||
|
|
||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||||
|
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
||||||
@@ -428,20 +429,24 @@ public class SizeCompatTests extends WindowTestsBase {
|
|||||||
.setLaunchedFromUid(mActivity.getUid())
|
.setLaunchedFromUid(mActivity.getUid())
|
||||||
.build();
|
.build();
|
||||||
doReturn(false).when(translucentActivity).fillsParent();
|
doReturn(false).when(translucentActivity).fillsParent();
|
||||||
WindowConfiguration translucentWinConf = translucentActivity.getWindowConfiguration();
|
final Configuration requestedConfig =
|
||||||
translucentActivity.setActivityType(ACTIVITY_TYPE_STANDARD);
|
translucentActivity.getRequestedOverrideConfiguration();
|
||||||
translucentActivity.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW);
|
final WindowConfiguration translucentWinConf = requestedConfig.windowConfiguration;
|
||||||
translucentActivity.setDisplayWindowingMode(WINDOWING_MODE_MULTI_WINDOW);
|
translucentWinConf.setActivityType(ACTIVITY_TYPE_STANDARD);
|
||||||
translucentActivity.setAlwaysOnTop(true);
|
translucentWinConf.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW);
|
||||||
|
translucentWinConf.setDisplayWindowingMode(WINDOWING_MODE_MULTI_WINDOW);
|
||||||
|
translucentWinConf.setAlwaysOnTop(true);
|
||||||
|
translucentActivity.onRequestedOverrideConfigurationChanged(requestedConfig);
|
||||||
|
|
||||||
mTask.addChild(translucentActivity);
|
mTask.addChild(translucentActivity);
|
||||||
|
|
||||||
// We check the WIndowConfiguration properties
|
// The original override of WindowConfiguration should keep.
|
||||||
translucentWinConf = translucentActivity.getWindowConfiguration();
|
|
||||||
assertEquals(ACTIVITY_TYPE_STANDARD, translucentActivity.getActivityType());
|
assertEquals(ACTIVITY_TYPE_STANDARD, translucentActivity.getActivityType());
|
||||||
assertEquals(WINDOWING_MODE_MULTI_WINDOW, translucentWinConf.getWindowingMode());
|
assertEquals(WINDOWING_MODE_MULTI_WINDOW, translucentWinConf.getWindowingMode());
|
||||||
assertEquals(WINDOWING_MODE_MULTI_WINDOW, translucentWinConf.getDisplayWindowingMode());
|
assertEquals(WINDOWING_MODE_MULTI_WINDOW, translucentWinConf.getDisplayWindowingMode());
|
||||||
assertTrue(translucentWinConf.isAlwaysOnTop());
|
assertTrue(translucentWinConf.isAlwaysOnTop());
|
||||||
|
// Unless display is going to be rotated, it should always inherit from parent.
|
||||||
|
assertEquals(ROTATION_UNDEFINED, translucentWinConf.getDisplayRotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user