Merge "Remove rotation and app bounds from Configuration diff." into oc-dr1-dev

am: 5b76ce1b2b

Change-Id: I8386f0693d79708b4d32bb7108139a75e273eeb1
This commit is contained in:
Bryce Lee
2017-07-28 18:18:52 +00:00
committed by android-build-merger
7 changed files with 4 additions and 105 deletions

View File

@@ -763,26 +763,6 @@ public class ActivityInfo extends ComponentInfo
* constant starts at the high bits. * constant starts at the high bits.
*/ */
public static final int CONFIG_FONT_SCALE = 0x40000000; 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 /** @hide
* Unfortunately the constants for config changes in native code are * Unfortunately the constants for config changes in native code are

View File

@@ -42,8 +42,6 @@ import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; 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 * This class describes all device configuration information that can
@@ -600,13 +598,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
*/ */
public int orientation; 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. */ /** Constant for {@link #uiMode}: bits that encode the mode type. */
public static final int UI_MODE_TYPE_MASK = 0x0f; public static final int UI_MODE_TYPE_MASK = 0x0f;
/** Constant for {@link #uiMode}: a {@link #UI_MODE_TYPE_MASK} /** Constant for {@link #uiMode}: a {@link #UI_MODE_TYPE_MASK}
@@ -894,7 +885,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
navigation = o.navigation; navigation = o.navigation;
navigationHidden = o.navigationHidden; navigationHidden = o.navigationHidden;
orientation = o.orientation; orientation = o.orientation;
mRotation = o.mRotation;
screenLayout = o.screenLayout; screenLayout = o.screenLayout;
colorMode = o.colorMode; colorMode = o.colorMode;
uiMode = o.uiMode; uiMode = o.uiMode;
@@ -1085,7 +1075,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
navigation = NAVIGATION_UNDEFINED; navigation = NAVIGATION_UNDEFINED;
navigationHidden = NAVIGATIONHIDDEN_UNDEFINED; navigationHidden = NAVIGATIONHIDDEN_UNDEFINED;
orientation = ORIENTATION_UNDEFINED; orientation = ORIENTATION_UNDEFINED;
mRotation = ROTATION_UNDEFINED;
screenLayout = SCREENLAYOUT_UNDEFINED; screenLayout = SCREENLAYOUT_UNDEFINED;
colorMode = COLOR_MODE_UNDEFINED; colorMode = COLOR_MODE_UNDEFINED;
uiMode = UI_MODE_TYPE_UNDEFINED; uiMode = UI_MODE_TYPE_UNDEFINED;
@@ -1194,11 +1183,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
changed |= ActivityInfo.CONFIG_ORIENTATION; changed |= ActivityInfo.CONFIG_ORIENTATION;
orientation = delta.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) if (((delta.screenLayout & SCREENLAYOUT_SIZE_MASK) != SCREENLAYOUT_SIZE_UNDEFINED)
&& (delta.screenLayout & SCREENLAYOUT_SIZE_MASK) && (delta.screenLayout & SCREENLAYOUT_SIZE_MASK)
@@ -1393,10 +1377,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
&& orientation != delta.orientation) { && orientation != delta.orientation) {
changed |= ActivityInfo.CONFIG_ORIENTATION; changed |= ActivityInfo.CONFIG_ORIENTATION;
} }
if ((compareUndefined || delta.mRotation != ROTATION_UNDEFINED)
&& mRotation != delta.mRotation) {
changed |= ActivityInfo.CONFIG_ROTATION;
}
if ((compareUndefined || getScreenLayoutNoDirection(delta.screenLayout) != if ((compareUndefined || getScreenLayoutNoDirection(delta.screenLayout) !=
(SCREENLAYOUT_SIZE_UNDEFINED | SCREENLAYOUT_LONG_UNDEFINED)) (SCREENLAYOUT_SIZE_UNDEFINED | SCREENLAYOUT_LONG_UNDEFINED))
&& getScreenLayoutNoDirection(screenLayout) != && getScreenLayoutNoDirection(screenLayout) !=
@@ -1445,7 +1425,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
if ((compareUndefined || delta.appBounds != null) if ((compareUndefined || delta.appBounds != null)
&& appBounds != delta.appBounds && appBounds != delta.appBounds
&& (appBounds == null || !appBounds.equals(delta.appBounds))) { && (appBounds == null || !appBounds.equals(delta.appBounds))) {
changed |= ActivityInfo.CONFIG_APP_BOUNDS; changed |= ActivityInfo.CONFIG_SCREEN_SIZE;
} }
return changed; return changed;
@@ -1533,7 +1513,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
dest.writeInt(navigation); dest.writeInt(navigation);
dest.writeInt(navigationHidden); dest.writeInt(navigationHidden);
dest.writeInt(orientation); dest.writeInt(orientation);
dest.writeInt(mRotation);
dest.writeInt(screenLayout); dest.writeInt(screenLayout);
dest.writeInt(colorMode); dest.writeInt(colorMode);
dest.writeInt(uiMode); dest.writeInt(uiMode);
@@ -1570,7 +1549,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
navigation = source.readInt(); navigation = source.readInt();
navigationHidden = source.readInt(); navigationHidden = source.readInt();
orientation = source.readInt(); orientation = source.readInt();
mRotation = source.readInt();
screenLayout = source.readInt(); screenLayout = source.readInt();
colorMode = source.readInt(); colorMode = source.readInt();
uiMode = source.readInt(); uiMode = source.readInt();
@@ -1655,8 +1633,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
if (n != 0) return n; if (n != 0) return n;
n = this.orientation - that.orientation; n = this.orientation - that.orientation;
if (n != 0) return n; if (n != 0) return n;
n = this.mRotation - that.mRotation;
if (n != 0) return n;
n = this.colorMode - that.colorMode; n = this.colorMode - that.colorMode;
if (n != 0) return n; if (n != 0) return n;
n = this.screenLayout - that.screenLayout; n = this.screenLayout - that.screenLayout;
@@ -1802,24 +1778,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
appBounds.set(left, top, right, bottom); appBounds.set(left, top, right, bottom);
} }
/**
* @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 * @hide
* *
@@ -2253,10 +2211,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
delta.orientation = change.orientation; delta.orientation = change.orientation;
} }
if (base.mRotation != change.mRotation) {
base.mRotation = change.mRotation;
}
if ((base.screenLayout & SCREENLAYOUT_SIZE_MASK) != if ((base.screenLayout & SCREENLAYOUT_SIZE_MASK) !=
(change.screenLayout & SCREENLAYOUT_SIZE_MASK)) { (change.screenLayout & SCREENLAYOUT_SIZE_MASK)) {
delta.screenLayout |= change.screenLayout & SCREENLAYOUT_SIZE_MASK; delta.screenLayout |= change.screenLayout & SCREENLAYOUT_SIZE_MASK;
@@ -2388,8 +2342,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
DENSITY_DPI_UNDEFINED); DENSITY_DPI_UNDEFINED);
configOut.appBounds = configOut.appBounds =
Rect.unflattenFromString(XmlUtils.readStringAttribute(parser, XML_ATTR_APP_BOUNDS)); 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. // For persistence, we don't care about assetsSeq, so do not read it out.
} }
@@ -2466,10 +2418,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
config.appBounds.flattenToString()); 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. // For persistence, we do not care about assetsSeq, so do not write it out.
} }
} }

View File

@@ -725,17 +725,6 @@ public final class Display {
} }
} }
/**
* 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} * @deprecated use {@link #getRotation}
* @return orientation of this display. * @return orientation of this display.

View File

@@ -131,16 +131,10 @@ public class Surface implements Parcelable {
public static final int SCALING_MODE_NO_SCALE_CROP = 3; public static final int SCALING_MODE_NO_SCALE_CROP = 3;
/** @hide */ /** @hide */
@IntDef({ROTATION_UNDEFINED, ROTATION_0, ROTATION_90, ROTATION_180, ROTATION_270}) @IntDef({ROTATION_0, ROTATION_90, ROTATION_180, ROTATION_270})
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface Rotation {} public @interface Rotation {}
/**
* Rotation constant: undefined
* @hide
*/
public static final int ROTATION_UNDEFINED = -1;
/** /**
* Rotation constant: 0 degree rotation (natural orientation) * Rotation constant: 0 degree rotation (natural orientation)
*/ */

