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

Commit 5dc88839 authored by Mary Xia's avatar Mary Xia Committed by Android (Google) Code Review
Browse files

Merge "Define a new manifest attribute targetDisplayCategory in <activity> tag...

Merge "Define a new manifest attribute targetDisplayCategory in <activity> tag and parse into ActivityInfo through string validation"
parents f00457ae dc8eab40
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1492,6 +1492,7 @@ package android {
    field public static final int targetCellWidth = 16844340; // 0x1010634
    field public static final int targetClass = 16842799; // 0x101002f
    field @Deprecated public static final int targetDescriptions = 16843680; // 0x10103a0
    field public static final int targetDisplayCategory;
    field public static final int targetId = 16843740; // 0x10103dc
    field public static final int targetName = 16843853; // 0x101044d
    field public static final int targetPackage = 16842785; // 0x1010021
@@ -11138,6 +11139,7 @@ package android.content.pm {
    field public int screenOrientation;
    field public int softInputMode;
    field public String targetActivity;
    field @Nullable public String targetDisplayCategory;
    field public String taskAffinity;
    field public int theme;
    field public int uiOptions;
+23 −0
Original line number Diff line number Diff line
@@ -220,6 +220,23 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
     */
    public String launchToken;

    /**
     * Specifies the category of the target display the activity is expected to run on. Set from
     * the {@link android.R.attr#targetDisplayCategory} attribute. Upon creation, a virtual display
     * can specify which display categories it supports and one of the category must be present in
     * the activity's manifest to allow this activity to run. The default value is {@code null},
     * which indicates the activity does not belong to a restricted display category and thus can
     * only run on a display that didn't specify any display categories. Each activity can only
     * specify one category it targets to but a virtual display can support multiple restricted
     * categories.
     *
     * This field should be formatted as a Java-language-style free form string(for example,
     * com.google.automotive_entertainment), which may contain uppercase or lowercase letters ('A'
     * through 'Z'), numbers, and underscores ('_') but may only start with letters.
     */
    @Nullable
    public String targetDisplayCategory;

    /**
     * Activity can not be resized and always occupies the fullscreen area with all windows fully
     * visible.
@@ -1313,6 +1330,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
        mMaxAspectRatio = orig.mMaxAspectRatio;
        mMinAspectRatio = orig.mMinAspectRatio;
        supportsSizeChanges = orig.supportsSizeChanges;
        targetDisplayCategory = orig.targetDisplayCategory;
    }

    /**
@@ -1651,6 +1669,9 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
        if (mKnownActivityEmbeddingCerts != null) {
            pw.println(prefix + "knownActivityEmbeddingCerts=" + mKnownActivityEmbeddingCerts);
        }
        if (targetDisplayCategory != null) {
            pw.println(prefix + "targetDisplayCategory=" + targetDisplayCategory);
        }
        super.dumpBack(pw, prefix, dumpFlags);
    }

@@ -1697,6 +1718,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
        dest.writeFloat(mMinAspectRatio);
        dest.writeBoolean(supportsSizeChanges);
        sForStringSet.parcel(mKnownActivityEmbeddingCerts, dest, flags);
        dest.writeString8(targetDisplayCategory);
    }

    /**
@@ -1822,6 +1844,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
        if (mKnownActivityEmbeddingCerts.isEmpty()) {
            mKnownActivityEmbeddingCerts = null;
        }
        targetDisplayCategory = source.readString8();
    }

    /**
+14 −0
Original line number Diff line number Diff line
@@ -3062,6 +3062,20 @@
        <attr name="canDisplayOnRemoteDevices" format="boolean"/>
        <attr name="allowUntrustedActivityEmbedding" />
        <attr name="knownActivityEmbeddingCerts" />
        <!-- Specifies the category of the target display the activity is expected to run on. Upon
             creation, a virtual display can specify which display categories it supports and one of
             the category must be present in the activity's manifest to allow this activity to run.
             The default value is {@code null}, which indicates the activity does not belong to a
             restricted display category and thus can only run on a display that didn't specify any
             display categories. Each activity can only specify one category it targets to but a
             virtual display can accommodate multiple restricted categories.

             <p> This field should be formatted as a Java-language-style free form string(for
             example, com.google.automotive_entertainment), which may contain uppercase or lowercase
             letters ('A' through 'Z'), numbers, and underscores ('_') but may only start with
             letters.
         -->
        <attr name="targetDisplayCategory" format="string"/>
    </declare-styleable>

    <!-- The <code>activity-alias</code> tag declares a new
+1 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@
    <public name="handwritingBoundsOffsetBottom" />
    <public name="accessibilityDataPrivate" />
    <public name="enableTextStylingShortcuts" />
    <public name="targetDisplayCategory"/>
  </staging-public-group>

  <staging-public-group type="id" first-id="0x01cd0000">
+1 −0
Original line number Diff line number Diff line
@@ -570,6 +570,7 @@ public class PackageInfoUtils {
            ai.metaData = null;
        }
        ai.applicationInfo = applicationInfo;
        ai.targetDisplayCategory = a.getTargetDisplayCategory();
        ai.setKnownActivityEmbeddingCerts(a.getKnownActivityEmbeddingCerts());
        assignFieldsComponentInfoParsedMainComponent(ai, a, pkgSetting, userId);
        return ai;
Loading