Merge "Ensure we apply override configuration to the global one." into nyc-dev
am: e0a1e3ae71
* commit 'e0a1e3ae716ec62eb264c21842c2603067b8a73c':
Ensure we apply override configuration to the global one.
This commit is contained in:
@@ -184,6 +184,10 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
|
|
||||||
private Configuration mConfiguration = Configuration.EMPTY;
|
private Configuration mConfiguration = Configuration.EMPTY;
|
||||||
private Configuration mOverrideConfig = Configuration.EMPTY;
|
private Configuration mOverrideConfig = Configuration.EMPTY;
|
||||||
|
// Represents the changes from our override configuration applied
|
||||||
|
// to the global configuration. This is the only form of configuration
|
||||||
|
// which is suitable for delivery to the client.
|
||||||
|
private Configuration mMergedConfiguration = new Configuration();
|
||||||
// Sticky answer to isConfigChanged(), remains true until new Configuration is assigned.
|
// Sticky answer to isConfigChanged(), remains true until new Configuration is assigned.
|
||||||
// Used only on {@link #TYPE_KEYGUARD}.
|
// Used only on {@link #TYPE_KEYGUARD}.
|
||||||
private boolean mConfigHasChanged;
|
private boolean mConfigHasChanged;
|
||||||
@@ -1355,6 +1359,11 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
mConfiguration = newConfig;
|
mConfiguration = newConfig;
|
||||||
mOverrideConfig = newOverrideConfig;
|
mOverrideConfig = newOverrideConfig;
|
||||||
mConfigHasChanged = false;
|
mConfigHasChanged = false;
|
||||||
|
|
||||||
|
mMergedConfiguration.setTo(newConfig);
|
||||||
|
if (newOverrideConfig != null && newOverrideConfig != Configuration.EMPTY) {
|
||||||
|
mMergedConfiguration.updateFrom(newOverrideConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setHasSurface(boolean hasSurface) {
|
void setHasSurface(boolean hasSurface) {
|
||||||
@@ -1616,9 +1625,10 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
mTurnOnScreen = true;
|
mTurnOnScreen = true;
|
||||||
}
|
}
|
||||||
if (isConfigChanged()) {
|
if (isConfigChanged()) {
|
||||||
|
final Configuration newConfig = updateConfiguration();
|
||||||
if (DEBUG_CONFIGURATION) Slog.i(TAG, "Window " + this + " visible with new config: "
|
if (DEBUG_CONFIGURATION) Slog.i(TAG, "Window " + this + " visible with new config: "
|
||||||
+ mService.mCurConfiguration);
|
+ newConfig);
|
||||||
outConfig.setTo(mService.mCurConfiguration);
|
outConfig.setTo(newConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2061,21 +2071,30 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update our current configurations, based on task configuration.
|
||||||
|
*
|
||||||
|
* @return A configuration suitable for sending to the client.
|
||||||
|
*/
|
||||||
|
private Configuration updateConfiguration() {
|
||||||
|
final Task task = getTask();
|
||||||
|
final Configuration overrideConfig =
|
||||||
|
(task != null) ? task.mOverrideConfig : Configuration.EMPTY;
|
||||||
|
final boolean configChanged = isConfigChanged();
|
||||||
|
if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION) && configChanged) {
|
||||||
|
Slog.i(TAG, "Sending new config to window " + this + ": " +
|
||||||
|
" / config=" + mService.mCurConfiguration + " overrideConfig=" + overrideConfig);
|
||||||
|
}
|
||||||
|
setConfiguration(mService.mCurConfiguration, overrideConfig);
|
||||||
|
return mMergedConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
void reportResized() {
|
void reportResized() {
|
||||||
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "wm.reportResized_" + getWindowTag());
|
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "wm.reportResized_" + getWindowTag());
|
||||||
try {
|
try {
|
||||||
if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to " + this
|
if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to " + this
|
||||||
+ ": " + mCompatFrame);
|
+ ": " + mCompatFrame);
|
||||||
final boolean configChanged = isConfigChanged();
|
final Configuration newConfig = isConfigChanged() ? updateConfiguration() : null;
|
||||||
final Task task = getTask();
|
|
||||||
final Configuration overrideConfig =
|
|
||||||
(task != null) ? task.mOverrideConfig : Configuration.EMPTY;
|
|
||||||
if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION) && configChanged) {
|
|
||||||
Slog.i(TAG, "Sending new config to window " + this + ": "
|
|
||||||
+ " / config="
|
|
||||||
+ mService.mCurConfiguration + " overrideConfig=" + overrideConfig);
|
|
||||||
}
|
|
||||||
setConfiguration(mService.mCurConfiguration, overrideConfig);
|
|
||||||
if (DEBUG_ORIENTATION && mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING)
|
if (DEBUG_ORIENTATION && mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING)
|
||||||
Slog.i(TAG, "Resizing " + this + " WITH DRAW PENDING");
|
Slog.i(TAG, "Resizing " + this + " WITH DRAW PENDING");
|
||||||
|
|
||||||
@@ -2086,7 +2105,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
final Rect stableInsets = mLastStableInsets;
|
final Rect stableInsets = mLastStableInsets;
|
||||||
final Rect outsets = mLastOutsets;
|
final Rect outsets = mLastOutsets;
|
||||||
final boolean reportDraw = mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
|
final boolean reportDraw = mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
|
||||||
final Configuration newConfig = configChanged ? mConfiguration : null;
|
|
||||||
if (mAttrs.type != WindowManager.LayoutParams.TYPE_APPLICATION_STARTING
|
if (mAttrs.type != WindowManager.LayoutParams.TYPE_APPLICATION_STARTING
|
||||||
&& mClient instanceof IWindow.Stub) {
|
&& mClient instanceof IWindow.Stub) {
|
||||||
// To prevent deadlock simulate one-way call if win.mClient is a local object.
|
// To prevent deadlock simulate one-way call if win.mClient is a local object.
|
||||||
|
|||||||
Reference in New Issue
Block a user