Introducing WindowConfiguration
Used to house configurations that don't affect resources and that
we don't want to communicate to apps, but need to be propagated
along side Configuration.
Test: bit FrameworksServicesTests:com.android.server.wm.WindowConfigurationTests
Test: adb shell am instrument -w -e package com.android.server.wm com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I97de3efbe6d5e1d3b07156a8cfbce9be5eae5cb5
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index e9e073c..a2e3067 100644
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -46,6 +46,7 @@
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
import static android.content.pm.ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
import static android.content.pm.ActivityInfo.CONFIG_UI_MODE;
+import static android.content.pm.ActivityInfo.CONFIG_WINDOW_CONFIGURATION;
import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
import static android.content.pm.ActivityInfo.FLAG_SHOW_WHEN_LOCKED;
import static android.content.pm.ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
@@ -429,11 +430,11 @@
pw.print("\"");
pw.print(" primaryColor=");
pw.println(Integer.toHexString(taskDescription.getPrimaryColor()));
- pw.print(prefix); pw.print(" backgroundColor=");
+ pw.print(prefix + " backgroundColor=");
pw.println(Integer.toHexString(taskDescription.getBackgroundColor()));
- pw.print(prefix); pw.print(" statusBarColor=");
+ pw.print(prefix + " statusBarColor=");
pw.println(Integer.toHexString(taskDescription.getStatusBarColor()));
- pw.print(prefix); pw.print(" navigationBarColor=");
+ pw.print(prefix + " navigationBarColor=");
pw.println(Integer.toHexString(taskDescription.getNavigationBarColor()));
}
if (iconFilename == null && taskDescription.getIcon() != null) {
@@ -2311,9 +2312,9 @@
// We must base this on the parent configuration, because we set our override
// configuration's appBounds based on the result of this method. If we used our own
// configuration, it would be influenced by past invocations.
- final Configuration configuration = getParent().getConfiguration();
- final int containingAppWidth = configuration.appBounds.width();
- final int containingAppHeight = configuration.appBounds.height();
+ final Rect appBounds = getParent().getConfiguration().windowConfiguration.getAppBounds();
+ final int containingAppWidth = appBounds.width();
+ final int containingAppHeight = appBounds.height();
int maxActivityWidth = containingAppWidth;
int maxActivityHeight = containingAppHeight;
@@ -2342,8 +2343,7 @@
outBounds.set(0, 0, maxActivityWidth, maxActivityHeight);
// Position the activity frame on the opposite side of the nav bar.
final int navBarPosition = service.mWindowManager.getNavBarPosition();
- final int left = navBarPosition == NAV_BAR_LEFT
- ? configuration.appBounds.right - outBounds.width() : 0;
+ final int left = navBarPosition == NAV_BAR_LEFT ? appBounds.right - outBounds.width() : 0;
outBounds.offsetTo(left, 0 /* top */);
}
@@ -2574,6 +2574,10 @@
changes &= ~CONFIG_SMALLEST_SCREEN_SIZE;
}
}
+ // We don't want window configuration to cause relaunches.
+ if ((changes & CONFIG_WINDOW_CONFIGURATION) != 0) {
+ changes &= ~CONFIG_WINDOW_CONFIGURATION;
+ }
return changes;
}
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 2df773e..2e7f822 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -1205,8 +1205,9 @@
final int leftInset = mTmpRect.left;
final int topInset = mTmpRect.top;
// appBounds at the root level should mirror the app screen size.
- config.setAppBounds(leftInset /*left*/, topInset /*top*/, leftInset + displayInfo.appWidth /*right*/,
- topInset + displayInfo.appHeight /*bottom*/);
+ config.windowConfiguration.setAppBounds(leftInset /* left */, topInset /* top */,
+ leftInset + displayInfo.appWidth /* right */,
+ topInset + displayInfo.appHeight /* bottom */);
final boolean rotated = (displayInfo.rotation == Surface.ROTATION_90
|| displayInfo.rotation == Surface.ROTATION_270);
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index 2b45d67..ce21991 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -241,8 +241,8 @@
final int leftInset = mTmpRect.left;
final int topInset = mTmpRect.top;
- config.setAppBounds(leftInset /*left*/, topInset /*top*/, leftInset + appWidth /*right*/,
- topInset + appHeight /*bottom*/);
+ config.windowConfiguration.setAppBounds(leftInset /*left*/, topInset /*top*/,
+ leftInset + appWidth /*right*/, topInset + appHeight /*bottom*/);
config.screenWidthDp = (int)
(mService.mPolicy.getConfigDisplayWidth(dw, dh, rotation, baseConfig.uiMode,
diff --git a/services/core/java/com/android/server/wm/StackWindowController.java b/services/core/java/com/android/server/wm/StackWindowController.java
index 9c44c14..358b8be 100644
--- a/services/core/java/com/android/server/wm/StackWindowController.java
+++ b/services/core/java/com/android/server/wm/StackWindowController.java
@@ -16,11 +16,9 @@
package com.android.server.wm;
-import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import android.app.ActivityManager.StackId;
-import android.app.RemoteAction;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Handler;
@@ -30,11 +28,9 @@
import android.util.SparseArray;
import android.view.DisplayInfo;
-import com.android.server.UiThread;
import com.android.internal.annotations.VisibleForTesting;
import java.lang.ref.WeakReference;
-import java.util.List;
import static com.android.server.wm.WindowContainer.POSITION_BOTTOM;
import static com.android.server.wm.WindowContainer.POSITION_TOP;
@@ -278,9 +274,9 @@
int width;
int height;
- final Rect parentAppBounds = parentConfig.appBounds;
+ final Rect parentAppBounds = parentConfig.windowConfiguration.getAppBounds();
- config.setAppBounds(!bounds.isEmpty() ? bounds : null);
+ config.windowConfiguration.setAppBounds(!bounds.isEmpty() ? bounds : null);
boolean intersectParentBounds = false;
if (StackId.tasksAreFloating(mStackId)) {
@@ -295,7 +291,7 @@
nonDecorBounds.inset(mTmpNonDecorInsets);
// Move app bounds to zero to apply intersection with parent correctly. They are
// used only for evaluating width and height, so it's OK to move them around.
- config.appBounds.offsetTo(0, 0);
+ config.windowConfiguration.getAppBounds().offsetTo(0, 0);
intersectParentBounds = true;
}
width = (int) (stableBounds.width() / density);
@@ -319,8 +315,8 @@
intersectParentBounds = true;
}
- if (intersectParentBounds && config.appBounds != null) {
- config.appBounds.intersect(parentAppBounds);
+ if (intersectParentBounds && config.windowConfiguration.getAppBounds() != null) {
+ config.windowConfiguration.getAppBounds().intersect(parentAppBounds);
}
config.screenWidthDp = width;