Merge changes I8d546487,Ib62d357f

* changes:
  Allow resizeableActivity to be specified at the application level
  Renamed manifest attributes initialWidth/Height to defaultWidth/Height
This commit is contained in:
Wale Ogunwale
2016-01-31 20:02:45 +00:00
committed by Android (Google) Code Review
8 changed files with 42 additions and 24 deletions

View File

@@ -437,7 +437,9 @@ package android {
field public static final deprecated int dayOfWeekBackground = 16843924; // 0x1010494
field public static final deprecated int dayOfWeekTextAppearance = 16843925; // 0x1010495
field public static final int debuggable = 16842767; // 0x101000f
field public static final int defaultHeight = 16844021; // 0x10104f5
field public static final int defaultValue = 16843245; // 0x10101ed
field public static final int defaultWidth = 16844020; // 0x10104f4
field public static final int delay = 16843212; // 0x10101cc
field public static final int dependency = 16843244; // 0x10101ec
field public static final int descendantFocusability = 16842993; // 0x10100f1
@@ -680,10 +682,8 @@ package android {
field public static final int indicatorStart = 16843729; // 0x10103d1
field public static final int inflatedId = 16842995; // 0x10100f3
field public static final int initOrder = 16842778; // 0x101001a
field public static final int initialHeight = 16844021; // 0x10104f5
field public static final int initialKeyguardLayout = 16843714; // 0x10103c2
field public static final int initialLayout = 16843345; // 0x1010251
field public static final int initialWidth = 16844020; // 0x10104f4
field public static final int innerRadius = 16843359; // 0x101025f
field public static final int innerRadiusRatio = 16843163; // 0x101019b
field public static final deprecated int inputMethod = 16843112; // 0x1010168

View File

@@ -532,7 +532,9 @@ package android {
field public static final deprecated int dayOfWeekBackground = 16843924; // 0x1010494
field public static final deprecated int dayOfWeekTextAppearance = 16843925; // 0x1010495
field public static final int debuggable = 16842767; // 0x101000f
field public static final int defaultHeight = 16844021; // 0x10104f5
field public static final int defaultValue = 16843245; // 0x10101ed
field public static final int defaultWidth = 16844020; // 0x10104f4
field public static final int delay = 16843212; // 0x10101cc
field public static final int dependency = 16843244; // 0x10101ec
field public static final int descendantFocusability = 16842993; // 0x10100f1
@@ -775,10 +777,8 @@ package android {
field public static final int indicatorStart = 16843729; // 0x10103d1
field public static final int inflatedId = 16842995; // 0x10100f3
field public static final int initOrder = 16842778; // 0x101001a
field public static final int initialHeight = 16844021; // 0x10104f5
field public static final int initialKeyguardLayout = 16843714; // 0x10103c2
field public static final int initialLayout = 16843345; // 0x1010251
field public static final int initialWidth = 16844020; // 0x10104f4
field public static final int innerRadius = 16843359; // 0x101025f
field public static final int innerRadiusRatio = 16843163; // 0x101019b
field public static final deprecated int inputMethod = 16843112; // 0x1010168

View File

@@ -437,7 +437,9 @@ package android {
field public static final deprecated int dayOfWeekBackground = 16843924; // 0x1010494
field public static final deprecated int dayOfWeekTextAppearance = 16843925; // 0x1010495
field public static final int debuggable = 16842767; // 0x101000f
field public static final int defaultHeight = 16844021; // 0x10104f5
field public static final int defaultValue = 16843245; // 0x10101ed
field public static final int defaultWidth = 16844020; // 0x10104f4
field public static final int delay = 16843212; // 0x10101cc
field public static final int dependency = 16843244; // 0x10101ec
field public static final int descendantFocusability = 16842993; // 0x10100f1
@@ -680,10 +682,8 @@ package android {
field public static final int indicatorStart = 16843729; // 0x10103d1
field public static final int inflatedId = 16842995; // 0x10100f3
field public static final int initOrder = 16842778; // 0x101001a
field public static final int initialHeight = 16844021; // 0x10104f5
field public static final int initialKeyguardLayout = 16843714; // 0x10103c2
field public static final int initialLayout = 16843345; // 0x1010251
field public static final int initialWidth = 16844020; // 0x10104f4
field public static final int innerRadius = 16843359; // 0x101025f
field public static final int innerRadiusRatio = 16843163; // 0x101019b
field public static final deprecated int inputMethod = 16843112; // 0x1010168

View File

@@ -839,7 +839,7 @@ public class ActivityInfo extends ComponentInfo
+ lockTaskLaunchModeToString(lockTaskLaunchMode));
}
if (layout != null) {
pw.println(prefix + "initialLayout=" + layout.width + "|"
pw.println(prefix + "defaultLayout=" + layout.width + "|"
+ layout.widthFraction + ", " + layout.height + "|"
+ layout.heightFraction + ", " + layout.gravity);
}

View File

@@ -514,6 +514,14 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
*/
public static final int PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER = 1 << 10;
/**
* When set, the activities associated with this application are resizeable by default.
* @see android.R.styleable#AndroidManifestActivity_resizeableActivity
*
* @hide
*/
public static final int PRIVATE_FLAG_RESIZEABLE_ACTIVITIES = 1 << 11;
/**
* Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
* {@hide}

View File

@@ -84,6 +84,7 @@ import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_RESIZEABLE_ACTIVITIES;
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_MANIFEST;
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING;
@@ -2642,6 +2643,11 @@ public class PackageParser {
ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_ENCRYPTION_AWARE;
}
if (sa.getBoolean(R.styleable.AndroidManifestApplication_resizeableActivity,
owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N)) {
ai.privateFlags |= PRIVATE_FLAG_RESIZEABLE_ACTIVITIES;
}
String str;
str = sa.getNonConfigurationString(
com.android.internal.R.styleable.AndroidManifestApplication_permission, 0);
@@ -3232,7 +3238,10 @@ public class PackageParser {
a.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
if (owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N) {
if (sa.getBoolean(R.styleable.AndroidManifestActivity_resizeableActivity, true)) {
final boolean appDefault = (owner.applicationInfo.privateFlags
& PRIVATE_FLAG_RESIZEABLE_ACTIVITIES) != 0;
if (sa.getBoolean(
R.styleable.AndroidManifestActivity_resizeableActivity, appDefault)) {
if (sa.getBoolean(R.styleable.AndroidManifestActivity_supportsPictureInPicture,
false)) {
a.info.resizeMode = RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
@@ -3378,25 +3387,25 @@ public class PackageParser {
int height = -1;
float heightFraction = -1f;
final int widthType = sw.getType(
com.android.internal.R.styleable.AndroidManifestLayout_initialWidth);
com.android.internal.R.styleable.AndroidManifestLayout_defaultWidth);
if (widthType == TypedValue.TYPE_FRACTION) {
widthFraction = sw.getFraction(
com.android.internal.R.styleable.AndroidManifestLayout_initialWidth,
com.android.internal.R.styleable.AndroidManifestLayout_defaultWidth,
1, 1, -1);
} else if (widthType == TypedValue.TYPE_DIMENSION) {
width = sw.getDimensionPixelSize(
com.android.internal.R.styleable.AndroidManifestLayout_initialWidth,
com.android.internal.R.styleable.AndroidManifestLayout_defaultWidth,
-1);
}
final int heightType = sw.getType(
com.android.internal.R.styleable.AndroidManifestLayout_initialHeight);
com.android.internal.R.styleable.AndroidManifestLayout_defaultHeight);
if (heightType == TypedValue.TYPE_FRACTION) {
heightFraction = sw.getFraction(
com.android.internal.R.styleable.AndroidManifestLayout_initialHeight,
com.android.internal.R.styleable.AndroidManifestLayout_defaultHeight,
1, 1, -1);
} else if (heightType == TypedValue.TYPE_DIMENSION) {
height = sw.getDimensionPixelSize(
com.android.internal.R.styleable.AndroidManifestLayout_initialHeight,
com.android.internal.R.styleable.AndroidManifestLayout_defaultHeight,
-1);
}
int gravity = sw.getInt(

View File

@@ -1288,6 +1288,7 @@
<attr name="extractNativeLibs" />
<attr name="forceDeviceEncrypted" format="boolean" />
<attr name="encryptionAware" />
<attr name="resizeableActivity" />
</declare-styleable>
<!-- The <code>permission</code> tag declares a security permission that can be
used to control access from other packages to specific components or
@@ -2238,21 +2239,21 @@
<!-- <code>layout</code> tag allows configuring the layout for the activity within multi-window
environment. -->
<declare-styleable name="AndroidManifestLayout" parent="AndroidManifestActivity">
<!-- Initial width of the activity. Can be either a fixed value or fraction, in which case
<!-- Default width of the activity. Can be either a fixed value or fraction, in which case
the width will be constructed as a fraction of the total available width. -->
<attr name="initialWidth" format="dimension|fraction" />
<!-- Initial height of the activity. Can be either a fixed value or fraction, in which case
<attr name="defaultWidth" format="dimension|fraction" />
<!-- Default height of the activity. Can be either a fixed value or fraction, in which case
the height will be constructed as a fraction of the total available height. -->
<attr name="initialHeight" format="dimension|fraction" />
<attr name="defaultHeight" format="dimension|fraction" />
<!-- Where to initially position the activity inside the available space. Uses constants
defined in {@link android.view.Gravity}. -->
<attr name="gravity" />
<!-- Minimal height of the activity.
<p>NOTE: A task's root activity value is applied to all additional activities launched
in the task. That is if the root activity of a task set minimal size, then the system
will set the same minimal size on all other activities in the task. It will also
ignore any other minimal size attributes of non-root activities. -->
<p><strong>NOTE:</strong> A task's root activity value is applied to all additional
activities launched in the task. That is if the root activity of a task set minimal size,
then the system will set the same minimal size on all other activities in the task. It will
also ignore any other minimal size attributes of non-root activities. -->
<attr name="minimalSize" format="dimension" />
</declare-styleable>

View File

@@ -2662,8 +2662,8 @@
<public type="attr" name="listMenuViewStyle" />
<public type="attr" name="subMenuArrow" />
<public type="attr" name="initialWidth" />
<public type="attr" name="initialHeight" />
<public type="attr" name="defaultWidth" />
<public type="attr" name="defaultHeight" />
<public type="attr" name="minimalSize" />
<public type="attr" name="resizeableActivity" />
<public type="attr" name="supportsPictureInPicture" />