View File

@@ -41,9 +41,7 @@ import static android.content.Intent.CATEGORY_HOME;
import static android.content.Intent.CATEGORY_LAUNCHER; import static android.content.Intent.CATEGORY_LAUNCHER;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_NO_HISTORY; 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_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_LAYOUT;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE; 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_SMALLEST_SCREEN_SIZE;
@@ -2598,15 +2596,6 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
changes &= ~CONFIG_SMALLEST_SCREEN_SIZE; 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; return changes;
} }

View File

@@ -1183,7 +1183,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
final int dh = displayInfo.logicalHeight; final int dh = displayInfo.logicalHeight;
config.orientation = (dw <= dh) ? Configuration.ORIENTATION_PORTRAIT : config.orientation = (dw <= dh) ? Configuration.ORIENTATION_PORTRAIT :
Configuration.ORIENTATION_LANDSCAPE; Configuration.ORIENTATION_LANDSCAPE;
config.setRotation(displayInfo.rotation);
config.screenWidthDp = config.screenWidthDp =
(int)(mService.mPolicy.getConfigDisplayWidth(dw, dh, displayInfo.rotation, (int)(mService.mPolicy.getConfigDisplayWidth(dw, dh, displayInfo.rotation,

View File

@@ -57,9 +57,9 @@ public class AppBoundsTests extends WindowTestsBase {
final Configuration config = new Configuration(); final Configuration config = new Configuration();
final Configuration config2 = new Configuration(); final Configuration config2 = new Configuration();
config.appBounds = new Rect(0, 1, 1, 0); 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));
} }
/** /**