Merge "Remove rotation and app bounds from Configuration diff." into oc-dr1-dev
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 16c834d..18f9e53 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -763,26 +763,6 @@
* constant starts at the high bits.
*/
public static final int CONFIG_FONT_SCALE = 0x40000000;
- /**
- * Bit in {@link #configChanges} that indicates that the activity
- * can itself handle changes to the rotation. Set from the
- * {@link android.R.attr#configChanges} attribute. This is
- * not a core resource configuration, but a higher-level value, so its
- * constant starts at the high bits.
- * @hide We do not want apps to handle this. It will eventually be moved out of
- * {@link Configuration}.
- */
- public static final int CONFIG_ROTATION = 0x20000000;
- /**
- * Bit in {@link #configChanges} that indicates that the activity
- * can itself handle changes to the app bounds. Set from the
- * {@link android.R.attr#configChanges} attribute. This is
- * not a core resource configuration, but a higher-level value, so its
- * constant starts at the high bits.
- * @hide We do not want apps to handle this. It will eventually be moved out of
- * {@link Configuration}.
- */
- public static final int CONFIG_APP_BOUNDS = 0x10000000;
/** @hide
* Unfortunately the constants for config changes in native code are
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 7b96c6a..af27131 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -42,8 +42,6 @@
import java.util.ArrayList;
import java.util.Locale;
-import static android.view.Surface.ROTATION_0;
-import static android.view.Surface.ROTATION_UNDEFINED;
/**
* This class describes all device configuration information that can
@@ -600,13 +598,6 @@
*/
public int orientation;
- /**
- * The mRotation used at the time orientation was determined.
- * TODO(b/36812336): Move mRotation out of {@link Configuration}.
- * {@hide}
- */
- private int mRotation;
-
/** Constant for {@link #uiMode}: bits that encode the mode type. */
public static final int UI_MODE_TYPE_MASK = 0x0f;
/** Constant for {@link #uiMode}: a {@link #UI_MODE_TYPE_MASK}
@@ -894,7 +885,6 @@
navigation = o.navigation;
navigationHidden = o.navigationHidden;
orientation = o.orientation;
- mRotation = o.mRotation;
screenLayout = o.screenLayout;
colorMode = o.colorMode;
uiMode = o.uiMode;
@@ -1085,7 +1075,6 @@
navigation = NAVIGATION_UNDEFINED;
navigationHidden = NAVIGATIONHIDDEN_UNDEFINED;
orientation = ORIENTATION_UNDEFINED;
- mRotation = ROTATION_UNDEFINED;
screenLayout = SCREENLAYOUT_UNDEFINED;
colorMode = COLOR_MODE_UNDEFINED;
uiMode = UI_MODE_TYPE_UNDEFINED;
@@ -1194,11 +1183,6 @@
changed |= ActivityInfo.CONFIG_ORIENTATION;
orientation = delta.orientation;
}
- if (delta.mRotation != ROTATION_UNDEFINED
- && mRotation != delta.mRotation) {
- changed |= ActivityInfo.CONFIG_ORIENTATION;
- mRotation = delta.mRotation;
- }
if (((delta.screenLayout & SCREENLAYOUT_SIZE_MASK) != SCREENLAYOUT_SIZE_UNDEFINED)
&& (delta.screenLayout & SCREENLAYOUT_SIZE_MASK)
@@ -1393,10 +1377,6 @@
&& orientation != delta.orientation) {
changed |= ActivityInfo.CONFIG_ORIENTATION;
}
- if ((compareUndefined || delta.mRotation != ROTATION_UNDEFINED)
- && mRotation != delta.mRotation) {
- changed |= ActivityInfo.CONFIG_ROTATION;
- }
if ((compareUndefined || getScreenLayoutNoDirection(delta.screenLayout) !=
(SCREENLAYOUT_SIZE_UNDEFINED | SCREENLAYOUT_LONG_UNDEFINED))
&& getScreenLayoutNoDirection(screenLayout) !=
@@ -1445,7 +1425,7 @@
if ((compareUndefined || delta.appBounds != null)
&& appBounds != delta.appBounds
&& (appBounds == null || !appBounds.equals(delta.appBounds))) {
- changed |= ActivityInfo.CONFIG_APP_BOUNDS;
+ changed |= ActivityInfo.CONFIG_SCREEN_SIZE;
}
return changed;
@@ -1533,7 +1513,6 @@
dest.writeInt(navigation);
dest.writeInt(navigationHidden);
dest.writeInt(orientation);
- dest.writeInt(mRotation);
dest.writeInt(screenLayout);
dest.writeInt(colorMode);
dest.writeInt(uiMode);
@@ -1570,7 +1549,6 @@
navigation = source.readInt();
navigationHidden = source.readInt();
orientation = source.readInt();
- mRotation = source.readInt();
screenLayout = source.readInt();
colorMode = source.readInt();
uiMode = source.readInt();
@@ -1655,8 +1633,6 @@
if (n != 0) return n;
n = this.orientation - that.orientation;
if (n != 0) return n;
- n = this.mRotation - that.mRotation;
- if (n != 0) return n;
n = this.colorMode - that.colorMode;
if (n != 0) return n;
n = this.screenLayout - that.screenLayout;
@@ -1805,24 +1781,6 @@
/**
* @hide
*
- * Setter for orientation converts from {@link Surface} values to internal representation.
- */
- public void setRotation(int rotation) {
- this.mRotation = rotation;
- }
-
- /**
- * @hide
- *
- * Getter for orientation. Converts from internal representation to {@link Surface} values.
- */
- public int getRotation() {
- return mRotation != ROTATION_UNDEFINED ? mRotation : ROTATION_0;
- }
-
- /**
- * @hide
- *
* Clears the locale without changing layout direction.
*/
public void clearLocales() {
@@ -2253,10 +2211,6 @@
delta.orientation = change.orientation;
}
- if (base.mRotation != change.mRotation) {
- base.mRotation = change.mRotation;
- }
-
if ((base.screenLayout & SCREENLAYOUT_SIZE_MASK) !=
(change.screenLayout & SCREENLAYOUT_SIZE_MASK)) {
delta.screenLayout |= change.screenLayout & SCREENLAYOUT_SIZE_MASK;
@@ -2388,8 +2342,6 @@
DENSITY_DPI_UNDEFINED);
configOut.appBounds =
Rect.unflattenFromString(XmlUtils.readStringAttribute(parser, XML_ATTR_APP_BOUNDS));
- configOut.mRotation = XmlUtils.readIntAttribute(parser, XML_ATTR_ROTATION,
- ROTATION_UNDEFINED);
// For persistence, we don't care about assetsSeq, so do not read it out.
}
@@ -2466,10 +2418,6 @@
config.appBounds.flattenToString());
}
- if (config.mRotation != ROTATION_UNDEFINED) {
- XmlUtils.writeIntAttribute(xml, XML_ATTR_ROTATION, config.mRotation);
- }
-
// For persistence, we do not care about assetsSeq, so do not write it out.
}
}
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 263d3ff..9778893 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -726,17 +726,6 @@
}
/**
- * Returns the rotation associated with this display as used during layout. This is currently
- * derived from the {@link Configuration}.
- *
- * @hide
- */
- @Surface.Rotation
- public int getLayoutRotation() {
- return mResources.getConfiguration().getRotation();
- }
-
- /**
* @deprecated use {@link #getRotation}
* @return orientation of this display.
*/
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 1b70232..4f9dbd5 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -131,17 +131,11 @@
public static final int SCALING_MODE_NO_SCALE_CROP = 3;
/** @hide */
- @IntDef({ROTATION_UNDEFINED, ROTATION_0, ROTATION_90, ROTATION_180, ROTATION_270})
+ @IntDef({ROTATION_0, ROTATION_90, ROTATION_180, ROTATION_270})
@Retention(RetentionPolicy.SOURCE)
public @interface Rotation {}
/**
- * Rotation constant: undefined
- * @hide
- */
- public static final int ROTATION_UNDEFINED = -1;
-
- /**
* Rotation constant: 0 degree rotation (natural orientation)
*/
public static final int ROTATION_0 = 0;
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index c09947c..66ec520 100644
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -41,9 +41,7 @@
import static android.content.Intent.CATEGORY_LAUNCHER;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_NO_HISTORY;
-import static android.content.pm.ActivityInfo.CONFIG_APP_BOUNDS;
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
-import static android.content.pm.ActivityInfo.CONFIG_ROTATION;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_LAYOUT;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
import static android.content.pm.ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
@@ -2598,15 +2596,6 @@
changes &= ~CONFIG_SMALLEST_SCREEN_SIZE;
}
}
- // We don't want rotation to cause relaunches.
- if ((changes & CONFIG_ROTATION) != 0) {
- changes &= ~CONFIG_ROTATION;
- }
-
- // We don't want app bound changes to cause relaunches.
- if ((changes & CONFIG_APP_BOUNDS) != 0) {
- changes &= ~CONFIG_APP_BOUNDS;
- }
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 a37b2e5..55c0612f 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -1183,7 +1183,6 @@
final int dh = displayInfo.logicalHeight;
config.orientation = (dw <= dh) ? Configuration.ORIENTATION_PORTRAIT :
Configuration.ORIENTATION_LANDSCAPE;
- config.setRotation(displayInfo.rotation);
config.screenWidthDp =
(int)(mService.mPolicy.getConfigDisplayWidth(dw, dh, displayInfo.rotation,
diff --git a/services/tests/servicestests/src/com/android/server/wm/AppBoundsTests.java b/services/tests/servicestests/src/com/android/server/wm/AppBoundsTests.java
index f7ea0c4..6c95bd5 100644
--- a/services/tests/servicestests/src/com/android/server/wm/AppBoundsTests.java
+++ b/services/tests/servicestests/src/com/android/server/wm/AppBoundsTests.java
@@ -57,9 +57,9 @@
final Configuration config = new Configuration();
final Configuration config2 = new Configuration();
config.appBounds = new Rect(0, 1, 1, 0);
- config2.appBounds = new Rect(0, 2, 2, 0);
+ config2.appBounds = new Rect(1, 2, 2, 1);
- assertEquals(ActivityInfo.CONFIG_APP_BOUNDS, config.diff(config2));
+ assertEquals(ActivityInfo.CONFIG_SCREEN_SIZE, config.diff(config2));
}
/**