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

Commit ccbe389b authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Introducing manifest flag requiredAccountType

This can be used by apps that won't work without an account of that
type in the limited user environment. This way we can avoid letting
users select these apps when setting up a limited user.

Bug: 8600261
Change-Id: Iaa0dd5ff88e89fa7a1d8a4e70317290268411bdb
parent e107aa43
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -852,6 +852,7 @@ package android {
    field public static final int reqNavigation = 16843306; // 0x101022a
    field public static final int reqTouchScreen = 16843303; // 0x1010227
    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 requiresFadingEdge = 16843685; // 0x10103a5
    field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364
+5 −0
Original line number Diff line number Diff line
@@ -224,6 +224,9 @@ public class PackageInfo implements Parcelable {
    /** @hide */
    public String restrictedAccountType;

    /** @hide */
    public String requiredAccountType;

    public PackageInfo() {
    }

@@ -266,6 +269,7 @@ public class PackageInfo implements Parcelable {
        dest.writeInt(installLocation);
        dest.writeInt(requiredForAllUsers ? 1 : 0);
        dest.writeString(restrictedAccountType);
        dest.writeString(requiredAccountType);
    }

    public static final Parcelable.Creator<PackageInfo> CREATOR
@@ -306,5 +310,6 @@ public class PackageInfo implements Parcelable {
        installLocation = source.readInt();
        requiredForAllUsers = source.readInt() != 0;
        restrictedAccountType = source.readString();
        requiredAccountType = source.readString();
    }
}
+13 −3
Original line number Diff line number Diff line
@@ -289,6 +289,7 @@ public class PackageParser {
        pi.installLocation = p.installLocation;
        pi.requiredForAllUsers = p.mRequiredForAllUsers;
        pi.restrictedAccountType = p.mRestrictedAccountType;
        pi.requiredAccountType = p.mRequiredAccountType;
        pi.firstInstallTime = firstInstallTime;
        pi.lastUpdateTime = lastUpdateTime;
        if ((flags&PackageManager.GET_GIDS) != 0) {
@@ -1816,13 +1817,19 @@ public class PackageParser {
                    false)) {
                owner.mRequiredForAllUsers = true;
            }
            String accountType = sa.getString(com.android.internal.R.styleable
            String restrictedAccountType = sa.getString(com.android.internal.R.styleable
                    .AndroidManifestApplication_restrictedAccountType);
            if (accountType != null && accountType.length() > 0) {
                owner.mRestrictedAccountType = accountType;
            if (restrictedAccountType != null && restrictedAccountType.length() > 0) {
                owner.mRestrictedAccountType = restrictedAccountType;
            }
        }

        String requiredAccountType = sa.getString(com.android.internal.R.styleable
                .AndroidManifestApplication_requiredAccountType);
        if (requiredAccountType != null && requiredAccountType.length() > 0) {
            owner.mRequiredAccountType = requiredAccountType;
        }

        if (sa.getBoolean(
                com.android.internal.R.styleable.AndroidManifestApplication_debuggable,
                false)) {
@@ -3339,6 +3346,9 @@ public class PackageParser {
        /* The restricted account authenticator type that is used by this application */
        public String mRestrictedAccountType;

        /* The required account type without which this application will not function */
        public String mRequiredAccountType;

        /**
         * Digest suitable for comparing whether this package's manifest is the
         * same as another.
+6 −1
Original line number Diff line number Diff line
@@ -909,8 +909,13 @@
        <!-- Declare that this application requires access to restricted accounts of a certain
             type. The default value is null and restricted accounts won\'t be visible to this
             application. The type should correspond to the account authenticator type, such as
             "com.google" -->
             "com.google". Only usable by system apps. -->
        <attr name="restrictedAccountType" format="string"/>
        <!-- Declare that this application requires an account of a certain
             type. The default value is null and indicates that the application can work without
             any accounts. The type should correspond to the account authenticator type, such as
             "com.google". -->
        <attr name="requiredAccountType" format="string"/>
    </declare-styleable>
    
    <!-- The <code>permission</code> tag declares a security permission that can be
+1 −0
Original line number Diff line number Diff line
@@ -2042,6 +2042,7 @@
  <public type="attr" name="childIndicatorStart" />
  <public type="attr" name="childIndicatorEnd" />
  <public type="attr" name="restrictedAccountType" />
  <public type="attr" name="requiredAccountType" />

  <public type="style" name="Theme.NoTitleBar.Overscan" />
  <public type="style" name="Theme.Light.NoTitleBar.Overscan" />