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 com.android.deviceaswebcam.annotations; 18 19 import java.lang.annotation.ElementType; 20 import java.lang.annotation.Target; 21 22 /** 23 * Annotation used for marking methods and fields that are called from native code. Useful for 24 * keeping components that would otherwise be removed by Proguard. Use the value parameter to 25 * mention a file that calls this method. 26 * 27 * <p>Note that adding this annotation to a method is not enough to guarantee that it is kept - 28 * either its class must be referenced elsewhere in the program, or the class must be annotated with 29 * this as well. 30 * 31 * <p>Usage example: 32 * 33 * <pre>{@code 34 * @UsedByNative("SdkFrameProvider.cpp") 35 * public static void foo() { 36 * ... 37 * } 38 * }</pre> 39 */ 40 @Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE, ElementType.CONSTRUCTOR}) 41 public @interface UsedByNative { value()42 String value(); 43 } 44