Loading core/java/android/app/Activity.java +1 −1 Original line number Diff line number Diff line Loading @@ -3108,7 +3108,7 @@ public class Activity extends ContextThemeWrapper */ @Override public void enterPictureInPictureModeIfPossible() { if (mActivityInfo.resizeMode == ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE) { if (mActivityInfo.supportsPictureInPicture()) { enterPictureInPictureMode(); } } Loading core/java/android/app/ActivityManager.java +6 −6 Original line number Diff line number Diff line Loading @@ -1482,7 +1482,7 @@ public class ActivityManager { * True if the task can go in the docked stack. * @hide */ public boolean isDockable; public boolean supportsSplitScreenMultiWindow; /** * The resize mode of the task. See {@link ActivityInfo#resizeMode}. Loading Loading @@ -1533,7 +1533,7 @@ public class ActivityManager { } else { dest.writeInt(0); } dest.writeInt(isDockable ? 1 : 0); dest.writeInt(supportsSplitScreenMultiWindow ? 1 : 0); dest.writeInt(resizeMode); } Loading @@ -1557,7 +1557,7 @@ public class ActivityManager { numActivities = source.readInt(); bounds = source.readInt() > 0 ? Rect.CREATOR.createFromParcel(source) : null; isDockable = source.readInt() == 1; supportsSplitScreenMultiWindow = source.readInt() == 1; resizeMode = source.readInt(); } Loading Loading @@ -1745,7 +1745,7 @@ public class ActivityManager { * True if the task can go in the docked stack. * @hide */ public boolean isDockable; public boolean supportsSplitScreenMultiWindow; /** * The resize mode of the task. See {@link ActivityInfo#resizeMode}. Loading Loading @@ -1775,7 +1775,7 @@ public class ActivityManager { Parcelable.PARCELABLE_WRITE_RETURN_VALUE); dest.writeInt(numActivities); dest.writeInt(numRunning); dest.writeInt(isDockable ? 1 : 0); dest.writeInt(supportsSplitScreenMultiWindow ? 1 : 0); dest.writeInt(resizeMode); } Loading @@ -1792,7 +1792,7 @@ public class ActivityManager { description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); numActivities = source.readInt(); numRunning = source.readInt(); isDockable = source.readInt() != 0; supportsSplitScreenMultiWindow = source.readInt() != 0; resizeMode = source.readInt(); } Loading core/java/android/content/pm/ActivityInfo.java +21 −5 Original line number Diff line number Diff line Loading @@ -177,10 +177,14 @@ public class ActivityInfo extends ComponentInfo */ public static final int RESIZE_MODE_RESIZEABLE = 2; /** * Activity is resizeable and supported picture-in-picture mode. * Activity is resizeable and supported picture-in-picture mode. This flag is now deprecated * since activities do not need to be resizeable to support picture-in-picture. * See {@link #FLAG_SUPPORTS_PICTURE_IN_PICTURE}. * * @hide * @deprecated */ public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE = 3; public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE_DEPRECATED = 3; /** * Activity does not support resizing, but we are forcing it to be resizeable. Only affects * certain pre-N apps where we force them to be resizeable. Loading Loading @@ -368,6 +372,13 @@ public class ActivityInfo extends ComponentInfo */ public static final int FLAG_VISIBLE_TO_EPHEMERAL = 0x100000; /** * Bit in {@link #flags} indicating if the activity supports picture-in-picture mode. * See {@link android.R.attr#supportsPictureInPicture}. * @hide */ public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x200000; /** * @hide Bit in {@link #flags}: If set, this component will only be seen * by the system user. Only works with broadcast receivers. Set from the Loading Loading @@ -926,10 +937,17 @@ public class ActivityInfo extends ComponentInfo || screenOrientation == SCREEN_ORIENTATION_USER_PORTRAIT; } /** * Returns true if the activity supports picture-in-picture. * @hide */ public boolean supportsPictureInPicture() { return (flags & FLAG_SUPPORTS_PICTURE_IN_PICTURE) != 0; } /** @hide */ public static boolean isResizeableMode(int mode) { return mode == RESIZE_MODE_RESIZEABLE || mode == RESIZE_MODE_RESIZEABLE_AND_PIPABLE || mode == RESIZE_MODE_FORCE_RESIZEABLE || mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY Loading @@ -953,8 +971,6 @@ public class ActivityInfo extends ComponentInfo return "RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION"; case RESIZE_MODE_RESIZEABLE: return "RESIZE_MODE_RESIZEABLE"; case RESIZE_MODE_RESIZEABLE_AND_PIPABLE: return "RESIZE_MODE_RESIZEABLE_AND_PIPABLE"; case RESIZE_MODE_FORCE_RESIZEABLE: return "RESIZE_MODE_FORCE_RESIZEABLE"; case RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY: Loading core/java/android/content/pm/PackageParser.java +10 −7 Original line number Diff line number Diff line Loading @@ -18,12 +18,12 @@ package android.content.pm; import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE; import static android.content.pm.ActivityInfo.FLAG_ON_TOP_LAUNCHER; import static android.content.pm.ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE; import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY; import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY; import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION; import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE; 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_RESIZEABLE_VIA_SDK_VERSION; import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; Loading Loading @@ -2402,7 +2402,7 @@ public class PackageParser { // cannot be windowed / resized. Note that an SDK version of 0 is common for // pre-Doughnut applications. if (pkg.applicationInfo.usesCompatibilityMode()) { adjustPackageToBeUnresizeable(pkg); adjustPackageToBeUnresizeableAndUnpipable(pkg); } return pkg; } Loading @@ -2413,9 +2413,10 @@ public class PackageParser { * * @param pkg The package which needs to be marked as unresizable. */ private void adjustPackageToBeUnresizeable(Package pkg) { private void adjustPackageToBeUnresizeableAndUnpipable(Package pkg) { for (Activity a : pkg.activities) { a.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; a.info.flags &= ~FLAG_SUPPORTS_PICTURE_IN_PICTURE; } } Loading Loading @@ -4000,6 +4001,11 @@ public class PackageParser { setActivityResizeMode(a.info, sa, owner); if (sa.getBoolean(R.styleable.AndroidManifestActivity_supportsPictureInPicture, false)) { a.info.flags |= FLAG_SUPPORTS_PICTURE_IN_PICTURE; } if (sa.getBoolean(R.styleable.AndroidManifestActivity_alwaysFocusable, false)) { a.info.flags |= FLAG_ALWAYS_FOCUSABLE; } Loading Loading @@ -4161,16 +4167,13 @@ public class PackageParser { private void setActivityResizeMode(ActivityInfo aInfo, TypedArray sa, Package owner) { final boolean appExplicitDefault = (owner.applicationInfo.privateFlags & PRIVATE_FLAG_RESIZEABLE_ACTIVITIES_EXPLICITLY_SET) != 0; final boolean supportsPip = sa.getBoolean(R.styleable.AndroidManifestActivity_supportsPictureInPicture, false); if (sa.hasValue(R.styleable.AndroidManifestActivity_resizeableActivity) || appExplicitDefault) { // Activity or app explicitly set if it is resizeable or not; if (sa.getBoolean(R.styleable.AndroidManifestActivity_resizeableActivity, appExplicitDefault)) { aInfo.resizeMode = supportsPip ? RESIZE_MODE_RESIZEABLE_AND_PIPABLE : RESIZE_MODE_RESIZEABLE; aInfo.resizeMode = RESIZE_MODE_RESIZEABLE; } else { aInfo.resizeMode = RESIZE_MODE_UNRESIZEABLE; } Loading core/res/res/values/attrs_manifest.xml +7 −10 Original line number Diff line number Diff line Loading @@ -1159,18 +1159,15 @@ resizeable activities when in multi-window mode. --> <attr name="resizeableActivity" format="boolean" /> <!-- Indicates that the activity supports the picture-in-picture (PiP) form of multi-window. While it makes sense to be able to resize most activities types in multi-window mode when {@link android.R.attr#resizeableActivity} is set. It only makes sense to put specific types of activities in PiP mode of multi-window. For example, activities that play video. When set the activity will be allowed to enter PiP mode when the system deems it appropriate on devices that support PiP. <!-- Indicates that the activity specifically supports the picture-in-picture form of multi-window. If true, this activity will support entering picture-in-picture, but will only support split-screen and other forms of multi-window if {@link android.R.attr#resizeableActivity} is also set to true. <p>The default value is <code>false</code> for applications with <code>targetSdkVersion</code> lesser than {@link android.os.Build.VERSION_CODES#N} and <code>true</code> otherwise. Note that your activity may still be resized even if this attribute is true and {@link android.R.attr#resizeableActivity} is false. <p>NOTE: Attribute is only used if {@link android.R.attr#resizeableActivity} is true. --> <p>The default value is <code>false</code>. --> <attr name="supportsPictureInPicture" format="boolean" /> <!-- This value indicates how tasks rooted at this activity will behave in lockTask mode. Loading Loading
core/java/android/app/Activity.java +1 −1 Original line number Diff line number Diff line Loading @@ -3108,7 +3108,7 @@ public class Activity extends ContextThemeWrapper */ @Override public void enterPictureInPictureModeIfPossible() { if (mActivityInfo.resizeMode == ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE) { if (mActivityInfo.supportsPictureInPicture()) { enterPictureInPictureMode(); } } Loading
core/java/android/app/ActivityManager.java +6 −6 Original line number Diff line number Diff line Loading @@ -1482,7 +1482,7 @@ public class ActivityManager { * True if the task can go in the docked stack. * @hide */ public boolean isDockable; public boolean supportsSplitScreenMultiWindow; /** * The resize mode of the task. See {@link ActivityInfo#resizeMode}. Loading Loading @@ -1533,7 +1533,7 @@ public class ActivityManager { } else { dest.writeInt(0); } dest.writeInt(isDockable ? 1 : 0); dest.writeInt(supportsSplitScreenMultiWindow ? 1 : 0); dest.writeInt(resizeMode); } Loading @@ -1557,7 +1557,7 @@ public class ActivityManager { numActivities = source.readInt(); bounds = source.readInt() > 0 ? Rect.CREATOR.createFromParcel(source) : null; isDockable = source.readInt() == 1; supportsSplitScreenMultiWindow = source.readInt() == 1; resizeMode = source.readInt(); } Loading Loading @@ -1745,7 +1745,7 @@ public class ActivityManager { * True if the task can go in the docked stack. * @hide */ public boolean isDockable; public boolean supportsSplitScreenMultiWindow; /** * The resize mode of the task. See {@link ActivityInfo#resizeMode}. Loading Loading @@ -1775,7 +1775,7 @@ public class ActivityManager { Parcelable.PARCELABLE_WRITE_RETURN_VALUE); dest.writeInt(numActivities); dest.writeInt(numRunning); dest.writeInt(isDockable ? 1 : 0); dest.writeInt(supportsSplitScreenMultiWindow ? 1 : 0); dest.writeInt(resizeMode); } Loading @@ -1792,7 +1792,7 @@ public class ActivityManager { description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); numActivities = source.readInt(); numRunning = source.readInt(); isDockable = source.readInt() != 0; supportsSplitScreenMultiWindow = source.readInt() != 0; resizeMode = source.readInt(); } Loading
core/java/android/content/pm/ActivityInfo.java +21 −5 Original line number Diff line number Diff line Loading @@ -177,10 +177,14 @@ public class ActivityInfo extends ComponentInfo */ public static final int RESIZE_MODE_RESIZEABLE = 2; /** * Activity is resizeable and supported picture-in-picture mode. * Activity is resizeable and supported picture-in-picture mode. This flag is now deprecated * since activities do not need to be resizeable to support picture-in-picture. * See {@link #FLAG_SUPPORTS_PICTURE_IN_PICTURE}. * * @hide * @deprecated */ public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE = 3; public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE_DEPRECATED = 3; /** * Activity does not support resizing, but we are forcing it to be resizeable. Only affects * certain pre-N apps where we force them to be resizeable. Loading Loading @@ -368,6 +372,13 @@ public class ActivityInfo extends ComponentInfo */ public static final int FLAG_VISIBLE_TO_EPHEMERAL = 0x100000; /** * Bit in {@link #flags} indicating if the activity supports picture-in-picture mode. * See {@link android.R.attr#supportsPictureInPicture}. * @hide */ public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x200000; /** * @hide Bit in {@link #flags}: If set, this component will only be seen * by the system user. Only works with broadcast receivers. Set from the Loading Loading @@ -926,10 +937,17 @@ public class ActivityInfo extends ComponentInfo || screenOrientation == SCREEN_ORIENTATION_USER_PORTRAIT; } /** * Returns true if the activity supports picture-in-picture. * @hide */ public boolean supportsPictureInPicture() { return (flags & FLAG_SUPPORTS_PICTURE_IN_PICTURE) != 0; } /** @hide */ public static boolean isResizeableMode(int mode) { return mode == RESIZE_MODE_RESIZEABLE || mode == RESIZE_MODE_RESIZEABLE_AND_PIPABLE || mode == RESIZE_MODE_FORCE_RESIZEABLE || mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY Loading @@ -953,8 +971,6 @@ public class ActivityInfo extends ComponentInfo return "RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION"; case RESIZE_MODE_RESIZEABLE: return "RESIZE_MODE_RESIZEABLE"; case RESIZE_MODE_RESIZEABLE_AND_PIPABLE: return "RESIZE_MODE_RESIZEABLE_AND_PIPABLE"; case RESIZE_MODE_FORCE_RESIZEABLE: return "RESIZE_MODE_FORCE_RESIZEABLE"; case RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY: Loading
core/java/android/content/pm/PackageParser.java +10 −7 Original line number Diff line number Diff line Loading @@ -18,12 +18,12 @@ package android.content.pm; import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE; import static android.content.pm.ActivityInfo.FLAG_ON_TOP_LAUNCHER; import static android.content.pm.ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE; import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY; import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY; import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION; import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE; 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_RESIZEABLE_VIA_SDK_VERSION; import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; Loading Loading @@ -2402,7 +2402,7 @@ public class PackageParser { // cannot be windowed / resized. Note that an SDK version of 0 is common for // pre-Doughnut applications. if (pkg.applicationInfo.usesCompatibilityMode()) { adjustPackageToBeUnresizeable(pkg); adjustPackageToBeUnresizeableAndUnpipable(pkg); } return pkg; } Loading @@ -2413,9 +2413,10 @@ public class PackageParser { * * @param pkg The package which needs to be marked as unresizable. */ private void adjustPackageToBeUnresizeable(Package pkg) { private void adjustPackageToBeUnresizeableAndUnpipable(Package pkg) { for (Activity a : pkg.activities) { a.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; a.info.flags &= ~FLAG_SUPPORTS_PICTURE_IN_PICTURE; } } Loading Loading @@ -4000,6 +4001,11 @@ public class PackageParser { setActivityResizeMode(a.info, sa, owner); if (sa.getBoolean(R.styleable.AndroidManifestActivity_supportsPictureInPicture, false)) { a.info.flags |= FLAG_SUPPORTS_PICTURE_IN_PICTURE; } if (sa.getBoolean(R.styleable.AndroidManifestActivity_alwaysFocusable, false)) { a.info.flags |= FLAG_ALWAYS_FOCUSABLE; } Loading Loading @@ -4161,16 +4167,13 @@ public class PackageParser { private void setActivityResizeMode(ActivityInfo aInfo, TypedArray sa, Package owner) { final boolean appExplicitDefault = (owner.applicationInfo.privateFlags & PRIVATE_FLAG_RESIZEABLE_ACTIVITIES_EXPLICITLY_SET) != 0; final boolean supportsPip = sa.getBoolean(R.styleable.AndroidManifestActivity_supportsPictureInPicture, false); if (sa.hasValue(R.styleable.AndroidManifestActivity_resizeableActivity) || appExplicitDefault) { // Activity or app explicitly set if it is resizeable or not; if (sa.getBoolean(R.styleable.AndroidManifestActivity_resizeableActivity, appExplicitDefault)) { aInfo.resizeMode = supportsPip ? RESIZE_MODE_RESIZEABLE_AND_PIPABLE : RESIZE_MODE_RESIZEABLE; aInfo.resizeMode = RESIZE_MODE_RESIZEABLE; } else { aInfo.resizeMode = RESIZE_MODE_UNRESIZEABLE; } Loading
core/res/res/values/attrs_manifest.xml +7 −10 Original line number Diff line number Diff line Loading @@ -1159,18 +1159,15 @@ resizeable activities when in multi-window mode. --> <attr name="resizeableActivity" format="boolean" /> <!-- Indicates that the activity supports the picture-in-picture (PiP) form of multi-window. While it makes sense to be able to resize most activities types in multi-window mode when {@link android.R.attr#resizeableActivity} is set. It only makes sense to put specific types of activities in PiP mode of multi-window. For example, activities that play video. When set the activity will be allowed to enter PiP mode when the system deems it appropriate on devices that support PiP. <!-- Indicates that the activity specifically supports the picture-in-picture form of multi-window. If true, this activity will support entering picture-in-picture, but will only support split-screen and other forms of multi-window if {@link android.R.attr#resizeableActivity} is also set to true. <p>The default value is <code>false</code> for applications with <code>targetSdkVersion</code> lesser than {@link android.os.Build.VERSION_CODES#N} and <code>true</code> otherwise. Note that your activity may still be resized even if this attribute is true and {@link android.R.attr#resizeableActivity} is false. <p>NOTE: Attribute is only used if {@link android.R.attr#resizeableActivity} is true. --> <p>The default value is <code>false</code>. --> <attr name="supportsPictureInPicture" format="boolean" /> <!-- This value indicates how tasks rooted at this activity will behave in lockTask mode. Loading