summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeffrey Vander Stoep <jeffv@google.com> 2015-11-16 19:38:33 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2015-11-16 19:38:33 +0000
commit25bfb2b3d82797b78f5f6b5a715dbe5d192a0949 (patch)
treefb5f30168cc6079c5618f18080f8ff04ceb7c6eb
parentfa17e612911a131a356dd80cd4be801bdc6b39dd (diff)
parenta4407bfceef1bdb7eb4d83990722a61082d926c9 (diff)
Merge "pm: selinux support for AutoPlay apps"
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java15
-rw-r--r--services/core/java/com/android/server/pm/SELinuxMMAC.java6
2 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 9c880d3591c3..52ec4ccfd8f3 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -479,6 +479,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}
*/
@@ -1049,6 +1057,13 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
/**
* @hide
*/
+ public boolean isAutoPlayApp() {
+ return (privateFlags & ApplicationInfo.PRIVATE_FLAG_AUTOPLAY) != 0;
+ }
+
+ /**
+ * @hide
+ */
@Override protected ApplicationInfo getApplicationInfo() {
return this;
}
diff --git a/services/core/java/com/android/server/pm/SELinuxMMAC.java b/services/core/java/com/android/server/pm/SELinuxMMAC.java
index 5d8b1d281d54..903d12bcc217 100644
--- a/services/core/java/com/android/server/pm/SELinuxMMAC.java
+++ b/services/core/java/com/android/server/pm/SELinuxMMAC.java
@@ -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;