Commits

Anonymous committed 4d8d542

Update constant names to match seandroid branch

Comments (0)

Files changed (3)

     field public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0; // 0x0
     field public static final java.lang.String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION";
     field public static final java.lang.String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN";
-    field public static final int FILE_CONTEXTS_FILE = 2; // 0x2
     field public static final int MMAC_POLICY_FILE = 4; // 0x4
     field public static final int PASSWORD_QUALITY_ALPHABETIC = 262144; // 0x40000
     field public static final int PASSWORD_QUALITY_ALPHANUMERIC = 327680; // 0x50000
     field public static final int PASSWORD_QUALITY_NUMERIC = 131072; // 0x20000
     field public static final int PASSWORD_QUALITY_SOMETHING = 65536; // 0x10000
     field public static final int PASSWORD_QUALITY_UNSPECIFIED = 0; // 0x0
-    field public static final int POLICY_FILE_COUNT = 5; // 0x5
-    field public static final int PROPERTY_CONTEXTS_FILE = 1; // 0x1
     field public static final int RESET_PASSWORD_REQUIRE_ENTRY = 1; // 0x1
-    field public static final int SEAPP_CONTEXTS_FILE = 3; // 0x3
-    field public static final int SELINUX_POLICY_FILE = 0; // 0x0
+    field public static final int SEPOLICY_FILE_COUNT = 5; // 0x5
+    field public static final int SEPOLICY_FILE_FILECTXS = 2; // 0x2
+    field public static final int SEPOLICY_FILE_PROPCTXS = 1; // 0x1
+    field public static final int SEPOLICY_FILE_SEAPPCTXS = 3; // 0x3
+    field public static final int SEPOLICY_FILE_SEPOLICY = 0; // 0x0
     field public static final int WIPE_EXTERNAL_STORAGE = 1; // 0x1
   }
 

core/java/android/app/admin/DevicePolicyManager.java

      * current admin.
      *
      * <p>The calling device admin must have requested
