Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6afdf91b authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Allow resizeableActivity to be specified at the application level

Makes it easier for developers to set a state for all their activities
vs. doing it individually.

Bug: 26508215
Change-Id: I8d546487b6461a03f75cce7760522e7af9fc2740
parent b12e1099
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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}
+10 −1
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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