1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.bedstead.harrier.annotations.enterprise; 18 19 import java.lang.annotation.ElementType; 20 import java.lang.annotation.Retention; 21 import java.lang.annotation.RetentionPolicy; 22 import java.lang.annotation.Target; 23 24 /** 25 * Used to annotate an enterprise policy for use with {@link NegativePolicyTest} and 26 * {@link PositivePolicyTest}. 27 */ 28 @Target(ElementType.TYPE) 29 @Retention(RetentionPolicy.RUNTIME) 30 public @interface EnterprisePolicy { 31 enum DeviceOwnerControl { 32 /** A policy that can be applied by a Device Owner to all users on the device. */ 33 GLOBAL, 34 35 /** 36 * A policy that can be applied by a Device Owner and applies to the device owner 37 * itself and to affiliated users on the device. 38 */ 39 AFFILIATED, 40 41 /** A policy that can be applied by a Device Owner to only the Device Owner's user. */ 42 USER, 43 44 /** A policy that cannot be applied by a Device Owner. */ 45 NO 46 } 47 48 enum ProfileOwnerControl { 49 /** A policy that can be applied by a Profile Owner to the profile itself and its parent. */ 50 PARENT, 51 52 /** 53 * A policy that can be applied by a Profile Owner to the profile itself, and to the 54 * parent if it is a COPE profile. 55 */ 56 COPE_PARENT, 57 58 /** A policy that can be applied by a Profile Owner to the profile itself. */ 59 PROFILE, 60 61 /** A policy that can be applied by an affiliated Profile Owner, applying to itself. */ 62 AFFILIATED, 63 64 /** 65 * A policy that can be applied by an affiliated Profile Owner or a Profile Owner with no 66 * Device Owner. 67 * 68 * <p>The policy will be applied to the user, and interaction with other users is undefined. 69 */ 70 AFFILIATED_OR_NO_DO, 71 72 /** A policy that cannot be applied by a Profile Owner. */ 73 NO 74 } 75 deviceOwner()76 DeviceOwnerControl deviceOwner(); profileOwner()77 ProfileOwnerControl profileOwner(); 78 } 79