diff options
| -rw-r--r-- | core/api/current.txt | 5 | ||||
| -rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 50 |
2 files changed, 55 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 6cb615374ad1..59fbfb7cc360 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -7456,6 +7456,7 @@ package android.app.admin { method public long getMaximumTimeToLock(@Nullable android.content.ComponentName); method @NonNull public java.util.List<java.lang.String> getMeteredDataDisabledPackages(@NonNull android.content.ComponentName); method public int getMinimumRequiredWifiSecurityLevel(); + method public int getMtePolicy(); method @RequiresPermission(value=android.Manifest.permission.READ_NEARBY_STREAMING_POLICY, conditional=true) public int getNearbyAppStreamingPolicy(); method @RequiresPermission(value=android.Manifest.permission.READ_NEARBY_STREAMING_POLICY, conditional=true) public int getNearbyNotificationStreamingPolicy(); method @Deprecated @ColorInt public int getOrganizationColor(@NonNull android.content.ComponentName); @@ -7604,6 +7605,7 @@ package android.app.admin { method public void setMaximumTimeToLock(@NonNull android.content.ComponentName, long); method @NonNull public java.util.List<java.lang.String> setMeteredDataDisabledPackages(@NonNull android.content.ComponentName, @NonNull java.util.List<java.lang.String>); method public void setMinimumRequiredWifiSecurityLevel(int); + method public void setMtePolicy(int); method public void setNearbyAppStreamingPolicy(int); method public void setNearbyNotificationStreamingPolicy(int); method public void setNetworkLoggingEnabled(@Nullable android.content.ComponentName, boolean); @@ -7787,6 +7789,9 @@ package android.app.admin { field public static final int LOCK_TASK_FEATURE_SYSTEM_INFO = 1; // 0x1 field public static final int MAKE_USER_EPHEMERAL = 2; // 0x2 field public static final String MIME_TYPE_PROVISIONING_NFC = "application/com.android.managedprovisioning"; + field public static final int MTE_DISABLED = 2; // 0x2 + field public static final int MTE_ENABLED = 1; // 0x1 + field public static final int MTE_NOT_CONTROLLED_BY_POLICY = 0; // 0x0 field public static final int NEARBY_STREAMING_DISABLED = 1; // 0x1 field public static final int NEARBY_STREAMING_ENABLED = 2; // 0x2 field public static final int NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY = 0; // 0x0 diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index de196870ef4e..f4cee5a09ff4 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -3864,6 +3864,56 @@ public class DevicePolicyManager { public static final String EXTRA_RESOURCE_IDS = "android.app.extra.RESOURCE_IDS"; + /** Allow the user to choose whether to enable MTE on the device. */ + public static final int MTE_NOT_CONTROLLED_BY_POLICY = 0; + + /** + * Require that MTE be enabled on the device, if supported. Can be set by a device owner or a + * profile owner of an organization-owned managed profile. + */ + public static final int MTE_ENABLED = 1; + + /** Require that MTE be disabled on the device. Can be set by a device owner. */ + public static final int MTE_DISABLED = 2; + + /** @hide */ + @IntDef( + prefix = {"MTE_"}, + value = {MTE_ENABLED, MTE_DISABLED, MTE_NOT_CONTROLLED_BY_POLICY}) + @Retention(RetentionPolicy.SOURCE) + public static @interface MtePolicy {} + + /** + * Set MTE policy for device. MTE_ENABLED does not necessarily enable MTE if set on a device + * that does not support MTE. + * + * The default policy is MTE_NOT_CONTROLLED_BY_POLICY. + * + * Memory Tagging Extension (MTE) is a CPU extension that allows to protect against certain + * classes of security problems at a small runtime performance cost overhead. + * + * @param policy the policy to be set + */ + public void setMtePolicy(@MtePolicy int policy) { + // TODO(b/244290023): implement + // This is SecurityException to temporarily make ParentProfileTest happy. + // This is not used. + throw new SecurityException("not implemented"); + } + + /** + * Get currently set MTE policy. This is not necessarily the same as the state of MTE on the + * device, as the device might not support MTE. + * + * @return the currently set policy + */ + public @MtePolicy int getMtePolicy() { + // TODO(b/244290023): implement + // This is SecurityException to temporarily make ParentProfileTest happy. + // This is not used. + throw new SecurityException("not implemented"); + } + /** * This object is a single place to tack on invalidation and disable calls. All * binder caches in this class derive from this Config, so all can be invalidated or |