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

Commit 531270a4 authored by Nicolas Prevot's avatar Nicolas Prevot
Browse files

Adding the requiredForProfile flag.

Enabling to use requiredForProfile in application manifests
It determines which applications will be installed for managed profiles
and for restricted profiles

Change-Id: I14b4de2c9f41c2bbf5cd9fd0ca6caf5ce2d04131
parent 4531e9c4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -890,6 +890,7 @@ package android {
    field public static final int required = 16843406; // 0x101028e
    field public static final int requiredAccountType = 16843734; // 0x10103d6
    field public static final int requiredForAllUsers = 16843728; // 0x10103d0
    field public static final int requiredForProfile = 16843778; // 0x1010402
    field public static final int requiresFadingEdge = 16843685; // 0x10103a5
    field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364
    field public static final int resizeMode = 16843619; // 0x1010363
+21 −0
Original line number Diff line number Diff line
@@ -208,6 +208,19 @@ public class PackageInfo implements Parcelable {
     * @hide
     */
    public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2;
    /**
     * Flag for {@link #requiredForProfile}
     * The application will always be installed for a restricted profile.
     * @hide
     */
    public static final int RESTRICTED_PROFILE = 1;
    /**
     * Flag for {@link #requiredForProfile}
     * The application will always be installed for a managed profile.
     * @hide
     */
    public static final int MANAGED_PROFILE = 2;

    /**
     * The install location requested by the activity.  From the
     * {@link android.R.attr#installLocation} attribute, one of
@@ -218,6 +231,12 @@ public class PackageInfo implements Parcelable {
     */
    public int installLocation = INSTALL_LOCATION_INTERNAL_ONLY;

    /**
     * Defines which profiles this app is required for.
     * @hide
     */
    public int requiredForProfile;

    /** @hide */
    public boolean requiredForAllUsers;

@@ -276,6 +295,7 @@ public class PackageInfo implements Parcelable {
        dest.writeTypedArray(reqFeatures, parcelableFlags);
        dest.writeInt(installLocation);
        dest.writeInt(requiredForAllUsers ? 1 : 0);
        dest.writeInt(requiredForProfile);
        dest.writeString(restrictedAccountType);
        dest.writeString(requiredAccountType);
        dest.writeString(overlayTarget);
@@ -318,6 +338,7 @@ public class PackageInfo implements Parcelable {
        reqFeatures = source.createTypedArray(FeatureInfo.CREATOR);
        installLocation = source.readInt();
        requiredForAllUsers = source.readInt() != 0;
        requiredForProfile = source.readInt();
        restrictedAccountType = source.readString();
        requiredAccountType = source.readString();
        overlayTarget = source.readString();
+6 −0
Original line number Diff line number Diff line
@@ -304,6 +304,7 @@ public class PackageParser {
        if ((pi.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) != 0
                || (pi.applicationInfo.flags&ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
            pi.requiredForAllUsers = p.mRequiredForAllUsers;
            pi.requiredForProfile = p.mRequiredForProfile;
        }
        pi.restrictedAccountType = p.mRestrictedAccountType;
        pi.requiredAccountType = p.mRequiredAccountType;
@@ -1978,6 +1979,8 @@ public class PackageParser {
                false)) {
            owner.mRequiredForAllUsers = true;
        }
        owner.mRequiredForProfile = sa.getInt(
                com.android.internal.R.styleable.AndroidManifestApplication_requiredForProfile, 0);

        String restrictedAccountType = sa.getString(com.android.internal.R.styleable
                .AndroidManifestApplication_restrictedAccountType);
@@ -3565,6 +3568,9 @@ public class PackageParser {
        /* An app that's required for all users and cannot be uninstalled for a user */
        public boolean mRequiredForAllUsers;

        /* For which types of profile this app is required */
        public int mRequiredForProfile;

        /* The restricted account authenticator type that is used by this application */
        public String mRestrictedAccountType;

+12 −0
Original line number Diff line number Diff line
@@ -259,6 +259,17 @@
         applications can request this feature. Default value is false. -->
    <attr name="requiredForAllUsers" format="boolean" />

    <!-- Flag to specifiy for which types of profile this application needs to be present.
         Only pre-installed applications can request this feature. Default is none. -->
    <attr name="requiredForProfile">
        <!-- This application needs to be present for restricted profiles -->
        <flag name="restricted" value="0x0001" />
        <!-- This application needs to be present for managed profiles -->
        <flag name="managed" value="0x0002" />
        <!-- This application needs to be present for all types of profiles -->
        <flag name="all" value="0xFFFF" />
    </attr>

    <!-- Flag indicating whether the application can be debugged, even when
         running on a device that is running in user mode. -->
    <attr name="debuggable" format="boolean" />
@@ -901,6 +912,7 @@
        <attr name="hasCode" format="boolean" />
        <attr name="persistent" />
        <attr name="requiredForAllUsers" />
        <attr name="requiredForProfile" />
        <!-- Specify whether the components in this application are enabled or not (that is, can be
             instantiated by the system).
             If "false", it overrides any component specific values (a value of "true" will not
+1 −0
Original line number Diff line number Diff line
@@ -2108,6 +2108,7 @@
  <public type="attr" name="sharedElementName" />
  <public type="attr" name="transitionGroup" />
  <public type="attr" name="castsShadow" />
  <public type="attr" name="requiredForProfile"/>

  <public type="id" name="shared_element_name" />