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

Commit 25bfb2b3 authored by Jeffrey Vander Stoep's avatar Jeffrey Vander Stoep Committed by Android (Google) Code Review
Browse files

Merge "pm: selinux support for AutoPlay apps"

parents fa17e612 a4407bfc
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -478,6 +478,14 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public static final int PRIVATE_FLAG_ENCRYPTION_AWARE = 1 << 6;

    /**
     * Value for {@link #privateFlags}: set to {@code true} if the application
     * is AutoPlay.
     *
     * {@hide}
     */
    public static final int PRIVATE_FLAG_AUTOPLAY = 1<<6;

    /**
     * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
     * {@hide}
@@ -1046,6 +1054,13 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        return (privateFlags & ApplicationInfo.PRIVATE_FLAG_ENCRYPTION_AWARE) != 0;
    }

    /**
     * @hide
     */
    public boolean isAutoPlayApp() {
        return (privateFlags & ApplicationInfo.PRIVATE_FLAG_AUTOPLAY) != 0;
    }

    /**
     * @hide
     */
+6 −0
Original line number Diff line number Diff line
@@ -103,6 +103,9 @@ public final class SELinuxMMAC {
    // Append privapp to existing seinfo label
    private static final String PRIVILEGED_APP_STR = ":privapp";

    // Append autoplay to existing seinfo label
    private static final String AUTOPLAY_APP_STR = ":autoplayapp";

    /**
     * Load the mac_permissions.xml file containing all seinfo assignments used to
     * label apps. The loaded mac_permissions.xml file is determined by the
@@ -316,6 +319,9 @@ public final class SELinuxMMAC {
            }
        }

        if (pkg.applicationInfo.isAutoPlayApp())
            pkg.applicationInfo.seinfo += AUTOPLAY_APP_STR;

        if (pkg.applicationInfo.isPrivilegedApp())
            pkg.applicationInfo.seinfo += PRIVILEGED_APP_STR;