-     * {@link DeviceAdminInfo#USES_POLICY_ENFORCE_SELINUX} to be able to call
+     * {@link DeviceAdminInfo#USES_POLICY_ENFORCE_MMAC} to be able to call
      * this method; if it has not, a security exception will be thrown.
      *
      * <p>The returned value is only meaningful if the current admin is a
 
     // Before changing these values, be sure to update
     // DevicePolicyManagerService.java's POLICY_DESCRIPTIONS array.
-    public static final int SELINUX_POLICY_FILE = 0;
-    public static final int PROPERTY_CONTEXTS_FILE = 1;
-    public static final int FILE_CONTEXTS_FILE = 2;
-    public static final int SEAPP_CONTEXTS_FILE = 3;
+    public static final int SEPOLICY_FILE_SEPOLICY = 0;
+    public static final int SEPOLICY_FILE_PROPCTXS = 1;
+    public static final int SEPOLICY_FILE_FILECTXS = 2;
+    public static final int SEPOLICY_FILE_SEAPPCTXS = 3;
     public static final int MMAC_POLICY_FILE = 4;
-    public static final int POLICY_FILE_COUNT = MMAC_POLICY_FILE+1;
+    public static final int SEPOLICY_FILE_COUNT = MMAC_POLICY_FILE+1;
 
     /**
      * Sets a new policy file and reloads it at the proper time.
      * <p>For {@link #MMAC_POLICY_FILE}, the returned value is only meaingful
      * if the current admin is a MMAC admin.
      *
-     * <p>For {@link #SELINUX_POLICY_FILE}, {@link #PROPERTY_CONTEXTS_FILE},
-     * {@link #FILE_CONTEXTS_FILE}, and {@link #SEAPP_CONTEXTS_FILE}, the admin
+     * <p>For {@link #SEPOLICY_FILE_SEPOLICY}, {@link #SEPOLICY_FILE_PROPCTXS},
+     * {@link #SEPOLICY_FILE_FILECTXS}, and {@link #SEPOLICY_FILE_SEAPPCTXS}, the admin
      * must have requested {@link DeviceAdminInfo#USES_POLICY_ENFORCE_SELINUX}
      * before calling this method. If it has not, a security exception will be
      * thrown.
      *
-     * <p>For {@link #SELINUX_POLICY_FILE}, {@link #PROPERTY_CONTEXTS_FILE},
-     * {@link #FILE_CONTEXTS_FILE}, and {@link #SEAPP_CONTEXTS_FILE}, these
+     * <p>For {@link #SEPOLICY_FILE_SEPOLICY}, {@link #SEPOLICY_FILE_PROPCTXS},
+     * {@link #SEPOLICY_FILE_FILECTXS}, and {@link #SEPOLICY_FILE_SEAPPCTXS}, these
      * files are reloaded before returning from the DevicePolicyManager.
      *
-     * <p>For {@link #SELINUX_POLICY_FILE}, {@link #PROPERTY_CONTEXTS_FILE},
-     * {@link #FILE_CONTEXTS_FILE}, and {@link #SEAPP_CONTEXTS_FILE}, the
+     * <p>For {@link #SEPOLICY_FILE_SEPOLICY}, {@link #SEPOLICY_FILE_PROPCTXS},
+     * {@link #SEPOLICY_FILE_FILECTXS}, and {@link #SEPOLICY_FILE_SEAPPCTXS}, the
      * returned value is only meaingful if the current admin is a SELinux
      * admin.
      *
      * @param admin which {@link DeviceAdminReceiver} this request is associated with
-     * @param policyType one of {@link #SELINUX_POLICY_FILE}, {@link #PROPERTY_CONTEXTS_FILE},
-     * {@link #FILE_CONTEXTS_FILE}, {@link #SEAPP_CONTEXTS_FILE}, or {@link #MMAC_POLICY_FILE}
+     * @param policyType one of {@link #SEPOLICY_FILE_SEPOLICY}, {@link #SEPOLICY_FILE_PROPCTXS},
+     * {@link #SEPOLICY_FILE_FILECTXS}, {@link #SEPOLICY_FILE_SEAPPCTXS}, or {@link #MMAC_POLICY_FILE}
      * @param policy the new policy file in bytes, or null if you wish to revert to
      * the default policy
      * @return false if Android was unable to set the new policy
      * <p>For {@link #MMAC_POLICY_FILE}, the returned value is only meaingful
      * if the current admin is a MMAC admin.
      *
-     * <p>For {@link #SELINUX_POLICY_FILE}, {@link #PROPERTY_CONTEXTS_FILE},
-     * {@link #FILE_CONTEXTS_FILE}, and {@link #SEAPP_CONTEXTS_FILE}, the admin
+     * <p>For {@link #SEPOLICY_FILE_SEPOLICY}, {@link #SEPOLICY_FILE_PROPCTXS},
+     * {@link #SEPOLICY_FILE_FILECTXS}, and {@link #SEPOLICY_FILE_SEAPPCTXS}, the admin
      * must have requested {@link DeviceAdminInfo#USES_POLICY_ENFORCE_SELINUX}
      * before calling this method. If it has not, a security exception will be
      * thrown.
      *
-     * <p>For {@link #SELINUX_POLICY_FILE}, {@link #PROPERTY_CONTEXTS_FILE},
-     * {@link #FILE_CONTEXTS_FILE}, and {@link #SEAPP_CONTEXTS_FILE}, the
+     * <p>For {@link #SEPOLICY_FILE_SEPOLICY}, {@link #SEPOLICY_FILE_PROPCTXS},
+     * {@link #SEPOLICY_FILE_FILECTXS}, and {@link #SEPOLICY_FILE_SEAPPCTXS}, the
      * returned value is only meaingful if the current admin is a SELinux
      * admin.
      *
      * @param admin which {@link DeviceAdminReceiver} this request is associated with
-     * @param policyType one of {@link #SELINUX_POLICY_FILE}, {@link #PROPERTY_CONTEXTS_FILE},
-     * {@link #FILE_CONTEXTS_FILE}, {@link #SEAPP_CONTEXTS_FILE}, or {@link #MMAC_POLICY_FILE}
+     * @param policyType one of {@link #SEPOLICY_FILE_SEPOLICY}, {@link #SEPOLICY_FILE_PROPCTXS},
+     * {@link #SEPOLICY_FILE_FILECTXS}, {@link #SEPOLICY_FILE_SEAPPCTXS}, or {@link #MMAC_POLICY_FILE}
      * @return true if the admin set a custom policy file
      */
     public boolean isCustomPolicyFile(ComponentName admin, int policyType) {

services/java/com/android/server/DevicePolicyManagerService.java

         boolean isMMACadmin = false;
         boolean enforceMMAC = false;
 
-        boolean[] isCustomPolicyFile = new boolean[DevicePolicyManager.POLICY_FILE_COUNT];
+        boolean[] isCustomPolicyFile = new boolean[DevicePolicyManager.SEPOLICY_FILE_COUNT];
 
         ActiveAdmin(DeviceAdminInfo _info) {
             info = _info;
                     out.attribute(null, "value", sebools.get(s).toString());
                     out.endTag(null, "selinux-boolean");
                 }
-                boolean isCustomSELinux = isCustomPolicyFile[DevicePolicyManager.SELINUX_POLICY_FILE];
+                boolean isCustomSELinux = isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEPOLICY];
                 if (isCustomSELinux) {
                     out.startTag(null, "selinux-sepolicy");
                     out.attribute(null, "value", Boolean.toString(isCustomSELinux));
                     out.endTag(null, "selinux-sepolicy");
                 }
-                boolean isCustomPropCtxs = isCustomPolicyFile[DevicePolicyManager.PROPERTY_CONTEXTS_FILE];
+                boolean isCustomPropCtxs = isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_PROPCTXS];
                 if (isCustomPropCtxs) {
                     out.startTag(null, "selinux-propctxs");
                     out.attribute(null, "value", Boolean.toString(isCustomPropCtxs));
                     out.endTag(null, "selinux-propctxs");
                 }
-                boolean isCustomFileCtxs = isCustomPolicyFile[DevicePolicyManager.FILE_CONTEXTS_FILE];
+                boolean isCustomFileCtxs = isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_FILECTXS];
                 if (isCustomFileCtxs) {
                     out.startTag(null, "selinux-filectxs");
                     out.attribute(null, "value", Boolean.toString(isCustomFileCtxs));
                     out.endTag(null, "selinux-filectxs");
                 }
