1 /* 2 * Copyright (C) 2023 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 android.annotation; 18 19 import static java.lang.annotation.ElementType.METHOD; 20 import static java.lang.annotation.RetentionPolicy.SOURCE; 21 22 import java.lang.annotation.Retention; 23 import java.lang.annotation.Target; 24 25 /** 26 * Indicates that this policy API can be set by multiple admins. 27 * 28 * <p>Starting from Android U ({@link Build.VERSION_CODES#UPSIDE_DOWN_CAKE}), multiple management 29 * admins will be able to coexist on the same device (e.g. a financed device with an enterprise 30 * admin). This requires adding multi-admin support for all the policy-related APIs (mostly in 31 * {@link android.app.admin.DevicePolicyManager}). However, for Android U only a subset of 32 * APIs will be supported, those will be marked with {@literal @}SupportsCoexistence annotation. 33 * </p> 34 * 35 * Example: 36 * <pre>{@code 37 * {@literal @}SupportsCoexistence 38 * public boolean setPermissionGrantState({@literal @}NonNull ComponentName admin, 39 * {@literal @}NonNull String packageName, {@literal @}NonNull String permission, 40 * {@literal @}PermissionGrantState int grantState) { 41 * throwIfParentInstance("setPermissionGrantState"); 42 * }</pre> 43 * 44 * @hide 45 */ 46 47 @Retention(SOURCE) 48 @Target(METHOD) 49 public @interface SupportsCoexistence { 50 } 51