-                boolean isCustomSEAppCtxs = isCustomPolicyFile[DevicePolicyManager.SEAPP_CONTEXTS_FILE];
+                boolean isCustomSEAppCtxs = isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEAPPCTXS];
                 if (isCustomSEAppCtxs) {
                     out.startTag(null, "selinux-seappctxs");
                     out.attribute(null, "value", Boolean.toString(isCustomSEAppCtxs));
                             Boolean.parseBoolean(
                                     parser.getAttributeValue(null, "value")));
                 } else if ("selinux-sepolicy".equals(tag)) {
-                    this.isCustomPolicyFile[DevicePolicyManager.SELINUX_POLICY_FILE] =
+                    this.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEPOLICY] =
                             Boolean.parseBoolean(parser.getAttributeValue(null, "value"));
                 } else if ("selinux-propctxs".equals(tag)) {
-                    this.isCustomPolicyFile[DevicePolicyManager.PROPERTY_CONTEXTS_FILE] =
+                    this.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_PROPCTXS] =
                             Boolean.parseBoolean(parser.getAttributeValue(null, "value"));
                 } else if ("selinux-filectxs".equals(tag)) {
-                    this.isCustomPolicyFile[DevicePolicyManager.FILE_CONTEXTS_FILE] =
+                    this.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_FILECTXS] =
                             Boolean.parseBoolean(parser.getAttributeValue(null, "value"));
                 } else if ("selinux-seappctxs".equals(tag)) {
-                    this.isCustomPolicyFile[DevicePolicyManager.SEAPP_CONTEXTS_FILE] =
+                    this.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEAPPCTXS] =
                             Boolean.parseBoolean(parser.getAttributeValue(null, "value"));
                 } else if ("mmac-admin".equals(tag)) {
                     isMMACadmin = Boolean.parseBoolean(
             pw.print(prefix); pw.print("sebools=");
                     pw.println(sebools);
             pw.print(prefix); pw.print("customSELinuxPolicy=");
-                    pw.println(isCustomPolicyFile[DevicePolicyManager.SELINUX_POLICY_FILE]);
+                    pw.println(isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEPOLICY]);
             pw.print(prefix); pw.print("customPropertyContexts=");
-                    pw.println(isCustomPolicyFile[DevicePolicyManager.PROPERTY_CONTEXTS_FILE]);
+                    pw.println(isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_PROPCTXS]);
             pw.print(prefix); pw.print("customFileContexts=");
-                    pw.println(isCustomPolicyFile[DevicePolicyManager.FILE_CONTEXTS_FILE]);
+                    pw.println(isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_FILECTXS]);
             pw.print(prefix); pw.print("customSEappContexts=");
-                    pw.println(isCustomPolicyFile[DevicePolicyManager.SEAPP_CONTEXTS_FILE]);
+                    pw.println(isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEAPPCTXS]);
             pw.print(prefix); pw.print("isMMACadmin=");
                     pw.println(isMMACadmin);
             pw.print(prefix); pw.print("enforceMMAC=");
                                 }
                                 if (doSELinuxCleanup) {
                                     syncSELinuxPolicyLocked(
-                                            admin.isCustomPolicyFile[DevicePolicyManager.SELINUX_POLICY_FILE],
-                                            admin.isCustomPolicyFile[DevicePolicyManager.PROPERTY_CONTEXTS_FILE],
-                                            admin.isCustomPolicyFile[DevicePolicyManager.FILE_CONTEXTS_FILE],
-                                            admin.isCustomPolicyFile[DevicePolicyManager.SEAPP_CONTEXTS_FILE]);
+                                            admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEPOLICY],
+                                            admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_PROPCTXS],
+                                            admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_FILECTXS],
+                                            admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEAPPCTXS]);
                                 }
                                 if (doMMACcleanup) {
                                     syncMMACpolicyLocked(admin.isCustomPolicyFile[DevicePolicyManager.MMAC_POLICY_FILE]);
     }
 
     public void systemReady() {
-        assert DevicePolicyManager.POLICY_FILE_COUNT == POLICY_DESCRIPTIONS.length;
+        assert DevicePolicyManager.SEPOLICY_FILE_COUNT == POLICY_DESCRIPTIONS.length;
         synchronized (this) {
             loadSettingsLocked();
         }
 
             // Case TTT(F) = 1
             if (!control && curAdmin.equals(admin)) {
-                boolean setSEpolicyFile = admin.isCustomPolicyFile[DevicePolicyManager.SELINUX_POLICY_FILE];
-                boolean setPropertyContextsFile = admin.isCustomPolicyFile[DevicePolicyManager.PROPERTY_CONTEXTS_FILE];
-                boolean setFileContextsFile = admin.isCustomPolicyFile[DevicePolicyManager.FILE_CONTEXTS_FILE];
-                boolean setSEappContextsFile = admin.isCustomPolicyFile[DevicePolicyManager.SEAPP_CONTEXTS_FILE];
+                boolean setSEpolicyFile = admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEPOLICY];
+                boolean setPropertyContextsFile = admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_PROPCTXS];
+                boolean setFileContextsFile = admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_FILECTXS];
+                boolean setSEappContextsFile = admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEAPPCTXS];
 
                 Slog.v(TAG, admin.info.getComponent() + " is no longer a SELinux admin");
 
                 admin.isSELinuxAdmin = false;
                 admin.enforceSELinux = false;
-                admin.isCustomPolicyFile[DevicePolicyManager.SELINUX_POLICY_FILE] = false;
-                admin.isCustomPolicyFile[DevicePolicyManager.PROPERTY_CONTEXTS_FILE] = false;
-                admin.isCustomPolicyFile[DevicePolicyManager.FILE_CONTEXTS_FILE] = false;
-                admin.isCustomPolicyFile[DevicePolicyManager.SEAPP_CONTEXTS_FILE] = false;
+                admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEPOLICY] = false;
+                admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_PROPCTXS] = false;
+                admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_FILECTXS] = false;
+                admin.isCustomPolicyFile[DevicePolicyManager.SEPOLICY_FILE_SEAPPCTXS] = false;
 
                 saveSettingsLocked();
                 syncSELinuxPolicyLocked(setSEpolicyFile,
         if (who == null) {
             throw new IllegalArgumentException("ComponentName is null");
         }
-        if (policyType >= DevicePolicyManager.POLICY_FILE_COUNT) {
+        if (policyType >= DevicePolicyManager.SEPOLICY_FILE_COUNT) {
             throw new IllegalArgumentException("policyType is unknown");
         }
 
         if (who == null) {
             throw new NullPointerException("ComponentName is null");
         }
-        if (policyType >= DevicePolicyManager.POLICY_FILE_COUNT) {
+        if (policyType >= DevicePolicyManager.SEPOLICY_FILE_COUNT) {
             throw new IllegalArgumentException("policyType is unknown");
         }